@cyber-harbour/ui 2.0.32 → 2.0.33

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.
@@ -1,3 +1,3 @@
1
- import {a as a$1,z}from'./chunk-E2SZRNFN.mjs';import {useState,useMemo}from'react';import {pdfjs,Document,Page}from'react-pdf';import'react-pdf/dist/Page/AnnotationLayer.css';import'react-pdf/dist/Page/TextLayer.css';import {jsx,jsxs}from'react/jsx-runtime';var a="/pdfjs";typeof window<"u"&&typeof document<"u"&&(pdfjs.GlobalWorkerOptions.workerSrc=`${a}/pdf.worker.min.js`);var B=a$1(({url:p})=>{let[t,v]=useState(0),[s,c]=useState(1),[g,u]=useState(true),[m,x]=useState(null),w=useMemo(()=>({cMapPacked:true,cMapUrl:`${a}/cmaps/`,standardFontDataUrl:`${a}/standard_fonts/`,wasmUrl:`${a}/wasm/`,iccUrl:`${a}/icc/`}),[]);function b({numPages:o}){v(o),u(false);}a$1(b,"onDocumentLoadSuccess");function P(o){x(`Failed to load PDF: ${o.message}`),u(false);}a$1(P,"onDocumentLoadError");function f(o){c(n=>n+o);}a$1(f,"changePage");function y(){f(-1);}a$1(y,"previousPage");function k(){f(1);}return a$1(k,"nextPage"),m?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:m})})}):jsxs("div",{className:"h-full w-full flex flex-col",children:[g&&jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF..."})}),t>0&&jsxs("div",{className:"flex items-center justify-center gap-4 p-4",children:[jsx(z,{variant:"outlined","aria-label":"previous page",color:"secondary",size:"small",type:"button",disabled:s<=1,onClick:y,icon:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m15 18-6-6 6-6"})})}),jsxs("span",{className:"flex items-center gap-2",children:[jsx("input",{type:"number",min:1,max:t,value:s,onChange:o=>{let n=parseInt(o.target.value,10);n>=1&&n<=t&&c(n);},className:"w-16 px-2 py-1 border rounded text-center"}),"/ ",t]}),jsx(z,{variant:"outlined","aria-label":"next page",color:"secondary",size:"small",type:"button",disabled:s>=t,onClick:k,icon:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m9 18 6-6-6-6"})})})]}),jsx("div",{className:"flex-1 flex justify-center overflow-auto",children:jsx(Document,{options:w,file:p,onLoadSuccess:b,onLoadError:P,loading:"",children:jsx(Page,{pageNumber:s,renderTextLayer:true,renderAnnotationLayer:true,className:"max-w-full max-h-full"})})})]})},"PdfDriver");
2
- export{B as PdfDriver};//# sourceMappingURL=PdfDriver-KPSPVZ55.mjs.map
3
- //# sourceMappingURL=PdfDriver-KPSPVZ55.mjs.map
1
+ import {a as a$1,z}from'./chunk-MTAZFTXQ.mjs';import {useState,useMemo}from'react';import {pdfjs,Document,Page}from'react-pdf';import'react-pdf/dist/Page/AnnotationLayer.css';import'react-pdf/dist/Page/TextLayer.css';import {jsx,jsxs}from'react/jsx-runtime';var a="/pdfjs";typeof window<"u"&&typeof document<"u"&&(pdfjs.GlobalWorkerOptions.workerSrc=`${a}/pdf.worker.min.js`);var B=a$1(({url:p})=>{let[t,v]=useState(0),[s,c]=useState(1),[g,u]=useState(true),[m,x]=useState(null),w=useMemo(()=>({cMapPacked:true,cMapUrl:`${a}/cmaps/`,standardFontDataUrl:`${a}/standard_fonts/`,wasmUrl:`${a}/wasm/`,iccUrl:`${a}/icc/`}),[]);function b({numPages:o}){v(o),u(false);}a$1(b,"onDocumentLoadSuccess");function P(o){x(`Failed to load PDF: ${o.message}`),u(false);}a$1(P,"onDocumentLoadError");function f(o){c(n=>n+o);}a$1(f,"changePage");function y(){f(-1);}a$1(y,"previousPage");function k(){f(1);}return a$1(k,"nextPage"),m?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsx("div",{className:"text-red-500 text-center",children:jsx("p",{children:m})})}):jsxs("div",{className:"h-full w-full flex flex-col",children:[g&&jsx("div",{className:"flex items-center justify-center h-full",children:jsx("div",{className:"text-gray-500",children:"Loading PDF..."})}),t>0&&jsxs("div",{className:"flex items-center justify-center gap-4 p-4",children:[jsx(z,{variant:"outlined","aria-label":"previous page",color:"secondary",size:"small",type:"button",disabled:s<=1,onClick:y,icon:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m15 18-6-6 6-6"})})}),jsxs("span",{className:"flex items-center gap-2",children:[jsx("input",{type:"number",min:1,max:t,value:s,onChange:o=>{let n=parseInt(o.target.value,10);n>=1&&n<=t&&c(n);},className:"w-16 px-2 py-1 border rounded text-center"}),"/ ",t]}),jsx(z,{variant:"outlined","aria-label":"next page",color:"secondary",size:"small",type:"button",disabled:s>=t,onClick:k,icon:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"m9 18 6-6-6-6"})})})]}),jsx("div",{className:"flex-1 flex justify-center overflow-auto",children:jsx(Document,{options:w,file:p,onLoadSuccess:b,onLoadError:P,loading:"",children:jsx(Page,{pageNumber:s,renderTextLayer:true,renderAnnotationLayer:true,className:"max-w-full max-h-full"})})})]})},"PdfDriver");
2
+ export{B as PdfDriver};//# sourceMappingURL=PdfDriver-K3H4CWAS.mjs.map
3
+ //# sourceMappingURL=PdfDriver-K3H4CWAS.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/FileViewer/drivers/PdfDriver/PdfDriver.tsx"],"names":["BASE_DIR","pdfjs","PdfDriver","__name","url","numPages","setNumPages","useState","pageNumber","setPageNumber","loading","setLoading","error","setError","options","useMemo","onDocumentLoadSuccess","onDocumentLoadError","changePage","offset","prevPageNumber","previousPage","nextPage","jsx","jsxs","Button","e","page","Document","Page"],"mappings":"kQAMA,IAAMA,CAAAA,CAAW,SAGb,OAAO,MAAA,CAAW,KAAe,OAAO,QAAA,CAAa,MACvDC,KAAM,CAAA,mBAAA,CAAoB,UAAY,CAAGD,EAAAA,CAAQ,sBAOtCE,IAAAA,CAAAA,CAAsCC,IAAA,CAAC,CAAE,IAAAC,CAAI,CAAA,GAAM,CAC9D,GAAM,CAACC,CAAUC,CAAAA,CAAW,EAAIC,QAAiB,CAAA,CAAC,EAC5C,CAACC,CAAAA,CAAYC,CAAa,CAAIF,CAAAA,QAAAA,CAAiB,CAAC,CAChD,CAAA,CAACG,EAASC,CAAU,CAAA,CAAIJ,SAAkB,IAAI,CAAA,CAC9C,CAACK,CAAOC,CAAAA,CAAQ,EAAIN,QAAwB,CAAA,IAAI,EAEhDO,CAAUC,CAAAA,OAAAA,CACd,KAAO,CACL,UAAA,CAAY,KACZ,OAAS,CAAA,CAAA,EAAGf,CAAQ,CACpB,OAAA,CAAA,CAAA,mBAAA,CAAqB,GAAGA,CAAQ,CAAA,gBAAA,CAAA,CAChC,QAAS,CAAGA,EAAAA,CAAQ,CACpB,MAAA,CAAA,CAAA,MAAA,CAAQ,GAAGA,CAAQ,CAAA,KAAA,CACrB,GACA,EACF,EAIA,SAASgB,CAAAA,CAAsB,CAAE,QAAAX,CAAAA,CAAS,EAA+B,CACvEC,CAAAA,CAAYD,CAAQ,CACpBM,CAAAA,CAAAA,CAAW,KAAK,EAClB,CAHSR,IAAAa,CAAA,CAAA,uBAAA,CAAA,CAKT,SAASC,CAAoBL,CAAAA,CAAAA,CAAoB,CAC/CC,CAAS,CAAA,CAAA,oBAAA,EAAuBD,EAAM,OAAO,CAAA,CAAE,EAC/CD,CAAW,CAAA,KAAK,EAClB,CAHSR,GAAAA,CAAAc,EAAA,qBAKT,CA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ACZ,EACF,CACF,CAAA,CAAA,CAAA,CACF,CAEJ,CA7ImD,CAAA,WAAA","file":"PdfDriver-KPSPVZ55.mjs","sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { Document, Page, pdfjs } from 'react-pdf';\nimport 'react-pdf/dist/Page/AnnotationLayer.css';\nimport 'react-pdf/dist/Page/TextLayer.css';\nimport { Button } from '../../../Core';\n\nconst BASE_DIR = '/pdfjs';\n\n// Set up the worker - self-hosted configuration (client-side only)\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n pdfjs.GlobalWorkerOptions.workerSrc = `${BASE_DIR}/pdf.worker.min.js`;\n}\n\ninterface PdfDriverProps {\n url: string;\n}\n\nexport const PdfDriver: React.FC<PdfDriverProps> = ({ url }) => {\n const [numPages, setNumPages] = useState<number>(0);\n const [pageNumber, setPageNumber] = useState<number>(1);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<string | null>(null);\n\n const options = useMemo(\n () => ({\n cMapPacked: true,\n cMapUrl: `${BASE_DIR}/cmaps/`,\n standardFontDataUrl: `${BASE_DIR}/standard_fonts/`,\n wasmUrl: `${BASE_DIR}/wasm/`,\n iccUrl: `${BASE_DIR}/icc/`,\n }),\n []\n );\n\n //TODO: add fix 100px problem;\n\n function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {\n setNumPages(numPages);\n setLoading(false);\n }\n\n function onDocumentLoadError(error: Error): void {\n setError(`Failed to load PDF: ${error.message}`);\n setLoading(false);\n }\n\n function changePage(offset: number): void {\n setPageNumber((prevPageNumber) => prevPageNumber + offset);\n }\n\n function previousPage(): void {\n changePage(-1);\n }\n\n function nextPage(): void {\n changePage(1);\n }\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div className=\"text-red-500 text-center\">\n <p>{error}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"h-full w-full flex flex-col\">\n {loading && (\n <div className=\"flex items-center justify-center h-full\">\n <div className=\"text-gray-500\">Loading PDF...</div>\n </div>\n )}\n {numPages > 0 && (\n <div className=\"flex items-center justify-center gap-4 p-4\">\n <Button\n variant=\"outlined\"\n aria-label=\"previous page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber <= 1}\n onClick={previousPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n }\n />\n\n <span className=\"flex items-center gap-2\">\n <input\n type=\"number\"\n min={1}\n max={numPages}\n value={pageNumber}\n onChange={(e) => {\n const page = parseInt(e.target.value, 10);\n if (page >= 1 && page <= numPages) {\n setPageNumber(page);\n }\n }}\n className=\"w-16 px-2 py-1 border rounded text-center\"\n />\n / {numPages}\n </span>\n <Button\n variant=\"outlined\"\n aria-label=\"next page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber >= numPages}\n onClick={nextPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n />\n </div>\n )}\n <div className=\"flex-1 flex justify-center overflow-auto\">\n <Document\n options={options}\n file={url}\n onLoadSuccess={onDocumentLoadSuccess}\n onLoadError={onDocumentLoadError}\n loading=\"\"\n >\n <Page\n pageNumber={pageNumber}\n renderTextLayer={true}\n renderAnnotationLayer={true}\n className=\"max-w-full max-h-full\"\n />\n </Document>\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"sources":["../src/FileViewer/drivers/PdfDriver/PdfDriver.tsx"],"names":["BASE_DIR","pdfjs","PdfDriver","__name","url","numPages","setNumPages","useState","pageNumber","setPageNumber","loading","setLoading","error","setError","options","useMemo","onDocumentLoadSuccess","onDocumentLoadError","changePage","offset","prevPageNumber","previousPage","nextPage","jsx","jsxs","Button","e","page","Document","Page"],"mappings":"kQAMA,IAAMA,CAAAA,CAAW,SAGb,OAAO,MAAA,CAAW,KAAe,OAAO,QAAA,CAAa,MACvDC,KAAM,CAAA,mBAAA,CAAoB,UAAY,CAAGD,EAAAA,CAAQ,sBAOtCE,IAAAA,CAAAA,CAAsCC,IAAA,CAAC,CAAE,IAAAC,CAAI,CAAA,GAAM,CAC9D,GAAM,CAACC,CAAUC,CAAAA,CAAW,EAAIC,QAAiB,CAAA,CAAC,EAC5C,CAACC,CAAAA,CAAYC,CAAa,CAAIF,CAAAA,QAAAA,CAAiB,CAAC,CAChD,CAAA,CAACG,EAASC,CAAU,CAAA,CAAIJ,SAAkB,IAAI,CAAA,CAC9C,CAACK,CAAOC,CAAAA,CAAQ,EAAIN,QAAwB,CAAA,IAAI,EAEhDO,CAAUC,CAAAA,OAAAA,CACd,KAAO,CACL,UAAA,CAAY,KACZ,OAAS,CAAA,CAAA,EAAGf,CAAQ,CACpB,OAAA,CAAA,CAAA,mBAAA,CAAqB,GAAGA,CAAQ,CAAA,gBAAA,CAAA,CAChC,QAAS,CAAGA,EAAAA,CAAQ,CACpB,MAAA,CAAA,CAAA,MAAA,CAAQ,GAAGA,CAAQ,CAAA,KAAA,CACrB,GACA,EACF,EAIA,SAASgB,CAAAA,CAAsB,CAAE,QAAAX,CAAAA,CAAS,EAA+B,CACvEC,CAAAA,CAAYD,CAAQ,CACpBM,CAAAA,CAAAA,CAAW,KAAK,EAClB,CAHSR,IAAAa,CAAA,CAAA,uBAAA,CAAA,CAKT,SAASC,CAAoBL,CAAAA,CAAAA,CAAoB,CAC/CC,CAAS,CAAA,CAAA,oBAAA,EAAuBD,EAAM,OAAO,CAAA,CAAE,EAC/CD,CAAW,CAAA,KAAK,EAClB,CAHSR,GAAAA,CAAAc,EAAA,qBAKT,CAAA,CAAA,SAASC,EAA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,CAAA,CAAA,CACF,CAEJ,CA7ImD,CAAA,WAAA","file":"PdfDriver-K3H4CWAS.mjs","sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { Document, Page, pdfjs } from 'react-pdf';\nimport 'react-pdf/dist/Page/AnnotationLayer.css';\nimport 'react-pdf/dist/Page/TextLayer.css';\nimport { Button } from '../../../Core';\n\nconst BASE_DIR = '/pdfjs';\n\n// Set up the worker - self-hosted configuration (client-side only)\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n pdfjs.GlobalWorkerOptions.workerSrc = `${BASE_DIR}/pdf.worker.min.js`;\n}\n\ninterface PdfDriverProps {\n url: string;\n}\n\nexport const PdfDriver: React.FC<PdfDriverProps> = ({ url }) => {\n const [numPages, setNumPages] = useState<number>(0);\n const [pageNumber, setPageNumber] = useState<number>(1);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<string | null>(null);\n\n const options = useMemo(\n () => ({\n cMapPacked: true,\n cMapUrl: `${BASE_DIR}/cmaps/`,\n standardFontDataUrl: `${BASE_DIR}/standard_fonts/`,\n wasmUrl: `${BASE_DIR}/wasm/`,\n iccUrl: `${BASE_DIR}/icc/`,\n }),\n []\n );\n\n //TODO: add fix 100px problem;\n\n function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {\n setNumPages(numPages);\n setLoading(false);\n }\n\n function onDocumentLoadError(error: Error): void {\n setError(`Failed to load PDF: ${error.message}`);\n setLoading(false);\n }\n\n function changePage(offset: number): void {\n setPageNumber((prevPageNumber) => prevPageNumber + offset);\n }\n\n function previousPage(): void {\n changePage(-1);\n }\n\n function nextPage(): void {\n changePage(1);\n }\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div className=\"text-red-500 text-center\">\n <p>{error}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"h-full w-full flex flex-col\">\n {loading && (\n <div className=\"flex items-center justify-center h-full\">\n <div className=\"text-gray-500\">Loading PDF...</div>\n </div>\n )}\n {numPages > 0 && (\n <div className=\"flex items-center justify-center gap-4 p-4\">\n <Button\n variant=\"outlined\"\n aria-label=\"previous page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber <= 1}\n onClick={previousPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n }\n />\n\n <span className=\"flex items-center gap-2\">\n <input\n type=\"number\"\n min={1}\n max={numPages}\n value={pageNumber}\n onChange={(e) => {\n const page = parseInt(e.target.value, 10);\n if (page >= 1 && page <= numPages) {\n setPageNumber(page);\n }\n }}\n className=\"w-16 px-2 py-1 border rounded text-center\"\n />\n / {numPages}\n </span>\n <Button\n variant=\"outlined\"\n aria-label=\"next page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber >= numPages}\n onClick={nextPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n />\n </div>\n )}\n <div className=\"flex-1 flex justify-center overflow-auto\">\n <Document\n options={options}\n file={url}\n onLoadSuccess={onDocumentLoadSuccess}\n onLoadError={onDocumentLoadError}\n loading=\"\"\n >\n <Page\n pageNumber={pageNumber}\n renderTextLayer={true}\n renderAnnotationLayer={true}\n className=\"max-w-full max-h-full\"\n />\n </Document>\n </div>\n </div>\n );\n};\n"]}
@@ -1,3 +1,3 @@
1
- 'use strict';var chunk7Y3OMGZF_js=require('./chunk-7Y3OMGZF.js'),react=require('react'),reactPdf=require('react-pdf');require('react-pdf/dist/Page/AnnotationLayer.css'),require('react-pdf/dist/Page/TextLayer.css');var jsxRuntime=require('react/jsx-runtime');var a="/pdfjs";typeof window<"u"&&typeof document<"u"&&(reactPdf.pdfjs.GlobalWorkerOptions.workerSrc=`${a}/pdf.worker.min.js`);var U=chunk7Y3OMGZF_js.a(({url:p})=>{let[t,v]=react.useState(0),[s,c]=react.useState(1),[g,u]=react.useState(true),[m,x]=react.useState(null),w=react.useMemo(()=>({cMapPacked:true,cMapUrl:`${a}/cmaps/`,standardFontDataUrl:`${a}/standard_fonts/`,wasmUrl:`${a}/wasm/`,iccUrl:`${a}/icc/`}),[]);function b({numPages:o}){v(o),u(false);}chunk7Y3OMGZF_js.a(b,"onDocumentLoadSuccess");function P(o){x(`Failed to load PDF: ${o.message}`),u(false);}chunk7Y3OMGZF_js.a(P,"onDocumentLoadError");function f(o){c(n=>n+o);}chunk7Y3OMGZF_js.a(f,"changePage");function y(){f(-1);}chunk7Y3OMGZF_js.a(y,"previousPage");function k(){f(1);}return chunk7Y3OMGZF_js.a(k,"nextPage"),m?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-red-500 text-center",children:jsxRuntime.jsx("p",{children:m})})}):jsxRuntime.jsxs("div",{className:"h-full w-full flex flex-col",children:[g&&jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF..."})}),t>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-4 p-4",children:[jsxRuntime.jsx(chunk7Y3OMGZF_js.z,{variant:"outlined","aria-label":"previous page",color:"secondary",size:"small",type:"button",disabled:s<=1,onClick:y,icon:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m15 18-6-6 6-6"})})}),jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"number",min:1,max:t,value:s,onChange:o=>{let n=parseInt(o.target.value,10);n>=1&&n<=t&&c(n);},className:"w-16 px-2 py-1 border rounded text-center"}),"/ ",t]}),jsxRuntime.jsx(chunk7Y3OMGZF_js.z,{variant:"outlined","aria-label":"next page",color:"secondary",size:"small",type:"button",disabled:s>=t,onClick:k,icon:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m9 18 6-6-6-6"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 flex justify-center overflow-auto",children:jsxRuntime.jsx(reactPdf.Document,{options:w,file:p,onLoadSuccess:b,onLoadError:P,loading:"",children:jsxRuntime.jsx(reactPdf.Page,{pageNumber:s,renderTextLayer:true,renderAnnotationLayer:true,className:"max-w-full max-h-full"})})})]})},"PdfDriver");
2
- exports.PdfDriver=U;//# sourceMappingURL=PdfDriver-GVWMG5RF.js.map
3
- //# sourceMappingURL=PdfDriver-GVWMG5RF.js.map
1
+ 'use strict';var chunkAW5ROOZX_js=require('./chunk-AW5ROOZX.js'),react=require('react'),reactPdf=require('react-pdf');require('react-pdf/dist/Page/AnnotationLayer.css'),require('react-pdf/dist/Page/TextLayer.css');var jsxRuntime=require('react/jsx-runtime');var a="/pdfjs";typeof window<"u"&&typeof document<"u"&&(reactPdf.pdfjs.GlobalWorkerOptions.workerSrc=`${a}/pdf.worker.min.js`);var U=chunkAW5ROOZX_js.a(({url:p})=>{let[t,v]=react.useState(0),[s,c]=react.useState(1),[g,u]=react.useState(true),[m,x]=react.useState(null),w=react.useMemo(()=>({cMapPacked:true,cMapUrl:`${a}/cmaps/`,standardFontDataUrl:`${a}/standard_fonts/`,wasmUrl:`${a}/wasm/`,iccUrl:`${a}/icc/`}),[]);function b({numPages:o}){v(o),u(false);}chunkAW5ROOZX_js.a(b,"onDocumentLoadSuccess");function P(o){x(`Failed to load PDF: ${o.message}`),u(false);}chunkAW5ROOZX_js.a(P,"onDocumentLoadError");function f(o){c(n=>n+o);}chunkAW5ROOZX_js.a(f,"changePage");function y(){f(-1);}chunkAW5ROOZX_js.a(y,"previousPage");function k(){f(1);}return chunkAW5ROOZX_js.a(k,"nextPage"),m?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxRuntime.jsx("div",{className:"text-red-500 text-center",children:jsxRuntime.jsx("p",{children:m})})}):jsxRuntime.jsxs("div",{className:"h-full w-full flex flex-col",children:[g&&jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full",children:jsxRuntime.jsx("div",{className:"text-gray-500",children:"Loading PDF..."})}),t>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-4 p-4",children:[jsxRuntime.jsx(chunkAW5ROOZX_js.z,{variant:"outlined","aria-label":"previous page",color:"secondary",size:"small",type:"button",disabled:s<=1,onClick:y,icon:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m15 18-6-6 6-6"})})}),jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("input",{type:"number",min:1,max:t,value:s,onChange:o=>{let n=parseInt(o.target.value,10);n>=1&&n<=t&&c(n);},className:"w-16 px-2 py-1 border rounded text-center"}),"/ ",t]}),jsxRuntime.jsx(chunkAW5ROOZX_js.z,{variant:"outlined","aria-label":"next page",color:"secondary",size:"small",type:"button",disabled:s>=t,onClick:k,icon:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m9 18 6-6-6-6"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 flex justify-center overflow-auto",children:jsxRuntime.jsx(reactPdf.Document,{options:w,file:p,onLoadSuccess:b,onLoadError:P,loading:"",children:jsxRuntime.jsx(reactPdf.Page,{pageNumber:s,renderTextLayer:true,renderAnnotationLayer:true,className:"max-w-full max-h-full"})})})]})},"PdfDriver");
2
+ exports.PdfDriver=U;//# sourceMappingURL=PdfDriver-NBKPFG3W.js.map
3
+ //# sourceMappingURL=PdfDriver-NBKPFG3W.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/FileViewer/drivers/PdfDriver/PdfDriver.tsx"],"names":["BASE_DIR","pdfjs","PdfDriver","__name","url","numPages","setNumPages","useState","pageNumber","setPageNumber","loading","setLoading","error","setError","options","useMemo","onDocumentLoadSuccess","onDocumentLoadError","changePage","offset","prevPageNumber","previousPage","nextPage","jsx","jsxs","Button","e","page","Document","Page"],"mappings":"kQAMA,IAAMA,CAAAA,CAAW,SAGb,OAAO,MAAA,CAAW,KAAe,OAAO,QAAA,CAAa,MACvDC,cAAM,CAAA,mBAAA,CAAoB,UAAY,CAAGD,EAAAA,CAAQ,sBAOtCE,IAAAA,CAAAA,CAAsCC,mBAAA,CAAC,CAAE,IAAAC,CAAI,CAAA,GAAM,CAC9D,GAAM,CAACC,CAAUC,CAAAA,CAAW,EAAIC,cAAiB,CAAA,CAAC,EAC5C,CAACC,CAAAA,CAAYC,CAAa,CAAIF,CAAAA,cAAAA,CAAiB,CAAC,CAChD,CAAA,CAACG,EAASC,CAAU,CAAA,CAAIJ,eAAkB,IAAI,CAAA,CAC9C,CAACK,CAAOC,CAAAA,CAAQ,EAAIN,cAAwB,CAAA,IAAI,EAEhDO,CAAUC,CAAAA,aAAAA,CACd,KAAO,CACL,UAAA,CAAY,KACZ,OAAS,CAAA,CAAA,EAAGf,CAAQ,CACpB,OAAA,CAAA,CAAA,mBAAA,CAAqB,GAAGA,CAAQ,CAAA,gBAAA,CAAA,CAChC,QAAS,CAAGA,EAAAA,CAAQ,CACpB,MAAA,CAAA,CAAA,MAAA,CAAQ,GAAGA,C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,CAAK,EAAE,eAAgB,CAAA,CAAA,CAC1B,EAEJ,CACF,CAAA,CAAA,CAAA,CAEFA,eAAC,KAAI,CAAA,CAAA,SAAA,CAAU,2CACb,QAAAA,CAAAA,cAAAA,CAACK,kBAAA,CACC,OAAA,CAASd,EACT,IAAMV,CAAAA,CAAAA,CACN,cAAeY,CACf,CAAA,WAAA,CAAaC,EACb,OAAQ,CAAA,EAAA,CAER,SAAAM,cAACM,CAAAA,aAAAA,CAAA,CACC,UAAYrB,CAAAA,CAAAA,CACZ,gBAAiB,IACjB,CAAA,qBAAA,CAAuB,KACvB,SAAU,CAAA,uBAAA,CACZ,EACF,CACF,CAAA,CAAA,CAAA,CACF,CAEJ,CA7ImD,CAAA,WAAA","file":"PdfDriver-GVWMG5RF.js","sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { Document, Page, pdfjs } from 'react-pdf';\nimport 'react-pdf/dist/Page/AnnotationLayer.css';\nimport 'react-pdf/dist/Page/TextLayer.css';\nimport { Button } from '../../../Core';\n\nconst BASE_DIR = '/pdfjs';\n\n// Set up the worker - self-hosted configuration (client-side only)\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n pdfjs.GlobalWorkerOptions.workerSrc = `${BASE_DIR}/pdf.worker.min.js`;\n}\n\ninterface PdfDriverProps {\n url: string;\n}\n\nexport const PdfDriver: React.FC<PdfDriverProps> = ({ url }) => {\n const [numPages, setNumPages] = useState<number>(0);\n const [pageNumber, setPageNumber] = useState<number>(1);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<string | null>(null);\n\n const options = useMemo(\n () => ({\n cMapPacked: true,\n cMapUrl: `${BASE_DIR}/cmaps/`,\n standardFontDataUrl: `${BASE_DIR}/standard_fonts/`,\n wasmUrl: `${BASE_DIR}/wasm/`,\n iccUrl: `${BASE_DIR}/icc/`,\n }),\n []\n );\n\n //TODO: add fix 100px problem;\n\n function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {\n setNumPages(numPages);\n setLoading(false);\n }\n\n function onDocumentLoadError(error: Error): void {\n setError(`Failed to load PDF: ${error.message}`);\n setLoading(false);\n }\n\n function changePage(offset: number): void {\n setPageNumber((prevPageNumber) => prevPageNumber + offset);\n }\n\n function previousPage(): void {\n changePage(-1);\n }\n\n function nextPage(): void {\n changePage(1);\n }\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div className=\"text-red-500 text-center\">\n <p>{error}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"h-full w-full flex flex-col\">\n {loading && (\n <div className=\"flex items-center justify-center h-full\">\n <div className=\"text-gray-500\">Loading PDF...</div>\n </div>\n )}\n {numPages > 0 && (\n <div className=\"flex items-center justify-center gap-4 p-4\">\n <Button\n variant=\"outlined\"\n aria-label=\"previous page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber <= 1}\n onClick={previousPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n }\n />\n\n <span className=\"flex items-center gap-2\">\n <input\n type=\"number\"\n min={1}\n max={numPages}\n value={pageNumber}\n onChange={(e) => {\n const page = parseInt(e.target.value, 10);\n if (page >= 1 && page <= numPages) {\n setPageNumber(page);\n }\n }}\n className=\"w-16 px-2 py-1 border rounded text-center\"\n />\n / {numPages}\n </span>\n <Button\n variant=\"outlined\"\n aria-label=\"next page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber >= numPages}\n onClick={nextPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n />\n </div>\n )}\n <div className=\"flex-1 flex justify-center overflow-auto\">\n <Document\n options={options}\n file={url}\n onLoadSuccess={onDocumentLoadSuccess}\n onLoadError={onDocumentLoadError}\n loading=\"\"\n >\n <Page\n pageNumber={pageNumber}\n renderTextLayer={true}\n renderAnnotationLayer={true}\n className=\"max-w-full max-h-full\"\n />\n </Document>\n </div>\n </div>\n );\n};\n"]}
1
+ {"version":3,"sources":["../src/FileViewer/drivers/PdfDriver/PdfDriver.tsx"],"names":["BASE_DIR","pdfjs","PdfDriver","__name","url","numPages","setNumPages","useState","pageNumber","setPageNumber","loading","setLoading","error","setError","options","useMemo","onDocumentLoadSuccess","onDocumentLoadError","changePage","offset","prevPageNumber","previousPage","nextPage","jsx","jsxs","Button","e","page","Document","Page"],"mappings":"kQAMA,IAAMA,CAAAA,CAAW,SAGb,OAAO,MAAA,CAAW,KAAe,OAAO,QAAA,CAAa,MACvDC,cAAM,CAAA,mBAAA,CAAoB,UAAY,CAAGD,EAAAA,CAAQ,sBAOtCE,IAAAA,CAAAA,CAAsCC,mBAAA,CAAC,CAAE,IAAAC,CAAI,CAAA,GAAM,CAC9D,GAAM,CAACC,CAAUC,CAAAA,CAAW,EAAIC,cAAiB,CAAA,CAAC,EAC5C,CAACC,CAAAA,CAAYC,CAAa,CAAIF,CAAAA,cAAAA,CAAiB,CAAC,CAChD,CAAA,CAACG,EAASC,CAAU,CAAA,CAAIJ,eAAkB,IAAI,CAAA,CAC9C,CAACK,CAAOC,CAAAA,CAAQ,EAAIN,cAAwB,CAAA,IAAI,EAEhDO,CAAUC,CAAAA,aAAAA,CACd,KAAO,CACL,UAAA,CAAY,KACZ,OAAS,CAAA,CAAA,EAAGf,CAAQ,CACpB,OAAA,CAAA,CAAA,mBAAA,CAAqB,GAAGA,CAAQ,CAAA,gBAAA,CAAA,CAChC,QAAS,CAAGA,EAAAA,CAAQ,CACpB,MAAA,CAAA,CAAA,MAAA,CAAQ,GAAGA,CAAQ,CAAA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E,eAAgB,CAAA,CAAA,CAC1B,EAEJ,CACF,CAAA,CAAA,CAAA,CAEFA,eAAC,KAAI,CAAA,CAAA,SAAA,CAAU,2CACb,QAAAA,CAAAA,cAAAA,CAACK,kBAAA,CACC,OAAA,CAASd,EACT,IAAMV,CAAAA,CAAAA,CACN,cAAeY,CACf,CAAA,WAAA,CAAaC,EACb,OAAQ,CAAA,EAAA,CAER,SAAAM,cAACM,CAAAA,aAAAA,CAAA,CACC,UAAYrB,CAAAA,CAAAA,CACZ,gBAAiB,IACjB,CAAA,qBAAA,CAAuB,KACvB,SAAU,CAAA,uBAAA,CACZ,EACF,CACF,CAAA,CAAA,CAAA,CACF,CAEJ,CA7ImD,CAAA,WAAA","file":"PdfDriver-NBKPFG3W.js","sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { Document, Page, pdfjs } from 'react-pdf';\nimport 'react-pdf/dist/Page/AnnotationLayer.css';\nimport 'react-pdf/dist/Page/TextLayer.css';\nimport { Button } from '../../../Core';\n\nconst BASE_DIR = '/pdfjs';\n\n// Set up the worker - self-hosted configuration (client-side only)\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n pdfjs.GlobalWorkerOptions.workerSrc = `${BASE_DIR}/pdf.worker.min.js`;\n}\n\ninterface PdfDriverProps {\n url: string;\n}\n\nexport const PdfDriver: React.FC<PdfDriverProps> = ({ url }) => {\n const [numPages, setNumPages] = useState<number>(0);\n const [pageNumber, setPageNumber] = useState<number>(1);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<string | null>(null);\n\n const options = useMemo(\n () => ({\n cMapPacked: true,\n cMapUrl: `${BASE_DIR}/cmaps/`,\n standardFontDataUrl: `${BASE_DIR}/standard_fonts/`,\n wasmUrl: `${BASE_DIR}/wasm/`,\n iccUrl: `${BASE_DIR}/icc/`,\n }),\n []\n );\n\n //TODO: add fix 100px problem;\n\n function onDocumentLoadSuccess({ numPages }: { numPages: number }): void {\n setNumPages(numPages);\n setLoading(false);\n }\n\n function onDocumentLoadError(error: Error): void {\n setError(`Failed to load PDF: ${error.message}`);\n setLoading(false);\n }\n\n function changePage(offset: number): void {\n setPageNumber((prevPageNumber) => prevPageNumber + offset);\n }\n\n function previousPage(): void {\n changePage(-1);\n }\n\n function nextPage(): void {\n changePage(1);\n }\n\n if (error) {\n return (\n <div className=\"flex items-center justify-center h-full w-full\">\n <div className=\"text-red-500 text-center\">\n <p>{error}</p>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"h-full w-full flex flex-col\">\n {loading && (\n <div className=\"flex items-center justify-center h-full\">\n <div className=\"text-gray-500\">Loading PDF...</div>\n </div>\n )}\n {numPages > 0 && (\n <div className=\"flex items-center justify-center gap-4 p-4\">\n <Button\n variant=\"outlined\"\n aria-label=\"previous page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber <= 1}\n onClick={previousPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m15 18-6-6 6-6\" />\n </svg>\n }\n />\n\n <span className=\"flex items-center gap-2\">\n <input\n type=\"number\"\n min={1}\n max={numPages}\n value={pageNumber}\n onChange={(e) => {\n const page = parseInt(e.target.value, 10);\n if (page >= 1 && page <= numPages) {\n setPageNumber(page);\n }\n }}\n className=\"w-16 px-2 py-1 border rounded text-center\"\n />\n / {numPages}\n </span>\n <Button\n variant=\"outlined\"\n aria-label=\"next page\"\n color=\"secondary\"\n size=\"small\"\n type=\"button\"\n disabled={pageNumber >= numPages}\n onClick={nextPage}\n icon={\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n }\n />\n </div>\n )}\n <div className=\"flex-1 flex justify-center overflow-auto\">\n <Document\n options={options}\n file={url}\n onLoadSuccess={onDocumentLoadSuccess}\n onLoadError={onDocumentLoadError}\n loading=\"\"\n >\n <Page\n pageNumber={pageNumber}\n renderTextLayer={true}\n renderAnnotationLayer={true}\n className=\"max-w-full max-h-full\"\n />\n </Document>\n </div>\n </div>\n );\n};\n"]}
@@ -127,6 +127,9 @@
127
127
  border-right: 1px solid;
128
128
  border-color: ${e?"transparent":o.sidebar.border};
129
129
  background: ${o.sidebar.background};
130
+ @media (min-width: ${o.breakpoints.m}px) {
131
+ position: ${r==="collapse"?"sticky":"fixed"};
132
+ }
130
133
  @media (min-width: ${o.breakpoints.xl}px) {
131
134
  position: sticky;
132
135
  height: 100%;
@@ -154,7 +157,7 @@
154
157
  width: ${e?g(o.sidebar.collapsedWidth,o.baseSize):o.sidebar.width};
155
158
  }
156
159
  }
157
- `);var ja=t(({active:o,icon:e,label:r,component:i,height:C=40,...s})=>{let{collapsed:l}=H4.useContext(X),d="href"in s;return jsxRuntime.jsxs(D3,{title:l?r:"",as:i||(d?"a":"button"),$collapsed:l,$active:o,$height:C,...s,children:[e,!!r&&!l&&jsxRuntime.jsx(A3,{children:r})]})},"SidebarItem"),A3=Q__default.default.span`
160
+ `);var ja=t(({active:o,icon:e,label:r,component:i,title:C,height:s=40,...l})=>{let{collapsed:d}=H4.useContext(X),p="href"in l;return jsxRuntime.jsxs(D3,{title:d?r:C,as:i||(p?"a":"button"),$collapsed:d,$active:o,$height:s,...l,children:[e,!!r&&!d&&jsxRuntime.jsx(A3,{children:r})]})},"SidebarItem"),A3=Q__default.default.span`
158
161
  margin-top: 2px;
159
162
  overflow: hidden;
160
163
  white-space: nowrap;
@@ -1320,5 +1323,5 @@
1320
1323
  }
1321
1324
  }
1322
1325
  animation: move 1.5s linear infinite;
1323
- `;exports.$=H6;exports.$a=os;exports.A=n2;exports.Aa=p3;exports.Ab=d4;exports.B=T4;exports.Ba=g3;exports.Bb=_c;exports.C=G4;exports.Ca=u3;exports.Cb=Uc;exports.D=R4;exports.Da=f3;exports.Db=Xc;exports.E=D4;exports.Ea=m3;exports.Eb=Yc;exports.F=N4;exports.Fa=w3;exports.Fb=k8;exports.G=i2;exports.Ga=v3;exports.Gb=hg;exports.H=a2;exports.Ha=y3;exports.Hb=vg;exports.I=U4;exports.Ia=L3;exports.J=Y4;exports.Ja=H3;exports.K=J4;exports.Ka=F3;exports.L=Q4;exports.La=P3;exports.M=j4;exports.Ma=V2;exports.N=e6;exports.Na=E3;exports.O=r6;exports.Oa=I3;exports.P=i6;exports.Pa=B3;exports.Q=C6;exports.Qa=L2;exports.R=d6;exports.Ra=X;exports.S=l6;exports.Sa=_a;exports.T=c6;exports.Ta=ja;exports.U=g6;exports.Ua=CC;exports.V=u6;exports.Va=bC;exports.W=f6;exports.Wa=T5;exports.X=x6;exports.Xa=PC;exports.Y=S6;exports.Ya=TC;exports.Z=v6;exports.Za=NC;exports._=V6;exports._a=qC;exports.a=t;exports.aa=M6;exports.ab=as;exports.b=h1;exports.ba=k6;exports.bb=ys;exports.c=g;exports.ca=$6;exports.cb=Es;exports.d=U2;exports.da=E6;exports.db=_5;exports.e=Z;exports.ea=Z6;exports.eb=Js;exports.f=e1;exports.fa=T6;exports.fb=U5;exports.g=B;exports.ga=G6;exports.gb=gd;exports.h=G;exports.ha=A6;exports.hb=Ed;exports.i=B8;exports.ia=h2;exports.ib=K5;exports.j=T8;exports.ja=N6;exports.jb=Cl;exports.k=z8;exports.ka=f2;exports.kb=V7;exports.l=f1;exports.la=x2;exports.lb=F7;exports.m=X2;exports.ma=O6;exports.mb=Bl;exports.n=Y2;exports.na=_6;exports.nb=Ol;exports.o=q2;exports.oa=s1;exports.ob=Yl;exports.p=J2;exports.pa=X6;exports.pb=ip;exports.q=j2;exports.qa=d1;exports.qb=bp;exports.r=o5;exports.ra=q6;exports.rb=vp;exports.s=f9;exports.sa=K6;exports.sb=Fp;exports.t=S1;exports.ta=j6;exports.tb=Bp;exports.u=h;exports.ua=o3;exports.ub=Op;exports.v=P4;exports.va=t3;exports.vb=ic;exports.w=f;exports.wa=n3;exports.wb=ac;exports.x=S;exports.xa=a3;exports.xb=Cc;exports.y=E9;exports.ya=C3;exports.yb=xc;exports.z=y1;exports.za=d3;exports.zb=Lc;//# sourceMappingURL=chunk-7Y3OMGZF.js.map
1324
- //# sourceMappingURL=chunk-7Y3OMGZF.js.map
1326
+ `;exports.$=H6;exports.$a=os;exports.A=n2;exports.Aa=p3;exports.Ab=d4;exports.B=T4;exports.Ba=g3;exports.Bb=_c;exports.C=G4;exports.Ca=u3;exports.Cb=Uc;exports.D=R4;exports.Da=f3;exports.Db=Xc;exports.E=D4;exports.Ea=m3;exports.Eb=Yc;exports.F=N4;exports.Fa=w3;exports.Fb=k8;exports.G=i2;exports.Ga=v3;exports.Gb=hg;exports.H=a2;exports.Ha=y3;exports.Hb=vg;exports.I=U4;exports.Ia=L3;exports.J=Y4;exports.Ja=H3;exports.K=J4;exports.Ka=F3;exports.L=Q4;exports.La=P3;exports.M=j4;exports.Ma=V2;exports.N=e6;exports.Na=E3;exports.O=r6;exports.Oa=I3;exports.P=i6;exports.Pa=B3;exports.Q=C6;exports.Qa=L2;exports.R=d6;exports.Ra=X;exports.S=l6;exports.Sa=_a;exports.T=c6;exports.Ta=ja;exports.U=g6;exports.Ua=CC;exports.V=u6;exports.Va=bC;exports.W=f6;exports.Wa=T5;exports.X=x6;exports.Xa=PC;exports.Y=S6;exports.Ya=TC;exports.Z=v6;exports.Za=NC;exports._=V6;exports._a=qC;exports.a=t;exports.aa=M6;exports.ab=as;exports.b=h1;exports.ba=k6;exports.bb=ys;exports.c=g;exports.ca=$6;exports.cb=Es;exports.d=U2;exports.da=E6;exports.db=_5;exports.e=Z;exports.ea=Z6;exports.eb=Js;exports.f=e1;exports.fa=T6;exports.fb=U5;exports.g=B;exports.ga=G6;exports.gb=gd;exports.h=G;exports.ha=A6;exports.hb=Ed;exports.i=B8;exports.ia=h2;exports.ib=K5;exports.j=T8;exports.ja=N6;exports.jb=Cl;exports.k=z8;exports.ka=f2;exports.kb=V7;exports.l=f1;exports.la=x2;exports.lb=F7;exports.m=X2;exports.ma=O6;exports.mb=Bl;exports.n=Y2;exports.na=_6;exports.nb=Ol;exports.o=q2;exports.oa=s1;exports.ob=Yl;exports.p=J2;exports.pa=X6;exports.pb=ip;exports.q=j2;exports.qa=d1;exports.qb=bp;exports.r=o5;exports.ra=q6;exports.rb=vp;exports.s=f9;exports.sa=K6;exports.sb=Fp;exports.t=S1;exports.ta=j6;exports.tb=Bp;exports.u=h;exports.ua=o3;exports.ub=Op;exports.v=P4;exports.va=t3;exports.vb=ic;exports.w=f;exports.wa=n3;exports.wb=ac;exports.x=S;exports.xa=a3;exports.xb=Cc;exports.y=E9;exports.ya=C3;exports.yb=xc;exports.z=y1;exports.za=d3;exports.zb=Lc;//# sourceMappingURL=chunk-AW5ROOZX.js.map
1327
+ //# sourceMappingURL=chunk-AW5ROOZX.js.map