@lingshugroup/web-plus 1.0.36 → 1.0.38

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.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/lib/index.css +1 -1
  3. package/lib/index.css.br +0 -0
  4. package/lib/index.css.gz +0 -0
  5. package/lib/packages/ls-components/components/descriptions/Index.vue/index.cjs +1 -1
  6. package/lib/packages/ls-components/components/descriptions/Index.vue/index.js +1 -1
  7. package/lib/packages/ls-components/components/descriptions/Index.vue/index2.cjs +1 -1
  8. package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js +62 -60
  9. package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js.br +0 -0
  10. package/lib/packages/ls-components/components/descriptions/Index.vue/index2.js.gz +0 -0
  11. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.cjs +1 -1
  12. package/lib/packages/ls-components/components/preview_docx/Docx.vue/index.js +2 -2
  13. package/lib/packages/ls-components/components/preview_docx/Index.vue/index.cjs +1 -1
  14. package/lib/packages/ls-components/components/preview_docx/Index.vue/index.js +2 -2
  15. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.cjs +1 -1
  16. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js +42 -42
  17. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.br +0 -0
  18. package/lib/packages/ls-components/components/preview_docx/Index.vue/index2.js.gz +0 -0
  19. package/lib/packages/ls-components/components/preview_image/Image.vue/index.cjs +1 -1
  20. package/lib/packages/ls-components/components/preview_image/Image.vue/index.js +2 -2
  21. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.cjs +1 -1
  22. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js +159 -149
  23. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.br +0 -0
  24. package/lib/packages/ls-components/components/preview_image/Image.vue/index2.js.gz +0 -0
  25. package/lib/packages/ls-components/components/preview_image/Index.vue/index.cjs +1 -1
  26. package/lib/packages/ls-components/components/preview_image/Index.vue/index.js +2 -2
  27. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.cjs +1 -1
  28. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js +44 -44
  29. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.br +0 -0
  30. package/lib/packages/ls-components/components/preview_image/Index.vue/index2.js.gz +0 -0
  31. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.cjs +1 -1
  32. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index.js +4 -4
  33. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.cjs +1 -1
  34. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js +38 -38
  35. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.br +0 -0
  36. package/lib/packages/ls-components/components/preview_pdf/Index.vue/index2.js.gz +0 -0
  37. package/lib/packages/ls-components/components/preview_pdf/composable/index.cjs +1 -1
  38. package/lib/packages/ls-components/components/preview_pdf/composable/index.js +43 -43
  39. package/lib/packages/ls-components/components/preview_pdf/composable/index.js.br +0 -0
  40. package/lib/packages/ls-components/components/preview_pdf/composable/index.js.gz +0 -0
  41. package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.cjs +1 -1
  42. package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js +20 -20
  43. package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js.br +0 -0
  44. package/lib/packages/ls-components/components/preview_pdf/pdfs/Annotation.vue/index.js.gz +0 -0
  45. package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.cjs +1 -1
  46. package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js +37 -37
  47. package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js.br +0 -0
  48. package/lib/packages/ls-components/components/preview_pdf/pdfs/PdfItem.vue/index.js.gz +0 -0
  49. package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.cjs +1 -1
  50. package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js +12 -12
  51. package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js.br +0 -0
  52. package/lib/packages/ls-components/components/preview_pdf/pdfs/Text.vue/index.js.gz +0 -0
  53. package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.cjs +1 -1
  54. package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js +6 -6
  55. package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js.br +0 -0
  56. package/lib/packages/ls-components/components/preview_pdf/pdfs/XFA.vue/index.js.gz +0 -0
  57. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.cjs +1 -1
  58. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index.js +1 -1
  59. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.cjs +1 -1
  60. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js +41 -41
  61. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.br +0 -0
  62. package/lib/packages/ls-components/components/preview_xlsx/Index.vue/index2.js.gz +0 -0
  63. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-a8acaa71"]]);exports.default=u;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=;/* empty css */;/* empty css */const t=,/* empty css */u=t.default(e.default,[["__scopeId","data-v-d1962326"]]);exports.default=u;
@@ -1,7 +1,7 @@
1
- import a from "./index2.js";
1
+ import o from "./index2.js";
2
2
  /* empty css */
3
- import o from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
4
- const e = /* @__PURE__ */ o(a, [["__scopeId", "data-v-a8acaa71"]]);
3
+ import r from "../../../../../_virtual/_plugin-vue_export-helper/index.js";
4
+ const f = /* @__PURE__ */ r(o, [["__scopeId", "data-v-d1962326"]]);
5
5
  export {
6
- e as default
6
+ f as default
7
7
  };
