@pdfslick/core 3.1.0 → 4.0.0

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,7 +1,7 @@
1
1
  import { type OnProgressParameters, PDFDocumentProxy, AbortException, ResponseException, InvalidPDFException, RenderingCancelledException } from "pdfjs-dist";
2
2
  import type { DocumentInitParameters } from "pdfjs-dist/types/src/display/api";
3
3
  import { EventBus, PDFViewer, PDFLinkService, DownloadManager, PDFFindController, PDFPageView } from "pdfjs-dist/web/pdf_viewer.mjs";
4
- import { IL10n } from "pdfjs-dist/types/web/pdf_viewer";
4
+ import { L10n } from "pdfjs-dist/types/web/pdf_viewer";
5
5
  import type { PDFSlickInputArgs, PDFSlickState, TEventBusName, TEventBusOptions, TEventBusListener } from "./types";
6
6
  import { PDFThumbnailViewer, PDFPresentationMode } from "./lib";
7
7
  import { StoreApi } from "zustand/vanilla";
@@ -19,7 +19,7 @@ export declare class PDFSlick {
19
19
  document: PDFDocumentProxy | null;
20
20
  store: StoreApi<PDFSlickState>;
21
21
  filename: string;
22
- l10n: IL10n;
22
+ l10n: L10n;
23
23
  singlePageViewer: boolean;
24
24
  removePageBorders: boolean;
25
25
  enablePrintAutoRotate: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"PDFSlick.d.ts","sourceRoot":"","sources":["../PDFSlick.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,oBAAoB,EAMzB,gBAAgB,EAEhB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,2BAA2B,EAE9B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EACH,QAAQ,EACR,SAAS,EACT,cAAc,EAEd,eAAe,EACf,iBAAiB,EACjB,WAAW,EAEd,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAoB,MAAM,iCAAiC,CAAC;AAC1E,OAAO,KAAK,E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KG;IACH,GAAG,CACC,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,CAAC,EAAE,gBAAgB;IAK9B;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM;CAGlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"PDFSlickPrintService.d.ts","sourceRoot":"","sources":["../PDFSlickPrintService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,qBAAa,oBAAoB;;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;gBAM7B,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,2BAA2B;IAQzE,IAAI,gBAAgB,YAEnB;IAED,IAAI,QAAQ,YAEX;IAEK,KAAK;IA2CX,KAAK;IA8DL,UAAU;IAwCV,YAAY;CAIf"}
1
+ {"version":3,"file":"PDFSlickPrintService.d.ts","sourceRoot":"","sources":["../PDFSlickPrintService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,KAAK,2BAA2B,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC7C,CAAA;AAED,qBAAa,oBAAoB;;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,QAAQ,CAAC;IAChB,WAAW,EAAE,oBAAoB,GAAG,IAAI,CAAC;gBAM7B,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,2BAA2B;IAQzE,IAAI,gBAAgB,YAEnB;IAED,IAAI,QAAQ,YAEX;IAEK,KAAK;IA2CX,KAAK;IAkEL,UAAU;IAwCV,YAAY;CAIf"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MathClamp, RenderingCancelledException, OutputScale, PixelsPerInch, getXfaPageViewport, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions, AnnotationEditorParamsType, getPdfFilenameFromUrl, getDocument, PDFDateString } from 'pdfjs-dist';
1
+ import { MathClamp, RenderingCancelledException, OutputScale, PixelsPerInch, XfaLayer, AnnotationMode, AnnotationEditorType, GlobalWorkerOptions, AnnotationEditorParamsType, getPdfFilenameFromUrl, getDocument, PDFDateString } from 'pdfjs-dist';
2
2
  import { SimpleLinkService, XfaLayerBuilder, GenericL10n, DownloadManager, EventBus, PDFLinkService, PDFFindController, PDFSinglePageViewer, PDFViewer } from 'pdfjs-dist/web/pdf_viewer.mjs';
3
3
  import { createStore } from 'zustand/vanilla';
4
4
 
@@ -779,7 +779,7 @@ const calcRound = (function () {
779
779
  * See the License for the specific language governing permissions and
780
780
  * limitations under the License.
781
781
  */
782
- /** @typedef {import("./interfaces").IRenderableView} IRenderableView */
782
+ /** @typedef {import("./interfaces").RenderableView} RenderableView */
783
783
  /** @typedef {import("./pdf_viewer").PDFViewer} PDFViewer */
784
784
  /** @typedef {import("./pdf_thumbnail_viewer").PDFThumbnailViewer} PDFThumbnailViewer */
785
785
  const CLEANUP_TIMEOUT = 30000;
@@ -815,7 +815,7 @@ class PDFRenderingQueue {
815
815
  this.pdfThumbnailViewer = pdfThumbnailViewer;
816
816
  }
817
817
  /**
818
- * @param {IRenderableView} view
818
+ * @param {RenderableView} view
819
819
  * @returns {boolean}
820
820
  */
821
821
  isHighestPriority(view) {
@@ -916,7 +916,7 @@ class PDFRenderingQueue {
916
916
  return null;
917
917
  }
918
918
  /**
919
- * @param {IRenderableView} view
919
+ * @param {RenderableView} view
920
920
  * @returns {boolean}
921
921
  */
922
922
  isViewFinished(view) {
@@ -927,7 +927,7 @@ class PDFRenderingQueue {
927
927
  * based on the views state. If the view is already rendered it will return
928
928
  * `false`.
929
929
  *
930
- * @param {IRenderableView} view
930
+ * @param {RenderableView} view
931
931
  */
932
932
  renderView(view) {
933
933
  switch (view.renderingState) {
@@ -1598,7 +1598,7 @@ function getXfaHtmlForPrinting(printContainer, pdfDocument) {
1598
1598
  linkService,
1599
1599
  xfaHtml: xfaPage,
1600
1600
  });
1601
- const viewport = getXfaPageViewport(xfaPage, { scale });
1601
+ const viewport = XfaLayer.getPageViewport(xfaPage, { scale });
1602
1602
  builder.render({ viewport, intent: "print" });
1603
1603
  page.append(builder.div);
1604
1604
  }
@@ -2238,8 +2238,8 @@ class PDFSlickPrintService {
2238
2238
  __classPrivateFieldSet(this, _PDFSlickPrintService_eventAbortController, new AbortController(), "f");
2239
2239
  const { signal } = __classPrivateFieldGet(this, _PDFSlickPrintService_eventAbortController, "f");
2240
2240
  const opts = { signal };
2241
- this.eventBus._on("beforeprint", __classPrivateFieldGet(this, _PDFSlickPrintService_instances, "m", _PDFSlickPrintService_beforePrint).bind(this), opts);
2242
- this.eventBus._on("afterprint", __classPrivateFieldGet(this, _PDFSlickPrintService_instances, "m", _PDFSlickPrintService_afterPrint).bind(this), opts);
2241
+ this.eventBus.on("beforeprint", __classPrivateFieldGet(this, _PDFSlickPrintService_instances, "m", _PDFSlickPrintService_beforePrint).bind(this), opts);
2242
+ this.eventBus.on("afterprint", __classPrivateFieldGet(this, _PDFSlickPrintService_instances, "m", _PDFSlickPrintService_afterPrint).bind(this), opts);
2243
2243
  window.addEventListener("beforeprint", () => this.eventBus.dispatch("beforeprint", { source: window }), opts);
2244
2244
  window.addEventListener("afterprint", () => this.eventBus.dispatch("afterprint", { source: window }), opts);
2245
2245
  window.addEventListener("keydown", (event) => {
@@ -2277,7 +2277,7 @@ _PDFSlickPrintService_printService = new WeakMap(), _PDFSlickPrintService_eventA
2277
2277
  // The beforePrint is a sync method and we need to know layout before
2278
2278
  // returning from this method. Ensure that we can get sizes of the pages.
2279
2279
  if (!this.slick.viewer.pageViewsReady) {
2280
- this.slick.l10n.get("printing_not_ready", null).then((msg) => {
2280
+ this.slick.l10n.get("printing_not_ready", null, "Warning: The PDF is not fully loaded for printing.").then((msg) => {
2281
2281
  // eslint-disable-next-line no-alert
2282
2282
  window.alert(msg);
2283
2283
  });
@@ -2527,7 +2527,7 @@ class PDFSlick {
2527
2527
  const findController = new PDFFindController({ eventBus, linkService });
2528
2528
  const viewerOptions = Object.assign(Object.assign({ container }, (viewer && { viewer })), { eventBus,
2529
2529
  linkService,
2530
- findController, renderingQueue: renderingQueue, textLayerMode: this.textLayerMode, annotationEditorHighlightColors: this.annotationEditorHighlightColors, l10n: this.l10n, annotationMode: __classPrivateFieldGet(this, _PDFSlick_annotationMode, "f"), annotationEditorMode: __classPrivateFieldGet(this, _PDFSlick_annotationEditorMode, "f"), removePageBorders: this.removePageBorders, imageResourcesPath: "/images/", enableHWA: this.enableHWA, enableDetailCanvas: this.enableDetailCanvas, enableOptimizedPartialRendering: this.enableOptimizedPartialRendering, minDurationToUpdateCanvas: this.minDurationToUpdateCanvas, maxCanvasPixels: this.useOnlyCssZoom === true ? 0 : this.maxCanvasPixels, maxCanvasDim: this.maxCanvasDim, capCanvasAreaFactor: this.capCanvasAreaFactor });
2530
+ findController, renderingQueue: renderingQueue, textLayerMode: this.textLayerMode, annotationEditorHighlightColors: this.annotationEditorHighlightColors, l10n: this.l10n, annotationMode: __classPrivateFieldGet(this, _PDFSlick_annotationMode, "f"), annotationEditorMode: __classPrivateFieldGet(this, _PDFSlick_annotationEditorMode, "f"), removePageBorders: this.removePageBorders, imageResourcesPath: "/images/", enableDetailCanvas: this.enableDetailCanvas, enableOptimizedPartialRendering: this.enableOptimizedPartialRendering, minDurationToUpdateCanvas: this.minDurationToUpdateCanvas, maxCanvasPixels: this.useOnlyCssZoom === true ? 0 : this.maxCanvasPixels, maxCanvasDim: this.maxCanvasDim, capCanvasAreaFactor: this.capCanvasAreaFactor });
2531
2531
  const pdfViewer = this.singlePageViewer
2532
2532
  ? new PDFSinglePageViewer(viewerOptions)
2533
2533
  : new PDFViewer(viewerOptions);
@@ -2578,7 +2578,9 @@ class PDFSlick {
2578
2578
  catch (err) { }
2579
2579
  }
2580
2580
  try {
2581
- (_a = this.document) === null || _a === void 0 ? void 0 : _a.destroy();
2581
+ // `PDFDocumentProxy.destroy()` was removed in pdfjs-dist v6; tear
2582
+ // down the previous document through its loading task instead.
2583
+ (_a = this.document) === null || _a === void 0 ? void 0 : _a.loadingTask.destroy();
2582
2584
  (_b = this.viewer) === null || _b === void 0 ? void 0 : _b.cleanup();
2583
2585
  if (url instanceof URL) {
2584
2586
  this.url = url.toString();
@@ -2591,7 +2593,7 @@ class PDFSlick {
2591
2593
  }
2592
2594
  const filename = (_c = options === null || options === void 0 ? void 0 : options.filename) !== null && _c !== void 0 ? _c : getPdfFilenameFromUrl((_d = this.url) === null || _d === void 0 ? void 0 : _d.toString());
2593
2595
  this.filename = filename;
2594
- const pdfDocumentLoader = getDocument(Object.assign(Object.assign({}, this.getDocumentParams), { url: this.url, isEvalSupported: false }));
2596
+ const pdfDocumentLoader = getDocument(Object.assign(Object.assign({}, this.getDocumentParams), { url: this.url, enableHWA: this.enableHWA }));
2595
2597
  if (!!(options === null || options === void 0 ? void 0 : options.onProgress)) {
2596
2598
  pdfDocumentLoader.onProgress = options.onProgress;
2597
2599
  }
@@ -2640,20 +2642,22 @@ class PDFSlick {
2640
2642
  }
2641
2643
  download() {
2642
2644
  return __awaiter(this, void 0, void 0, function* () {
2643
- var _a, _b;
2645
+ var _a;
2644
2646
  const url = this.url;
2645
2647
  const { filename } = this;
2648
+ let data;
2646
2649
  try {
2647
2650
  // this._ensureDownloadComplete();
2648
- const data = (yield this.document.getData()).slice(0);
2649
- const blob = new Blob([data], { type: "application/pdf" });
2650
- yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename));
2651
+ data = (yield this.document.getData()).slice(0);
2651
2652
  }
2652
- catch (reason) {
2653
+ catch (_b) {
2653
2654
  // When the PDF document isn't ready, or the PDF file is still
2654
2655
  // downloading, simply download using the URL.
2655
- yield ((_b = this.downloadManager) === null || _b === void 0 ? void 0 : _b.download(null, url, filename));
2656
2656
  }
2657
+ // As of pdfjs-dist v6, `download` takes the raw document data (a
2658
+ // `Uint8Array`) and builds the blob internally; a falsy `data` makes
2659
+ // it fall back to downloading directly from the URL.
2660
+ yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(data, url, filename));
2657
2661
  });
2658
2662
  }
2659
2663
  save() {
@@ -2667,8 +2671,7 @@ class PDFSlick {
2667
2671
  try {
2668
2672
  // this._ensureDownloadComplete();
2669
2673
  const data = (yield this.document.saveDocument()).slice(0);
2670
- const blob = new Blob([data], { type: "application/pdf" });
2671
- yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(blob, url, filename));
2674
+ yield ((_a = this.downloadManager) === null || _a === void 0 ? void 0 : _a.download(data, url, filename));
2672
2675
  }
2673
2676
  catch (reason) {
2674
2677
  // When the PDF document isn't ready, or the PDF file is still
@@ -2943,10 +2946,12 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
2943
2946
  }
2944
2947
  const [{ width, height }, unit, name, orientation] = yield Promise.all([
2945
2948
  sizeInches ,
2946
- this.l10n.get(`document_properties_page_size_unit_${"inches" }`, null),
2949
+ // pdfjs-dist v6 `L10n.get(ids, args, fallback)` requires a fallback
2950
+ // value, which is returned when the id isn't in the l10n bundle.
2951
+ this.l10n.get(`document_properties_page_size_unit_${"inches" }`, null, "in" ),
2947
2952
  rawName &&
2948
- this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}`, null),
2949
- this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}`, null),
2953
+ this.l10n.get(`document_properties_page_size_name_${rawName.toLowerCase()}`, null, rawName),
2954
+ this.l10n.get(`document_properties_page_size_orientation_${isPortrait ? "portrait" : "landscape"}`, null, isPortrait ? "portrait" : "landscape"),
2950
2955
  ]);
2951
2956
  return {
2952
2957
  width: width.toLocaleString(),
@@ -2960,13 +2965,13 @@ _PDFSlick_renderingQueue = new WeakMap(), _PDFSlick_container = new WeakMap(), _
2960
2965
  __classPrivateFieldSet(this, _PDFSlick_eventAbortController, new AbortController(), "f");
2961
2966
  const { signal } = __classPrivateFieldGet(this, _PDFSlick_eventAbortController, "f");
2962
2967
  const opts = { signal };
2963
- this.eventBus._on("pagesinit", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onDocumentReady).bind(this), opts);
2964
- this.eventBus._on("scalechanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onScaleChanging).bind(this), opts);
2965
- this.eventBus._on("pagechanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onPageChanging).bind(this), opts);
2966
- this.eventBus._on("pagerendered", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onPageRendered).bind(this), opts);
2967
- this.eventBus._on("rotationchanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onRotationChanging).bind(this), opts);
2968
- this.eventBus._on("switchspreadmode", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onSwitchSpreadMode).bind(this), opts);
2969
- this.eventBus._on("switchscrollmode", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onSwitchScrollMode).bind(this), opts);
2968
+ this.eventBus.on("pagesinit", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onDocumentReady).bind(this), opts);
2969
+ this.eventBus.on("scalechanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onScaleChanging).bind(this), opts);
2970
+ this.eventBus.on("pagechanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onPageChanging).bind(this), opts);
2971
+ this.eventBus.on("pagerendered", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onPageRendered).bind(this), opts);
2972
+ this.eventBus.on("rotationchanging", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onRotationChanging).bind(this), opts);
2973
+ this.eventBus.on("switchspreadmode", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onSwitchSpreadMode).bind(this), opts);
2974
+ this.eventBus.on("switchscrollmode", __classPrivateFieldGet(this, _PDFSlick_instances, "m", _PDFSlick_onSwitchScrollMode).bind(this), opts);
2970
2975
  }, _PDFSlick_onDocumentReady = function _PDFSlick_onDocumentReady(_a) {
2971
2976
  return __awaiter(this, arguments, void 0, function* ({ source }) {
2972
2977
  var _b;
@@ -1,4 +1,4 @@
1
- import { IRenderableView } from "pdfjs-dist/types/web/interfaces.js";
1
+ import { RenderableView } from "pdfjs-dist/types/web/renderable_view";
2
2
  import { PDFThumbnailViewer } from "./pdf_thumbnail_viewer";
3
3
  import { PDFViewer } from "pdfjs-dist/web/pdf_viewer.mjs";
4
4
  import { getVisibleElements } from "./ui_utils";
@@ -23,10 +23,10 @@ declare class PDFRenderingQueue {
23
23
  */
24
24
  setThumbnailViewer(pdfThumbnailViewer: PDFThumbnailViewer): void;
25
25
  /**
26
- * @param {IRenderableView} view
26
+ * @param {RenderableView} view
27
27
  * @returns {boolean}
28
28
  */
29
- isHighestPriority(view: IRenderableView): boolean;
29
+ isHighestPriority(view: RenderableView): boolean;
30
30
  /**
31
31
  * @param {Object} currentlyVisiblePages
32
32
  */
@@ -40,21 +40,21 @@ declare class PDFRenderingQueue {
40
40
  getHighestPriority<T extends {
41
41
  div: HTMLElement;
42
42
  id: number;
43
- detailView?: IRenderableView;
44
- } & IRenderableView>(visible: ReturnType<typeof getVisibleElements<T>>, views: T[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): IRenderableView | null;
43
+ detailView?: RenderableView;
44
+ } & RenderableView>(visible: ReturnType<typeof getVisibleElements<T>>, views: T[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): RenderableView | null;
45
45
  /**
46
- * @param {IRenderableView} view
46
+ * @param {RenderableView} view
47
47
  * @returns {boolean}
48
48
  */
49
- isViewFinished(view: IRenderableView): boolean;
49
+ isViewFinished(view: RenderableView): boolean;
50
50
  /**
51
51
  * Render a page or thumbnail view. This calls the appropriate function
52
52
  * based on the views state. If the view is already rendered it will return
53
53
  * `false`.
54
54
  *
55
- * @param {IRenderableView} view
55
+ * @param {RenderableView} view
56
56
  */
57
- renderView(view: IRenderableView): boolean;
57
+ renderView(view: RenderableView): boolean;
58
58
  }
59
59
  export { PDFRenderingQueue };
60
60
  //# sourceMappingURL=pdf_rendering_queue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdf_rendering_queue.d.ts","sourceRoot":"","sources":["../../lib/pdf_rendering_queue.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,YAAY,CAAC;AAIjE;;GAEG;AACH,cAAM,iBAAiB;IACrB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,G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