@@ -1 +1 @@
1
- "use strict";var L=Object.defineProperty;var n=(s,u)=>L(s,"name",{value:u,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=,/* empty css */f=,/* empty css */M=,/* empty css */E=require("element-plus");;/* empty css */;/* empty css */;/* empty css */const _=,/* empty css */S=,/* empty css */w=e.defineComponent({name:"LSPreviewPdf"}),B=e.defineComponent({...w,name:"LSPreviewPdf",components:{LSPdf:f.default},inheritAttrs:!1,props:e.mergeModels(M.lsPreviewProp,{modelValue:{type:Boolean},modelModifiers:{}}),emits:e.mergeModels(["loadComplete","loadError"],["update:modelValue"]),setup(s,{emit:u}){const d=u,o=s,{zoomSize:p}=e.toRefs(o),r=e.useModel(s,"modelValue"),i=e.reactive({zoomSize:p,source:""}),v=C.useNamespace("preview").b(),c=e.ref(),g=e.ref("文件加载失败,请检查文件是否已损坏!");let l=null;e.watch(()=>r==null?void 0:r.value,t=>{t&&m()},{immediate:!0,deep:!0}),e.watch(()=>o.source,t=>{i.source=t},{immediate:!0,deep:!0});function m(){o.needLoading&&(c.value=E.ElLoading.service(o.loadingOption)),l=setTimeout(()=>{o.source||(_.ElMessage.error("文件加载超时,请检查文件是否存在!"),a(),r.value=!1),clearTimeout(l)},6e3)}n(m,"openLoading");const a=n(()=>{l&&clearTimeout(l),o.needLoading&&c.value&&c.value.close()},"closeLoading"),P=n(()=>{a(),d("loadComplete")},"loadComplete"),q=n(()=>{a(),console.error(g.value),d("loadError")},"loadError");return e.onBeforeMount(()=>{r.value&&m()}),e.onBeforeUnmount(()=>{a()}),(t,y)=>r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(v))},[e.createVNode(f.default,e.mergeProps(e.unref(S.default)(e.unref(i),t.$attrs),{onLoadComplete:P,onLoadError:q}),null,16)],2)):e.createCommentVNode("",!0)}});exports.default=B;
1
+ "use strict";var q=Object.defineProperty;var n=(s,u)=>q(s,"name",{value:u,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=,/* empty css */f=,/* empty css */C=,/* empty css */M=require("element-plus");;/* empty css */;/* empty css */;/* empty css */const E=,/* empty css */_=,/* empty css */S=e.defineComponent({name:"LSPreviewPdf"}),w=e.defineComponent({...S,name:"LSPreviewPdf",components:{LSPdf:f.default},inheritAttrs:!1,props:e.mergeModels(C.lsPreviewProp,{modelValue:{type:Boolean},modelModifiers:{}}),emits:e.mergeModels(["loadComplete","loadError"],["update:modelValue"]),setup(s,{emit:u}){const d=u,o=s,{zoomSize:p}=e.toRefs(o),r=e.useModel(s,"modelValue"),i=e.reactive({zoomSize:p,source:""}),v=L.useNamespace("preview").b(),c=e.ref();let a=null;e.watch(()=>r==null?void 0:r.value,t=>{t&&m()},{immediate:!0,deep:!0}),e.watch(()=>o.source,t=>{i.source=t},{immediate:!0,deep:!0});function m(){o.needLoading&&(c.value=M.ElLoading.service(o.loadingOption)),a=setTimeout(()=>{o.source||(E.ElMessage.error("文件加载超时,请检查文件是否存在!"),l(),r.value=!1),clearTimeout(a)},6e3)}n(m,"openLoading");const l=n(()=>{a&&clearTimeout(a),o.needLoading&&c.value&&c.value.close()},"closeLoading"),g=n(()=>{l(),d("loadComplete")},"loadComplete"),P=n(()=>{l(),d("loadError")},"loadError");return e.onBeforeMount(()=>{r.value&&m()}),e.onBeforeUnmount(()=>{l()}),(t,h)=>r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(v))},[e.createVNode(f.default,e.mergeProps(e.unref(_.default)(e.unref(i),t.$attrs),{onLoadComplete:g,onLoadError:P}),null,16)],2)):e.createCommentVNode("",!0)}});exports.default=w;
@@ -1,25 +1,25 @@
1
- var _ = Object.defineProperty;
2
- var t = (n, l) => _(n, "name", { value: l, configurable: !0 });
3
- import { defineComponent as L, mergeModels as p, toRefs as w, useModel as S, reactive as V, ref as f, watch as v, onBeforeMount as h, onBeforeUnmount as k, openBlock as z, createElementBlock as N, normalizeClass as T, unref as i, createVNode as y, mergeProps as A, createCommentVNode as x } from "vue";
4
- import { useNamespace as I } from "../../_hooks/useNamespace/index.js";
5
- import g from "../Pdf.vue/index.js";
6
- import { lsPreviewProp as O } from "../types/index.js";
7
- import { ElLoading as R } from "element-plus";
1
+ var B = Object.defineProperty;
2
+ var t = (n, l) => B(n, "name", { value: l, configurable: !0 });
3
+ import { defineComponent as g, mergeModels as p, toRefs as M, useModel as _, reactive as w, ref as S, watch as f, onBeforeMount as V, onBeforeUnmount as h, openBlock as k, createElementBlock as z, normalizeClass as N, unref as i, createVNode as T, mergeProps as y, createCommentVNode as A } from "vue";
4
+ import { useNamespace as x } from "../../_hooks/useNamespace/index.js";
5
+ import v from "../Pdf.vue/index.js";
6
+ import { lsPreviewProp as I } from "../types/index.js";
7
+ import { ElLoading as O } from "element-plus";
8
8
  /* empty css */
9
9
  /* empty css */
10
10
  /* empty css */
11
- import { ElMessage as U } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/message/index/index.js";
12
- import $ from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge/index.js";
13
- const b = L({
11
+ import { ElMessage as R } from "../../../../../node_modules/.pnpm/element-plus@2.8.1_vue@3.5.13_typescript@5.5.4_/node_modules/element-plus/es/components/message/index/index.js";
12
+ import U from "../../../../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge/index.js";
13
+ const $ = g({
14
14
  name: "LSPreviewPdf"
15
- }), ee = /* @__PURE__ */ L({
16
- ...b,
15
+ }), Z = /* @__PURE__ */ g({
16
+ ...$,
17
17
  name: "LSPreviewPdf",
18
18
  components: {
19
- LSPdf: g
19
+ LSPdf: v
20
20
  },
21
21
  inheritAttrs: !1,
22
- props: /* @__PURE__ */ p(O, {
22
+ props: /* @__PURE__ */ p(I, {
23
23
  modelValue: {
24
24
  type: Boolean
25
25
  },
@@ -27,12 +27,12 @@ const b = L({
27
27
  }),
28
28
  emits: /* @__PURE__ */ p(["loadComplete", "loadError"], ["update:modelValue"]),
29
29
  setup(n, { emit: l }) {
30
- const c = l, e = n, { zoomSize: C } = w(e), o = S(n, "modelValue"), d = V({
31
- zoomSize: C,
30
+ const d = l, e = n, { zoomSize: L } = M(e), o = _(n, "modelValue"), c = w({
31
+ zoomSize: L,
32
32
  source: ""
33
- }), P = I("preview").b(), m = f(), E = f("文件加载失败,请检查文件是否已损坏!");
33
+ }), C = x("preview").b(), s = S();
34
34
  let a = null;
35
- v(
35
+ f(
36
36
  () => o == null ? void 0 : o.value,
37
37
  (r) => {
38
38
  r && u();
@@ -41,10 +41,10 @@ const b = L({
41
41
  immediate: !0,
42
42
  deep: !0
43
43
  }
44
- ), v(
44
+ ), f(
45
45
  () => e.source,
46
46
  (r) => {
47
- d.source = r;
47
+ c.source = r;
48
48
  },
49
49
  {
50
50
  immediate: !0,
@@ -52,33 +52,33 @@ const b = L({
52
52
  }
53
53
  );
54
54
  function u() {
55
- e.needLoading && (m.value = R.service(e.loadingOption)), a = setTimeout(() => {
56
- e.source || (U.error("文件加载超时,请检查文件是否存在!"), s(), o.value = !1), clearTimeout(a);
55
+ e.needLoading && (s.value = O.service(e.loadingOption)), a = setTimeout(() => {
56
+ e.source || (R.error("文件加载超时,请检查文件是否存在!"), m(), o.value = !1), clearTimeout(a);
57
57
  }, 6e3);
58
58
  }
59
59
  t(u, "openLoading");
60
- const s = /* @__PURE__ */ t(() => {
61
- a && clearTimeout(a), e.needLoading && m.value && m.value.close();
62
- }, "closeLoading"), M = /* @__PURE__ */ t(() => {
63
- s(), c("loadComplete");
64
- }, "loadComplete"), B = /* @__PURE__ */ t(() => {
65
- s(), console.error(E.value), c("loadError");
60
+ const m = /* @__PURE__ */ t(() => {
61
+ a && clearTimeout(a), e.needLoading && s.value && s.value.close();
62
+ }, "closeLoading"), P = /* @__PURE__ */ t(() => {
63
+ m(), d("loadComplete");
64
+ }, "loadComplete"), E = /* @__PURE__ */ t(() => {
65
+ m(), d("loadError");
66
66
  }, "loadError");
67
- return h(() => {
67
+ return V(() => {
68
68
  o.value && u();
69
- }), k(() => {
70
- s();
71
- }), (r, q) => o.value ? (z(), N("div", {
69
+ }), h(() => {
70
+ m();
71
+ }), (r, j) => o.value ? (k(), z("div", {
72
72
  key: 0,
73
- class: T(i(P))
73
+ class: N(i(C))
74
74
  }, [
75
- y(g, A(i($)(i(d), r.$attrs), {
76
- onLoadComplete: M,
77
- onLoadError: B
75
+ T(v, y(i(U)(i(c), r.$attrs), {
76
+ onLoadComplete: P,
77
+ onLoadError: E
78
78
  }), null, 16)
79
- ], 2)) : x("", !0);
79
+ ], 2)) : A("", !0);
80
80
  }
81
81
  });
82
82
  export {
83
- ee as default
83
+ Z as default
84
84
  };
@@ -1 +1 @@
1
- "use strict";var x=Object.defineProperty;var l=(t,o)=>x(t,"name",{value:o,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("pdfjs-dist"),N=require("../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.cjs"),m=require("vue"),b=require("../pdfs/destination/index.cjs"),T=require("../pdfs/miscellaneous/index.cjs");function U(t){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const i=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(o,u,i.get?i:{enumerable:!0,get:l(()=>t[u],"get")})}}return o.default=t,Object.freeze(o)}l(U,"_interopNamespaceDefault");const P=U(E);function _(t){P.GlobalWorkerOptions.workerSrc=t}l(_,"configWorker");function q(t,o={onProgress:void 0,onPassword:void 0,onError:void 0,password:""}){var S;(S=P.GlobalWorkerOptions)!=null&&S.workerSrc||_(N.default);const u=m.shallowRef(),i=m.shallowRef(),D=m.shallowRef(0),k=m.shallowRef({});function v(d){i.value&&i.value.destroy();const a=P.getDocument(d);if(o.onProgress&&(a.onProgress=o.onProgress),o.onPassword)a.onPassword=o.onPassword;else if(o.password){const e=l(c=>{c(o.password??"")},"onPassword");a.onPassword=e}return a.promise.then(async e=>{i.value=e,u.value=e.loadingTask,D.value=e.numPages;const c=await e.getMetadata(),s=await e.getAttachments(),r=await e.getJSActions(),f=await e.getOutline();k.value={metadata:c,attachments:s,javascript:r,outline:f}},e=>{typeof o.onError=="function"&&o.onError(e)})}l(v,"processLoadingTask");async function L(d){var n;const a=await((n=u.value)==null?void 0:n.promise);if(!a)return null;const e=await b.getDestinationArray(a,d),c=await b.getDestinationRef(a,e);if(!c||!e)return null;const s=await a.getPageIndex(c),r=e[1].name,f=e.slice(2),p=b.isSpecLike(f)?b.getLocation(r,f):null;return{pageIndex:s,location:p??{type:"Fit",spec:[]}}}l(L,"getPDFDestination");async function j(d="filename"){var r;if(!i.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const a=await((r=i.value)==null?void 0:r.saveDocument()),e=new Blob([a],{type:"application/pdf"}),c=URL.createObjectURL(e),s=document.createElement("a");document.body.appendChild(s),s.href=c,s.download=d,s.style.display="none",s.click(),setTimeout(()=>{URL.revokeObjectURL(c),document.body.removeChild(s)},10)}l(j,"download");async function F(d=150,a="filename"){var R,C;if(!i.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const e=await((R=i.value)==null?void 0:R.saveDocument()),s=await P.getDocument(e.buffer).promise,r=d/72,f=96/72,p=await T.createIframe(),n=p.contentWindow;n.document.title=a;const I=[...Array(s.numPages).keys()].map(y=>y+1);for(const y of I){const h=await s.getPage(y),g=h.getViewport({scale:1});y===1&&T.addStylesToIframe(n,g.width*r/f,g.height*r/f);const w=document.createElement("canvas");w.width=g.width*r,w.height=g.height*r;const O=w.cloneNode();n==null||n.document.body.appendChild(O),await(h==null?void 0:h.render({canvasContext:w.getContext("2d"),intent:"print",transform:[r,0,0,r,0,0],viewport:g}).promise),(C=O.getContext("2d"))==null||C.drawImage(w,0,0)}n==null||n.focus(),n==null||n.print(),document.body.removeChild(p)}return l(F,"print"),m.isRef(t)?(t.value&&v(t.value),m.watch(t,()=>{t.value&&v(t.value)})):t&&v(t),{pdf:u,pages:D,info:k,print:F,download:j,getPDFDestination:L,processLoadingTask:v}}l(q,"usePDF");exports.usePDF=q;
1
+ "use strict";var U=Object.defineProperty;var c=(s,r)=>U(s,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("pdfjs-dist"),N=require("../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.cjs"),f=require("vue"),h=require("../pdfs/destination/index.cjs"),L=require("../pdfs/miscellaneous/index.cjs");function O(s){P.GlobalWorkerOptions.workerSrc=s}c(O,"configWorker");function q(s,r={onProgress:void 0,onPassword:void 0,onError:void 0,password:""}){var R;(R=P.GlobalWorkerOptions)!=null&&R.workerSrc||O(N.default);const b=f.shallowRef(),l=f.shallowRef(),D=f.shallowRef(0),k=f.shallowRef({});function g(u){l.value&&l.value.destroy();const o=P.getDocument(u);if(r.onProgress&&(o.onProgress=r.onProgress),r.onPassword)o.onPassword=r.onPassword;else if(r.password){const e=c(i=>{i(r.password??"")},"onPassword");o.onPassword=e}return o.promise.then(async e=>{l.value=e,b.value=e.loadingTask,D.value=e.numPages;const i=await e.getMetadata(),a=await e.getAttachments(),n=await e.getJSActions(),d=await e.getOutline();k.value={metadata:i,attachments:a,javascript:n,outline:d}},e=>{typeof r.onError=="function"&&r.onError(e)})}c(g,"processLoadingTask");async function I(u){var t;const o=await((t=b.value)==null?void 0:t.promise);if(!o)return null;const e=await h.getDestinationArray(o,u),i=await h.getDestinationRef(o,e);if(!i||!e)return null;const a=await o.getPageIndex(i),n=e[1].name,d=e.slice(2),v=h.isSpecLike(d)?h.getLocation(n,d):null;return{pageIndex:a,location:v??{type:"Fit",spec:[]}}}c(I,"getPDFDestination");async function x(u="filename"){var n;if(!l.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const o=await((n=l.value)==null?void 0:n.saveDocument()),e=new Blob([o],{type:"application/pdf"}),i=URL.createObjectURL(e),a=document.createElement("a");document.body.appendChild(a),a.href=i,a.download=u,a.style.display="none",a.click(),setTimeout(()=>{URL.revokeObjectURL(i),document.body.removeChild(a)},10)}c(x,"download");async function E(u=150,o="filename"){var S,C;if(!l.value)throw new Error("Current PDFDocumentProxy have not loaded yet");const e=await((S=l.value)==null?void 0:S.saveDocument()),a=await P.getDocument(e.buffer).promise,n=u/72,d=96/72,v=await L.createIframe(),t=v.contentWindow;t.document.title=o;const F=[...Array(a.numPages).keys()].map(p=>p+1);for(const p of F){const y=await a.getPage(p),m=y.getViewport({scale:1});p===1&&L.addStylesToIframe(t,m.width*n/d,m.height*n/d);const w=document.createElement("canvas");w.width=m.width*n,w.height=m.height*n;const T=w.cloneNode();t==null||t.document.body.appendChild(T),await(y==null?void 0:y.render({canvasContext:w.getContext("2d"),intent:"print",transform:[n,0,0,n,0,0],viewport:m}).promise),(C=T.getContext("2d"))==null||C.drawImage(w,0,0)}t==null||t.focus(),t==null||t.print(),document.body.removeChild(v)}return c(E,"print"),f.isRef(s)?(s.value&&g(s.value),f.watch(s,()=>{s.value&&g(s.value)})):s&&g(s),{pdf:b,pages:D,info:k,print:E,download:x,getPDFDestination:I,processLoadingTask:g}}c(q,"usePDF");exports.usePDF=q;
@@ -1,26 +1,26 @@
1
- var E = Object.defineProperty;
2
- var c = (r, s) => E(r, "name", { value: s, configurable: !0 });
3
- import * as h from "pdfjs-dist";
1
+ var U = Object.defineProperty;
2
+ var c = (r, s) => U(r, "name", { value: s, configurable: !0 });
3
+ import { GlobalWorkerOptions as S, getDocument as R } from "pdfjs-dist";
4
4
  import F from "../../../../../node_modules/.pnpm/pdfjs-dist@4.8.69/node_modules/pdfjs-dist/build/pdf.worker.min/index.js";
5
- import { shallowRef as y, isRef as U, watch as N } from "vue";
6
- import { getDestinationArray as A, getDestinationRef as O, isSpecLike as j, getLocation as B } from "../pdfs/destination/index.js";
5
+ import { shallowRef as y, isRef as N, watch as A } from "vue";
6
+ import { getDestinationArray as O, getDestinationRef as j, isSpecLike as B, getLocation as _ } from "../pdfs/destination/index.js";
7
7
  import { createIframe as G, addStylesToIframe as J } from "../pdfs/miscellaneous/index.js";
8
- function _(r) {
9
- h.GlobalWorkerOptions.workerSrc = r;
8
+ function M(r) {
9
+ S.workerSrc = r;
10
10
  }
11
- c(_, "configWorker");
12
- function K(r, s = {
11
+ c(M, "configWorker");
12
+ function X(r, s = {
13
13
  onProgress: void 0,
14
14
  onPassword: void 0,
15
15
  onError: void 0,
16
16
  password: ""
17
17
  }) {
18
- var k;
19
- (k = h.GlobalWorkerOptions) != null && k.workerSrc || _(F);
20
- const P = y(), l = y(), b = y(0), D = y({});
21
- function w(d) {
22
- l.value && l.value.destroy();
23
- const o = h.getDocument(d);
18
+ var D;
19
+ (D = S) != null && D.workerSrc || M(F);
20
+ const h = y(), d = y(), P = y(0), b = y({});
21
+ function w(l) {
22
+ d.value && d.value.destroy();
23
+ const o = R(l);
24
24
  if (s.onProgress && (o.onProgress = s.onProgress), s.onPassword)
25
25
  o.onPassword = s.onPassword;
26
26
  else if (s.password) {
@@ -31,9 +31,9 @@ function K(r, s = {
31
31
  }
32
32
  return o.promise.then(
33
33
  async (e) => {
34
- l.value = e, P.value = e.loadingTask, b.value = e.numPages;
34
+ d.value = e, h.value = e.loadingTask, P.value = e.numPages;
35
35
  const i = await e.getMetadata(), a = await e.getAttachments(), n = await e.getJSActions(), u = await e.getOutline();
36
- D.value = {
36
+ b.value = {
37
37
  metadata: i,
38
38
  attachments: a,
39
39
  javascript: n,
@@ -46,32 +46,32 @@ function K(r, s = {
46
46
  );
47
47
  }
48
48
  c(w, "processLoadingTask");
49
- async function R(d) {
49
+ async function T(l) {
50
50
  var t;
51
- const o = await ((t = P.value) == null ? void 0 : t.promise);
51
+ const o = await ((t = h.value) == null ? void 0 : t.promise);
52
52
  if (!o) return null;
53
- const e = await A(o, d), i = await O(o, e);
53
+ const e = await O(o, l), i = await j(o, e);
54
54
  if (!i || !e) return null;
55
- const a = await o.getPageIndex(i), n = e[1].name, u = e.slice(2), g = j(u) ? B(n, u) : null;
55
+ const a = await o.getPageIndex(i), n = e[1].name, u = e.slice(2), g = B(u) ? _(n, u) : null;
56
56
  return { pageIndex: a, location: g ?? { type: "Fit", spec: [] } };
57
57
  }
58
- c(R, "getPDFDestination");
59
- async function T(d = "filename") {
58
+ c(T, "getPDFDestination");
59
+ async function x(l = "filename") {
60
60
  var n;
61
- if (!l.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
62
- const o = await ((n = l.value) == null ? void 0 : n.saveDocument()), e = new Blob([o], { type: "application/pdf" }), i = URL.createObjectURL(e), a = document.createElement("a");
63
- document.body.appendChild(a), a.href = i, a.download = d, a.style.display = "none", a.click(), setTimeout(() => {
61
+ if (!d.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
62
+ const o = await ((n = d.value) == null ? void 0 : n.saveDocument()), e = new Blob([o], { type: "application/pdf" }), i = URL.createObjectURL(e), a = document.createElement("a");
63
+ document.body.appendChild(a), a.href = i, a.download = l, a.style.display = "none", a.click(), setTimeout(() => {
64
64
  URL.revokeObjectURL(i), document.body.removeChild(a);
65
65
  }, 10);
66
66
  }
67
- c(T, "download");
68
- async function x(d = 150, o = "filename") {
69
- var C, S;
70
- if (!l.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
71
- const e = await ((C = l.value) == null ? void 0 : C.saveDocument()), a = await h.getDocument(e.buffer).promise, n = d / 72, u = 96 / 72, g = await G(), t = g.contentWindow;
67
+ c(x, "download");
68
+ async function I(l = 150, o = "filename") {
69
+ var k, C;
70
+ if (!d.value) throw new Error("Current PDFDocumentProxy have not loaded yet");
71
+ const e = await ((k = d.value) == null ? void 0 : k.saveDocument()), a = await R(e.buffer).promise, n = l / 72, u = 96 / 72, g = await G(), t = g.contentWindow;
72
72
  t.document.title = o;
73
- const I = [...Array(a.numPages).keys()].map((v) => v + 1);
74
- for (const v of I) {
73
+ const E = [...Array(a.numPages).keys()].map((v) => v + 1);
74
+ for (const v of E) {
75
75
  const p = await a.getPage(v), m = p.getViewport({ scale: 1 });
76
76
  v === 1 && J(
77
77
  t,
@@ -86,23 +86,23 @@ function K(r, s = {
86
86
  intent: "print",
87
87
  transform: [n, 0, 0, n, 0, 0],
88
88
  viewport: m
89
- }).promise), (S = L.getContext("2d")) == null || S.drawImage(f, 0, 0);
89
+ }).promise), (C = L.getContext("2d")) == null || C.drawImage(f, 0, 0);
90
90
  }
91
91
  t == null || t.focus(), t == null || t.print(), document.body.removeChild(g);
92
92
  }
93
- return c(x, "print"), U(r) ? (r.value && w(r.value), N(r, () => {
93
+ return c(I, "print"), N(r) ? (r.value && w(r.value), A(r, () => {
94
94
  r.value && w(r.value);
95
95
  })) : r && w(r), {
96
- pdf: P,
97
- pages: b,
98
- info: D,
99
- print: x,
100
- download: T,
101
- getPDFDestination: R,
96
+ pdf: h,
97
+ pages: P,
98
+ info: b,
99
+ print: I,
100
+ download: x,
101
+ getPDFDestination: T,
102
102
  processLoadingTask: w
103
103
  };
104
104
  }
105
- c(K, "usePDF");
105
+ c(X, "usePDF");
106
106
  export {
107
- K as usePDF
107
+ X as usePDF
108
108
  };
@@ -1 +1 @@
1
- "use strict";var F=Object.defineProperty;var c=(s,l)=>F(s,"name",{value:l,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),j=require("pdfjs-dist"),y=require("../annotations/index.cjs"),k=require("../linkService/index.cjs");function P(s){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const d=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(l,e,d.get?d:{enumerable:!0,get:c(()=>s[e],"get")})}}return l.default=s,Object.freeze(l)}c(P,"_interopNamespaceDefault");const T=P(j),L=i.defineComponent({__name:"Annotation",props:{page:{},viewport:{},document:{},annotationsFilter:{},annotationsMap:{},imageResourcesPath:{},hideForms:{type:Boolean},enableScripting:{type:Boolean},intent:{}},emits:["annotation","annotationLoaded"],setup(s,{emit:l}){const e=s,d=l,r=i.ref(),v=i.ref();function w(o){const t=y.annotationEventsHandler(o,e.document,v.value);Promise.resolve(t).then(n=>{n&&d("annotation",n)})}c(w,"annotationsEvents");async function M(){var t;return await((t=i.toRaw(e.document))==null?void 0:t.getFieldObjects())}c(M,"getFieldObjects");async function O(){var t;return await((t=i.toRaw(e.document))==null?void 0:t.hasJSActions())}c(O,"getHasJSActions");async function b(){const o=e.page;let t=await(o==null?void 0:o.getAnnotations({intent:e.intent}));if(e.annotationsFilter){const n=e.annotationsFilter;t=t.filter(u=>{const p=u.subtype,f=u.fieldType?`${p}.${u.fieldType}`:null;return(n==null?void 0:n.includes(p))||f!==null&&(n==null?void 0:n.includes(f))})}return t}c(b,"getAnnotations");async function S(){var h,_;(_=(h=r.value).replaceChildren)==null||_.call(h);for(const a of y.EVENTS_TO_HANDLER)r.value.removeEventListener(a,w);const o=i.toRaw(e.document),t=e.page,n=e.viewport;v.value=await b();const u=new Map([]);for(const a of v.value)if(a.subtype==="Widget"&&a.fieldType==="Btn"&&a.pushButton){const g=a.rect[2]-a.rect[0],E=a.rect[3]-a.rect[1],m=document.createElement("canvas");m.setAttribute("width",(g*n.scale).toString()),m.setAttribute("height",(E*n.scale).toString()),u.set(a.id,m)}const p=o.annotationStorage;if(e.annotationsMap)for(const[a,g]of Object.entries(e.annotationsMap))p.setValue(a,g);const f={accessibilityManager:void 0,annotationCanvasMap:u,div:r.value,page:t,viewport:n.clone({dontFlip:!0}),annotationEditorUIManager:null,l10n:null},A={annotations:v.value,viewport:n.clone({dontFlip:!0}),linkService:new k.SimpleLinkService,annotationCanvasMap:u,div:r.value,annotationStorage:p,renderForms:!e.hideForms,page:t,enableScripting:!1,hasJSActions:await O(),fieldObjects:await M(),downloadManager:null,imageResourcesPath:e.imageResourcesPath};new T.AnnotationLayer(f).render(A).then(async()=>{d("annotationLoaded",await b())});for(const a of y.EVENTS_TO_HANDLER)r.value.addEventListener(a,w)}return c(S,"render"),i.watch(()=>e.viewport,()=>{e.page&&e.viewport&&r.value&&S()}),i.onMounted(()=>{e.page&&e.viewport&&r.value&&S()}),(o,t)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"layer",ref:r,class:"annotationLayer",style:{display:"block"}},null,512))}});exports.default=L;
1
+ "use strict";var k=Object.defineProperty;var c=(p,v)=>k(p,"name",{value:v,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),T=require("pdfjs-dist"),m=require("../annotations/index.cjs"),L=require("../linkService/index.cjs"),O=i.defineComponent({__name:"Annotation",props:{page:{},viewport:{},document:{},annotationsFilter:{},annotationsMap:{},imageResourcesPath:{},hideForms:{type:Boolean},enableScripting:{type:Boolean},intent:{}},emits:["annotation","annotationLoaded"],setup(p,{emit:v}){const t=p,y=v,s=i.ref(),u=i.ref();function w(o){const e=m.annotationEventsHandler(o,t.document,u.value);Promise.resolve(e).then(n=>{n&&y("annotation",n)})}c(w,"annotationsEvents");async function E(){var e;return await((e=i.toRaw(t.document))==null?void 0:e.getFieldObjects())}c(E,"getFieldObjects");async function M(){var e;return await((e=i.toRaw(t.document))==null?void 0:e.hasJSActions())}c(M,"getHasJSActions");async function h(){const o=t.page;let e=await(o==null?void 0:o.getAnnotations({intent:t.intent}));if(t.annotationsFilter){const n=t.annotationsFilter;e=e.filter(r=>{const l=r.subtype,d=r.fieldType?`${l}.${r.fieldType}`:null;return(n==null?void 0:n.includes(l))||d!==null&&(n==null?void 0:n.includes(d))})}return e}c(h,"getAnnotations");async function S(){var b,A;(A=(b=s.value).replaceChildren)==null||A.call(b);for(const a of m.EVENTS_TO_HANDLER)s.value.removeEventListener(a,w);const o=i.toRaw(t.document),e=t.page,n=t.viewport;u.value=await h();const r=new Map([]);for(const a of u.value)if(a.subtype==="Widget"&&a.fieldType==="Btn"&&a.pushButton){const f=a.rect[2]-a.rect[0],F=a.rect[3]-a.rect[1],g=document.createElement("canvas");g.setAttribute("width",(f*n.scale).toString()),g.setAttribute("height",(F*n.scale).toString()),r.set(a.id,g)}const l=o.annotationStorage;if(t.annotationsMap)for(const[a,f]of Object.entries(t.annotationsMap))l.setValue(a,f);const d={accessibilityManager:void 0,annotationCanvasMap:r,div:s.value,page:e,viewport:n.clone({dontFlip:!0}),annotationEditorUIManager:null,l10n:null},_={annotations:u.value,viewport:n.clone({dontFlip:!0}),linkService:new L.SimpleLinkService,annotationCanvasMap:r,div:s.value,annotationStorage:l,renderForms:!t.hideForms,page:e,enableScripting:!1,hasJSActions:await M(),fieldObjects:await E(),downloadManager:null,imageResourcesPath:t.imageResourcesPath};new T.AnnotationLayer(d).render(_).then(async()=>{y("annotationLoaded",await h())});for(const a of m.EVENTS_TO_HANDLER)s.value.addEventListener(a,w)}return c(S,"render"),i.watch(()=>t.viewport,()=>{t.page&&t.viewport&&s.value&&S()}),i.onMounted(()=>{t.page&&t.viewport&&s.value&&S()}),(o,e)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"layer",ref:s,class:"annotationLayer",style:{display:"block"}},null,512))}});exports.default=O;
@@ -1,10 +1,10 @@
1
1
  var L = Object.defineProperty;
2
2
  var r = (d, p) => L(d, "name", { value: p, configurable: !0 });
3
- import { defineComponent as O, ref as A, watch as P, onMounted as T, openBlock as j, createElementBlock as B, toRaw as m } from "vue";
4
- import * as H from "pdfjs-dist";
5
- import { EVENTS_TO_HANDLER as F, annotationEventsHandler as J } from "../annotations/index.js";
6
- import { SimpleLinkService as C } from "../linkService/index.js";
7
- const W = /* @__PURE__ */ O({
3
+ import { defineComponent as O, ref as A, watch as T, onMounted as j, openBlock as B, createElementBlock as H, toRaw as m } from "vue";
4
+ import { AnnotationLayer as P } from "pdfjs-dist";
5
+ import { EVENTS_TO_HANDLER as M, annotationEventsHandler as C } from "../annotations/index.js";
6
+ import { SimpleLinkService as J } from "../linkService/index.js";
7
+ const D = /* @__PURE__ */ O({
8
8
  __name: "Annotation",
9
9
  props: {
10
10
  page: {},
@@ -21,22 +21,22 @@ const W = /* @__PURE__ */ O({
21
21
  setup(d, { emit: p }) {
22
22
  const t = d, g = p, i = A(), l = A();
23
23
  function y(o) {
24
- const n = J(o, t.document, l.value);
24
+ const n = C(o, t.document, l.value);
25
25
  Promise.resolve(n).then((e) => {
26
26
  e && g("annotation", e);
27
27
  });
28
28
  }
29
29
  r(y, "annotationsEvents");
30
- async function M() {
30
+ async function E() {
31
31
  var n;
32
32
  return await ((n = m(t.document)) == null ? void 0 : n.getFieldObjects());
33
33
  }
34
- r(M, "getFieldObjects");
35
- async function E() {
34
+ r(E, "getFieldObjects");
35
+ async function F() {
36
36
  var n;
37
37
  return await ((n = m(t.document)) == null ? void 0 : n.hasJSActions());
38
38
  }
39
- r(E, "getHasJSActions");
39
+ r(F, "getHasJSActions");
40
40
  async function w() {
41
41
  const o = t.page;
42
42
  let n = await (o == null ? void 0 : o.getAnnotations({ intent: t.intent }));
@@ -53,7 +53,7 @@ const W = /* @__PURE__ */ O({
53
53
  async function h() {
54
54
  var b, S;
55
55
  (S = (b = i.value).replaceChildren) == null || S.call(b);
56
- for (const a of F) i.value.removeEventListener(a, y);
56
+ for (const a of M) i.value.removeEventListener(a, y);
57
57
  const o = m(t.document), n = t.page, e = t.viewport;
58
58
  l.value = await w();
59
59
  const s = /* @__PURE__ */ new Map([]);
@@ -76,31 +76,31 @@ const W = /* @__PURE__ */ O({
76
76
  }, k = {
77
77
  annotations: l.value,
78
78
  viewport: e.clone({ dontFlip: !0 }),
79
- linkService: new C(),
79
+ linkService: new J(),
80
80
  annotationCanvasMap: s,
81
81
  div: i.value,
82
82
  annotationStorage: c,
83
83
  renderForms: !t.hideForms,
84
84
  page: n,
85
85
  enableScripting: !1,
86
- hasJSActions: await E(),
87
- fieldObjects: await M(),
86
+ hasJSActions: await F(),
87
+ fieldObjects: await E(),
88
88
  downloadManager: null,
89
89
  imageResourcesPath: t.imageResourcesPath
90
90
  };
91
- new H.AnnotationLayer(u).render(k).then(async () => {
91
+ new P(u).render(k).then(async () => {
92
92
  g("annotationLoaded", await w());
93
93
  });
94
- for (const a of F) i.value.addEventListener(a, y);
94
+ for (const a of M) i.value.addEventListener(a, y);
95
95
  }
96
- return r(h, "render"), P(
96
+ return r(h, "render"), T(
97
97
  () => t.viewport,
98
98
  () => {
99
99
  t.page && t.viewport && i.value && h();
100
100
  }
101
- ), T(() => {
101
+ ), j(() => {
102
102
  t.page && t.viewport && i.value && h();
103
- }), (o, n) => (j(), B("div", {
103
+ }), (o, n) => (B(), H("div", {
104
104
  ref_key: "layer",
105
105
  ref: i,
106
106
  class: "annotationLayer",
@@ -109,5 +109,5 @@ const W = /* @__PURE__ */ O({
109
109
  }
110
110
  });
111
111
  export {
112
- W as default
112
+ D as default
113
113
  };
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var r=(s,f)=>D(s,"name",{value:f,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),j=require("pdfjs-dist"),z=;/* empty css */;/* empty css */const H=,/* empty css */J=;/* empty css */;/* empty css */const X=;/* empty css */function I(s){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const p in s)if(p!=="default"){const o=Object.getOwnPropertyDescriptor(s,p);Object.defineProperty(f,p,o.get?o:{enumerable:!0,get:r(()=>s[p],"get")})}}return f.default=s,Object.freeze(f)}r(I,"_interopNamespaceDefault");const C=I(j),G=n.defineComponent({name:"LSPdf"}),K=n.defineComponent({...G,props:{pdf:{},page:{default:1},scale:{default:1},rotation:{},fitParent:{type:Boolean},width:{},height:{},textLayer:{type:Boolean},imageResourcesPath:{},hideForms:{type:Boolean},intent:{default:"display"},annotationLayer:{type:Boolean},annotationsFilter:{},annotationsMap:{},watermarkText:{},watermarkOptions:{},highlightText:{},highlightOptions:{}},emits:["annotation","highlight","loaded","textLoaded","annotationLoaded","xfaLoaded","loadComplete","loadError","update:source"],setup(s,{expose:f,emit:p}){const o=s,u=p;n.watch(()=>o.pdf,()=>{W()},{immediate:!0,deep:!0});const v=n.ref(),y=n.ref(),_=n.ref(!1);let x;const c=n.computed(()=>({viewport:void 0,document:void 0,page:void 0})),A=n.computed(()=>({annotationsMap:o.annotationsMap,annotationsFilter:o.annotationsFilter,imageResourcesPath:o.imageResourcesPath,hideForms:o.hideForms,intent:o.intent})),O=n.computed(()=>({highlightText:o.highlightText,highlightOptions:o.highlightOptions}));function T(){return X.default({},{columns:4,rows:4,rotation:45,fontSize:18,color:"rgba(211, 210, 211, 0.4)"},o.watermarkOptions)}r(T,"getWatermarkOptionsWithDefaults");function b(a){if(!(typeof a=="number"&&a%90===0))return 0;const e=a/90;return e>4?b(a-360):e<0?b(a+360):a}r(b,"getRotation");function B(a){let e=o.scale;if(o.fitParent){const t=v.value.parentNode.clientWidth,i=a.getViewport({scale:1}).width;e=t/i}else if(o.width){const t=a.getViewport({scale:1}).width;e=o.width/t}else if(o.height){const t=a.getViewport({scale:1}).height;e=o.height/t}return e}r(B,"getScale");function F(a=1){if(!o.watermarkText)return;const e=M();if(!e)return;const t=e.getContext("2d");if(!t)return;const i=T(),h=o.watermarkText,l=i.columns,g=i.rows,d=l*g,w=i.rotation,P=i.fontSize*a;t.font=`${P}px Trebuchet MS`,t.fillStyle=i.color;for(let m=0;m<d;m++){const k=m%l*(e.width/l)+e.width/(l*2),q=Math.floor(m/l)*(e.height/g)+e.height/(g*2),$=t.measureText(h).width;t.save(),t.translate(k,q),t.rotate(-w*(Math.PI/180)),t.fillText(h,-$/2,P/2),t.restore()}}r(F,"paintWatermark");function M(){var e;let a=null;return(e=v.value)==null||e.childNodes.forEach(t=>{t.tagName==="CANVAS"&&(a=t)}),a}r(M,"getCurrentCanvas");function N(a){var h;let e;const t=M();t&&(t==null?void 0:t.getAttribute("role"))==="main"?e=t:(e=document.createElement("canvas"),e.style.display="block",e.setAttribute("dir","ltr"));const i=window.devicePixelRatio||1;return e.width=Math.floor(a.width*i),e.height=Math.floor(a.height*i),e.style.width=`${Math.floor(a.width)}px`,e.style.height=`${Math.floor(a.height)}px`,e.setAttribute("class","pdf-canvas"),(h=v.value)==null||h.style.setProperty("--scale-factor",`${a.scale}`),y.value.style.width=`${Math.floor(a.width)}px`,y.value.style.height=`${Math.floor(a.height)}px`,y.value.style.top="0",y.value.style.left="0",_.value=!0,e}r(N,"setupCanvas");function S(){x&&x.cancel()}r(S,"cancelRender");function L(a){var e;(e=n.toRaw(c.value.document))==null||e.getPage(a).then(t=>{var k;S();const i=t.getViewport(),h={scale:B(t),rotation:b((o.rotation||0)+i.rotation)},l=t.getViewport(h),g=M(),d=N(l),w=window.devicePixelRatio||1,P=w!==1?[w,0,0,w,0,0]:void 0,m={canvasContext:d.getContext("2d"),viewport:l,annotationMode:o.hideForms?C.AnnotationMode.ENABLE:C.AnnotationMode.ENABLE_FORMS,transform:P,intent:o.intent};(d==null?void 0:d.getAttribute("role"))!=="main"?g&&((k=v.value)==null||k.replaceChild(d,g)):d.removeAttribute("role"),c.value.page=t,c.value.viewport=l,x=t.render(m),x.promise.then(()=>{_.value=!1,F(l.scale),u("loaded",c.value.viewport),u("loadComplete")}).catch(()=>{u("loadError")})})}r(L,"renderPage");function V(a){a.promise&&a.promise.then(async e=>{c.value.document=e,L(o.page)})}r(V,"initDoc"),n.watch(()=>[o.page,o.scale,o.width,o.height,o.rotation,o.hideForms,o.intent],()=>{L(o.page)});function E(){L(o.page)}r(E,"reload");function R(){S()}r(R,"cancel");async function W(){if(o.pdf)try{V(o.pdf)}finally{}}return r(W,"initPdf"),f({reload:E,cancel:R}),(a,e)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"container",ref:v,style:{position:"relative",display:"block"}},[e[5]||(e[5]=n.createElementVNode("canvas",{dir:"ltr",style:{display:"block"},role:"main"},null,-1)),a.annotationLayer?(n.openBlock(),n.createBlock(z.default,n.mergeProps({key:0},{...n.unref(c),...n.unref(A)},{onAnnotation:e[0]||(e[0]=t=>u("annotation",t)),onAnnotationLoaded:e[1]||(e[1]=t=>u("annotationLoaded",t))}),null,16)):n.createCommentVNode("",!0),a.textLayer?(n.openBlock(),n.createBlock(H.default,n.mergeProps({key:1},{...n.unref(c),...n.unref(O)},{onHighlight:e[2]||(e[2]=t=>u("highlight",t)),onTextLoaded:e[3]||(e[3]=t=>u("textLoaded",t))}),null,16)):n.createCommentVNode("",!0),n.createVNode(J.default,n.mergeProps({...n.unref(c)},{onXfaLoaded:e[4]||(e[4]=t=>u("xfaLoaded"))}),null,16),n.withDirectives(n.createElementVNode("div",{ref_key:"loadingLayer",ref:y,style:{position:"absolute"}},[n.renderSlot(a.$slots,"default")],512),[[n.vShow,n.unref(_)]])],512))}});exports.default=K;
1
+ "use strict";var D=Object.defineProperty;var i=(x,k)=>D(x,"name",{value:k,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),A=require("pdfjs-dist"),z=;/* empty css */;/* empty css */const H=,/* empty css */X=;/* empty css */;/* empty css */const j=,/* empty css */I=o.defineComponent({name:"LSPdf"}),J=o.defineComponent({...I,props:{pdf:{},page:{default:1},scale:{default:1},rotation:{},fitParent:{type:Boolean},width:{},height:{},textLayer:{type:Boolean},imageResourcesPath:{},hideForms:{type:Boolean},intent:{default:"display"},annotationLayer:{type:Boolean},annotationsFilter:{},annotationsMap:{},watermarkText:{},watermarkOptions:{},highlightText:{},highlightOptions:{}},emits:["annotation","highlight","loaded","textLoaded","annotationLoaded","xfaLoaded","loadComplete","loadError","update:source"],setup(x,{expose:k,emit:S}){const n=x,s=S;o.watch(()=>n.pdf,()=>{W()},{immediate:!0,deep:!0});const p=o.ref(),g=o.ref(),P=o.ref(!1);let v;const u=o.computed(()=>({viewport:void 0,document:void 0,page:void 0})),b=o.computed(()=>({annotationsMap:n.annotationsMap,annotationsFilter:n.annotationsFilter,imageResourcesPath:n.imageResourcesPath,hideForms:n.hideForms,intent:n.intent})),T=o.computed(()=>({highlightText:n.highlightText,highlightOptions:n.highlightOptions}));function B(){return j.default({},{columns:4,rows:4,rotation:45,fontSize:18,color:"rgba(211, 210, 211, 0.4)"},n.watermarkOptions)}i(B,"getWatermarkOptionsWithDefaults");function _(a){if(!(typeof a=="number"&&a%90===0))return 0;const e=a/90;return e>4?_(a-360):e<0?_(a+360):a}i(_,"getRotation");function V(a){let e=n.scale;if(n.fitParent){const t=p.value.parentNode.clientWidth,r=a.getViewport({scale:1}).width;e=t/r}else if(n.width){const t=a.getViewport({scale:1}).width;e=n.width/t}else if(n.height){const t=a.getViewport({scale:1}).height;e=n.height/t}return e}i(V,"getScale");function E(a=1){if(!n.watermarkText)return;const e=L();if(!e)return;const t=e.getContext("2d");if(!t)return;const r=B(),c=n.watermarkText,l=r.columns,f=r.rows,d=l*f,m=r.rotation,y=r.fontSize*a;t.font=`${y}px Trebuchet MS`,t.fillStyle=r.color;for(let h=0;h<d;h++){const w=h%l*(e.width/l)+e.width/(l*2),q=Math.floor(h/l)*(e.height/f)+e.height/(f*2),$=t.measureText(c).width;t.save(),t.translate(w,q),t.rotate(-m*(Math.PI/180)),t.fillText(c,-$/2,y/2),t.restore()}}i(E,"paintWatermark");function L(){var e;let a=null;return(e=p.value)==null||e.childNodes.forEach(t=>{t.tagName==="CANVAS"&&(a=t)}),a}i(L,"getCurrentCanvas");function F(a){var c;let e;const t=L();t&&(t==null?void 0:t.getAttribute("role"))==="main"?e=t:(e=document.createElement("canvas"),e.style.display="block",e.setAttribute("dir","ltr"));const r=window.devicePixelRatio||1;return e.width=Math.floor(a.width*r),e.height=Math.floor(a.height*r),e.style.width=`${Math.floor(a.width)}px`,e.style.height=`${Math.floor(a.height)}px`,e.setAttribute("class","pdf-canvas"),(c=p.value)==null||c.style.setProperty("--scale-factor",`${a.scale}`),g.value.style.width=`${Math.floor(a.width)}px`,g.value.style.height=`${Math.floor(a.height)}px`,g.value.style.top="0",g.value.style.left="0",P.value=!0,e}i(F,"setupCanvas");function C(){v&&v.cancel()}i(C,"cancelRender");function M(a){var e;(e=o.toRaw(u.value.document))==null||e.getPage(a).then(t=>{var w;C();const r=t.getViewport(),c={scale:V(t),rotation:_((n.rotation||0)+r.rotation)},l=t.getViewport(c),f=L(),d=F(l),m=window.devicePixelRatio||1,y=m!==1?[m,0,0,m,0,0]:void 0,h={canvasContext:d.getContext("2d"),viewport:l,annotationMode:n.hideForms?A.AnnotationMode.ENABLE:A.AnnotationMode.ENABLE_FORMS,transform:y,intent:n.intent};(d==null?void 0:d.getAttribute("role"))!=="main"?f&&((w=p.value)==null||w.replaceChild(d,f)):d.removeAttribute("role"),u.value.page=t,u.value.viewport=l,v=t.render(h),v.promise.then(()=>{P.value=!1,E(l.scale),s("loaded",u.value.viewport),s("loadComplete")}).catch(()=>{s("loadError")})})}i(M,"renderPage");function N(a){a.promise&&a.promise.then(async e=>{u.value.document=e,M(n.page)})}i(N,"initDoc"),o.watch(()=>[n.page,n.scale,n.width,n.height,n.rotation,n.hideForms,n.intent],()=>{M(n.page)});function O(){M(n.page)}i(O,"reload");function R(){C()}i(R,"cancel");async function W(){if(n.pdf)try{N(n.pdf)}finally{}}return i(W,"initPdf"),k({reload:O,cancel:R}),(a,e)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"container",ref:p,style:{position:"relative",display:"block"}},[e[5]||(e[5]=o.createElementVNode("canvas",{dir:"ltr",style:{display:"block"},role:"main"},null,-1)),a.annotationLayer?(o.openBlock(),o.createBlock(z.default,o.mergeProps({key:0},{...o.unref(u),...o.unref(b)},{onAnnotation:e[0]||(e[0]=t=>s("annotation",t)),onAnnotationLoaded:e[1]||(e[1]=t=>s("annotationLoaded",t))}),null,16)):o.createCommentVNode("",!0),a.textLayer?(o.openBlock(),o.createBlock(H.default,o.mergeProps({key:1},{...o.unref(u),...o.unref(T)},{onHighlight:e[2]||(e[2]=t=>s("highlight",t)),onTextLoaded:e[3]||(e[3]=t=>s("textLoaded",t))}),null,16)):o.createCommentVNode("",!0),o.createVNode(X.default,o.mergeProps({...o.unref(u)},{onXfaLoaded:e[4]||(e[4]=t=>s("xfaLoaded"))}),null,16),o.withDirectives(o.createElementVNode("div",{ref_key:"loadingLayer",ref:g,style:{position:"absolute"}},[o.renderSlot(a.$slots,"default")],512),[[o.vShow,o.unref(P)]])],512))}});exports.default=J;