@agile-team/mach-report 2.21.1 → 2.23.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.
- package/README.md +20 -5
- package/dist/{ExcelBindingWizard-mnAO2qOX.js → ExcelBindingWizard-D4FLind-.js} +3 -3
- package/dist/{ExcelBindingWizard-Bu0LUlzl.cjs → ExcelBindingWizard-D4RS5Bpg.cjs} +1 -1
- package/dist/{ParamEditor-38ZfNrPU.cjs → ParamEditor-C-6C9rd2.cjs} +1 -1
- package/dist/{ParamEditor-C8l0EC8m.js → ParamEditor-CASZt-Ma.js} +2 -2
- package/dist/{ReportBatchPanel-CfUVhvkO.js → ReportBatchPanel-Bq7t8a5r.js} +2 -2
- package/dist/{ReportBatchPanel-nCC06Nfp.cjs → ReportBatchPanel-YVj5IO5y.cjs} +1 -1
- package/dist/ReportLabelStudio-Cqhita1b.cjs +1 -0
- package/dist/ReportLabelStudio-Dj7GXhuv.js +783 -0
- package/dist/ReportParamPanel-DZbFVmDL.cjs +1 -0
- package/dist/{ReportParamPanel-peB-KEmm.js → ReportParamPanel-Dgmqro1Y.js} +265 -244
- package/dist/ReportPreview-DeWzG8jQ.js +6257 -0
- package/dist/ReportPreview-FFIryrIr.cjs +6 -0
- package/dist/{ReportTemplateLibrary-DVlsf72p.cjs → ReportTemplateLibrary-BaWodmpm.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-B5t_EcIs.js → ReportTemplateLibrary-DdAAAD2I.js} +1 -1
- package/dist/{RuleEditor-kT1JsZ9f.js → RuleEditor-D2UwQGF6.js} +59 -59
- package/dist/{RuleEditor-xFkCVlii.cjs → RuleEditor-DcT9xI1v.cjs} +1 -1
- package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +1 -0
- package/dist/{TemplateOutlinePanel-BesgGR1P.js → TemplateOutlinePanel-DrT7XN0m.js} +2 -2
- package/dist/{TemplateReusePanel-BNFU6V-W.js → TemplateReusePanel-4eejkNqi.js} +2 -2
- package/dist/{TemplateReusePanel-BG9Or5-P.cjs → TemplateReusePanel-DZMyiX5I.cjs} +1 -1
- package/dist/{TemplateReviewPanel-CwvwyCSs.js → TemplateReviewPanel-BIhNLeNw.js} +2 -2
- package/dist/TemplateReviewPanel-DnYImiXu.cjs +1 -0
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +26 -26
- package/dist/artifact-integrity.json +108 -106
- package/dist/assets-D2gHc4Mz.cjs +1 -0
- package/dist/assets-T_gDeFaz.js +132 -0
- package/dist/auto-4pK9HePf.cjs +1 -0
- package/dist/auto-CTIJ6PnR.js +257 -0
- package/dist/capabilities-DiBj4Qgl.cjs +1 -0
- package/dist/capabilities-pg7j7VLT.js +106 -0
- package/dist/charts-Cjw5AYkg.cjs +1 -0
- package/dist/{charts-Dlv8j2AG.js → charts-CxJZ0XaY.js} +1 -1
- package/dist/computed-DK6BruFz.cjs +1 -0
- package/dist/{computed-C8NRZQss.js → computed-f3pOqWLX.js} +381 -301
- package/dist/data-bar-CeZuFmYl.cjs +1 -0
- package/dist/{data-bar-8baGYEZ9.js → data-bar-IkI6VvMQ.js} +1 -1
- package/dist/designer-DhrE7jzw.js +7169 -0
- package/dist/designer-IAZu6kBX.cjs +2 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +246 -46
- package/dist/designer.d.ts +246 -46
- package/dist/designer.js +15 -14
- package/dist/dom-ChE5D-L-.cjs +1 -0
- package/dist/dom-JWrchIre.js +452 -0
- package/dist/dom-cell-address-DLD1mkTB.cjs +1 -0
- package/dist/dom-cell-address-Fn-8nk7D.js +11 -0
- package/dist/{encoding-B79hW4zq.cjs → encoding-BefcaHdp.cjs} +1 -1
- package/dist/{encoding-BSeUwrN7.js → encoding-CL6rXEkR.js} +2 -2
- package/dist/{font-loader-Di0lQKFf.js → font-loader-BT5baV-o.js} +1 -1
- package/dist/{font-loader-BB372_XN.cjs → font-loader-Ga51c2VC.cjs} +1 -1
- package/dist/grid-strokes-Be24LGuV.cjs +1 -0
- package/dist/grid-strokes-EoY66L2f.js +53 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +44 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +961 -1256
- package/dist/json-snapshot-1tvQNzQE.cjs +2 -0
- package/dist/{json-snapshot-Kgn459Oj.js → json-snapshot-OqkPyUk5.js} +763 -776
- package/dist/matrix-B8QWbsGM.cjs +1 -0
- package/dist/matrix-C6e_r_vp.js +302 -0
- package/dist/{pdf-CARdBcuw.cjs → pdf-HiEeXe9H.cjs} +42 -42
- package/dist/{pdf-DmlnL5eB.js → pdf-aobetCsy.js} +20 -20
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BaRUGORD.cjs → plugin-BFANt-i8.cjs} +1 -1
- package/dist/{plugin-D4kAxfLG.js → plugin-DeYYAL6F.js} +1 -1
- package/dist/{prefill-CJSazcVY.js → prefill-Dk4C6S5R.js} +21 -21
- package/dist/prefill-DsUD5OoK.cjs +1 -0
- package/dist/prepared-DCIxhKFo.js +94 -0
- package/dist/prepared-Dv-XM3i1.cjs +1 -0
- package/dist/progress-ByiOxUD3.js +250 -0
- package/dist/progress-WomPRP3B.cjs +1 -0
- package/dist/{protocol-C8VWF9An.cjs → protocol-B9YgfQ_d.cjs} +1 -1
- package/dist/{protocol-Bs9-ohHN.js → protocol-DxeUKGYG.js} +3 -3
- package/dist/record-bindings-DatJZv_e.js +200 -0
- package/dist/record-bindings-MBxbeBsi.cjs +1 -0
- package/dist/{region-binding-workflow-Cy4GIOUo.js → region-binding-workflow-DjrXuR1q.js} +2 -2
- package/dist/{region-binding-workflow-JNowHd0A.cjs → region-binding-workflow-l7NGfagJ.cjs} +2 -2
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-Ciwa6D2o.js +52 -0
- package/dist/rich-text-layout-DK7A_a5r.cjs +3 -0
- package/dist/{runtime-BDf5x1i1.js → runtime-75Y5Oq5B.js} +52 -51
- package/dist/runtime-DKlGd_D4.cjs +1 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +9 -0
- package/dist/server/node.d.ts +9 -0
- package/dist/server-node.cjs +5 -4
- package/dist/server-node.js +2178 -2044
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +81 -0
- package/dist/server.d.ts +81 -0
- package/dist/server.js +24 -24
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DFwIS9aN.js → template-catalog--cjxzgH7.js} +17 -17
- package/dist/template-catalog-CoT7jm_6.cjs +1 -0
- package/dist/{template-fragments-Dng-AlHk.js → template-fragments-CPpGpQoz.js} +24 -24
- package/dist/{template-fragments-DZVUBhuB.cjs → template-fragments-GVjpew_q.cjs} +1 -1
- package/dist/template-registry-DI59PXVK.cjs +1 -0
- package/dist/{template-registry-DhBqoD7W.js → template-registry-O0hNIOfB.js} +333 -261
- package/dist/template-serialization-CWmHq7lX.js +307 -0
- package/dist/template-serialization-CqQY4zDg.cjs +1 -0
- package/dist/{textwrap-CkGjRFT3.js → textwrap-BIjtEWmq.js} +1 -1
- package/dist/textwrap-Cy7o1hIR.cjs +4 -0
- package/dist/vue/async.d.cts +121 -2
- package/dist/vue/async.d.ts +121 -2
- package/dist/vue/index.d.cts +222 -5
- package/dist/vue/index.d.ts +222 -5
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +101 -91
- package/dist/{workbook-session-NYv01LHe.cjs → workbook-session-C6-SrnCT.cjs} +4 -4
- package/dist/{workbook-session-oinxX3qo.js → workbook-session-C9ZmCBwY.js} +15 -16
- package/dist/workbook-sheets-CaPAulQ6.cjs +2 -0
- package/dist/workbook-sheets-D4M7XXBh.js +44 -0
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +9 -0
- package/dist/worker.d.ts +9 -0
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +39 -2
- package/dist/xlsx.d.ts +39 -2
- package/dist/xlsx.js +300 -275
- package/package.json +1 -1
- package/dist/ReportLabelStudio-CaEvYuSK.cjs +0 -1
- package/dist/ReportLabelStudio-DQPBmh4v.js +0 -765
- package/dist/ReportParamPanel-CVpK8mFc.cjs +0 -1
- package/dist/ReportPreview-BBJNlu2U.js +0 -5740
- package/dist/ReportPreview-nf4Dk1Jc.cjs +0 -6
- package/dist/TemplateOutlinePanel-CDI6mfWx.cjs +0 -1
- package/dist/TemplateReviewPanel-BmBrjt6P.cjs +0 -1
- package/dist/assets-CxHunY_9.js +0 -232
- package/dist/assets-vbjAGgk8.cjs +0 -1
- package/dist/auto-BkdGiNtr.js +0 -240
- package/dist/auto-Tq7ReIC1.cjs +0 -1
- package/dist/charts-aCtoswXq.cjs +0 -1
- package/dist/component-tree-1_QCiQJX.js +0 -67
- package/dist/component-tree-BjZIp6w9.cjs +0 -1
- package/dist/computed-4TnxzgIh.cjs +0 -1
- package/dist/data-bar-YltqGTaC.cjs +0 -1
- package/dist/designer-DU3yDWgs.cjs +0 -2
- package/dist/designer-HQi-03R6.js +0 -6869
- package/dist/grid-geometry-D3SJgWFv.js +0 -136
- package/dist/grid-geometry-D8ReblRV.cjs +0 -1
- package/dist/json-snapshot-I5VI84Vp.cjs +0 -2
- package/dist/matrix-0hywp0-F.cjs +0 -1
- package/dist/matrix-Dy-tyY7E.js +0 -381
- package/dist/prefill-Bpyn58AZ.cjs +0 -1
- package/dist/prepared-BiSz_9vN.cjs +0 -1
- package/dist/prepared-BwjwEzFz.js +0 -87
- package/dist/progress-B0ctFpKf.cjs +0 -1
- package/dist/progress-Hc2vxoCs.js +0 -52
- package/dist/record-bindings-Ct1HkPrc.cjs +0 -1
- package/dist/record-bindings-VZGS-Qd8.js +0 -155
- package/dist/rich-text-layout-K48VHUoW.cjs +0 -3
- package/dist/rich-text-layout-wxBhnAS7.js +0 -102
- package/dist/runtime-DsJt1PIf.cjs +0 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +0 -1
- package/dist/template-bindings-TKnXM7ll.js +0 -62
- package/dist/template-catalog-D_2jdnkL.cjs +0 -1
- package/dist/template-outline-DWkzZXVC.cjs +0 -1
- package/dist/template-outline-DiADphlq.js +0 -88
- package/dist/template-registry-DpLUSLwF.cjs +0 -1
- package/dist/template-serialization-Cc3h-miv.js +0 -247
- package/dist/template-serialization-D1R5oAqh.cjs +0 -1
- package/dist/textwrap-OTOUMr4f.cjs +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),A=require("@agile-team/mach-report"),j=require("./designer-DU3yDWgs.cjs"),O=require("@agile-team/mach-report/vue"),L=require("./template-bindings-Cg5oBLFT.cjs"),$=require("./_plugin-vue_export-helper-BLmdZLlg.cjs");function z(n,s=()=>n.fixtures){const o=e.shallowRef(),r=e.shallowRef([]),t=e.ref("20"),a=e.ref(!1),p=e.ref(!1),i=e.ref(!1),g=e.ref(""),d=e.shallowRef(),m=e.ref(!1),D=e.shallowRef(),v=e.computed(()=>new Set(n.document.template.pages.flatMap(u=>u.components).flatMap(u=>u.kind==="list"&&u.tree?[u.dataset]:[]))),B=e.computed(()=>v.value.size>0);let y=0,c;function S(){y++,c?.abort(),c=void 0,p.value=!1,m.value=!1,d.value=void 0,i.value=!!o.value,g.value=""}for(const u of[()=>n.document,()=>n.previous])e.watch(u,()=>{a.value=!1,S()},{deep:!0,flush:"sync"});for(const u of[()=>n.datasets,()=>n.dataSchemas,()=>n.formats,s])e.watch(u,S,{deep:!0,flush:"sync"});e.watch([t,a],S,{flush:"sync"}),e.onBeforeUnmount(()=>{y++,c?.abort()});const C=e.computed(()=>o.value?.issues.filter(u=>u.severity==="error").length??0);function w(){c?.abort(),c=new AbortController;const u=++y,_=c;p.value=!0,g.value="",m.value=!1,d.value=void 0,F(u,_)}async function F(u,_){try{const k=Number(t.value),M=Object.fromEntries(Object.entries(n.datasets??{}).map(([V,h])=>[V,k<0||v.value.has(V)?h:h.slice(0,k)])),b=s(),N=b?.length?[...b]:k===0?[]:[{name:t.value,datasets:M}],x=await A.reviewReportTemplateAsync(n.document,{previous:n.previous,dataSchemas:n.dataSchemas,formats:n.formats,allowBreakingChanges:a.value,...!b?.length&&B.value&&k>0?{maxSampleRows:k}:{},fixtures:N,signal:_.signal,onProgress:V=>{u===y&&(d.value=V)}});if(u!==y)return;o.value=x,i.value=!1,r.value=N,D.value={requested:t.value,rows:x.samples.reduce((V,h)=>V+h.rows,0),datasets:new Set(N.flatMap(V=>Object.keys(V.datasets))).size,formats:[...n.formats??[]]}}catch(k){u===y&&!_.signal.aborted&&(g.value=k instanceof Error?k.message:String(k))}finally{u===y&&(p.value=!1,c=void 0)}}function R(){y++,c?.abort(),c=void 0,p.value=!1,m.value=!0,d.value=void 0}return{report:o,sampleSize:t,acknowledged:a,running:p,stale:i,failure:g,checkedScope:D,checkedFixtures:r,hasTree:B,errors:C,run:w,cancel:R,progress:d,cancelled:m}}function I(n){const s=Object.getPrototypeOf(n);if(s!==Object.prototype&&s!==Array.prototype&&s!==null)throw new Error("Sample data must contain plain JSON objects");if(Object.getOwnPropertySymbols(n).length)throw new Error("Sample data must not contain symbols");if(Array.isArray(n)&&Object.keys(n).length!==n.length)throw new Error("Sample arrays must not contain holes or extra properties")}function U(n){let s=0,o=0;const r=new Set;function t(a,p){if(++s>1e5||p>32)throw new RangeError("Sample data exceeds the capture budget");if(typeof a=="string"){if(o+=a.length,o>2e6)throw new RangeError("Sample text exceeds the capture budget");return a}if(a===null||typeof a=="boolean"||typeof a=="number"&&Number.isFinite(a))return a;if(!a||typeof a!="object")throw new Error("Sample data must contain plain JSON values");const i=e.toRaw(a);if(r.has(i))throw new Error("Sample data must not contain cycles");I(i),r.add(i);const g=Array.isArray(i)?[]:Object.create(null);for(const d of Object.keys(i)){const m=Object.getOwnPropertyDescriptor(i,d);if(m.get||m.set||["__proto__","constructor","prototype"].includes(d))throw new Error("Sample data must not contain getters or unsafe keys");g[d]=t(m.value,p+1)}return r.delete(i),g}return t(n,0)}function H(n,s=()=>j.TEMPLATE_REVIEW_MESSAGES){const o=e.ref([]),r=e.ref(""),t=e.ref(!1),a=e.ref(""),p=e.ref({}),i=e.computed(()=>[...n.fixtures??[],...o.value]);function g(){a.value="";try{if(!t.value)throw new Error(s().sampleConsentMissing);if(!r.value.trim())throw new Error(s().sampleNameMissing);if(i.value.length>=20)throw new Error(s().sampleLimit);if(i.value.some(D=>D.name===r.value.trim()))throw new Error(s().sampleNameDuplicate);const m=U(n.datasets??{});if(Object.values(m).reduce((D,v)=>D+v.length,0)>1e3)throw new Error(s().sampleRowsLimit);o.value.push({name:r.value.trim(),datasets:m,...Object.keys(p.value).length?{params:{...p.value}}:{}}),r.value="",t.value=!1}catch(m){a.value=m instanceof Error?m.message:String(m)}}function d(m){o.value.splice(m,1)}return{fixtures:o,name:r,consent:t,failure:a,params:p,suite:i,capture:g,remove:d}}function P(n,s){const o=A.paginateTemplate(n.template,s.datasets,{maxPages:100,maxCells:25e4}),r=[...new Set(L.collectTemplateDatasetBindings(n.template).flatMap(t=>t.fields.map(a=>`${t.dataset}.${a.field}`)))];return{pages:o.plan.pages.length,dimensions:[...new Set(o.plan.pages.map(t=>`${t.pageWidthMm} × ${t.pageHeightMm} mm`))],fields:r,fetcher:async()=>o.plan}}function W(n,s,o){const r=P(n,s),t=o?P(o,s):void 0,a=new Set(t?.fields),p=new Set(r.fields);return{current:r,previous:t,addedFields:r.fields.filter(i=>!a.has(i)),removedFields:t?.fields.filter(i=>!p.has(i))??[]}}const G=["aria-label"],J={key:0,role:"alert"},K={class:"mr-fixture-previews"},Q={key:0},X=e.defineComponent({__name:"TemplateFixtureComparison",props:{document:{},previous:{},fixture:{},messages:{}},setup(n){const s=n,o=e.computed(()=>({...j.TEMPLATE_REVIEW_MESSAGES,...s.messages})),r=e.computed(()=>{try{return{result:W(s.document,s.fixture,s.previous)}}catch(t){return{error:t instanceof Error?t.message:String(t)}}});return(t,a)=>(e.openBlock(),e.createElementBlock("section",{class:"mr-fixture-comparison","aria-label":o.value.compare},[r.value.error?(e.openBlock(),e.createElementBlock("p",J,e.toDisplayString(r.value.error),1)):e.createCommentVNode("",!0),r.value.result?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("dl",null,[e.createElementVNode("dt",null,e.toDisplayString(o.value.pages),1),e.createElementVNode("dd",null,e.toDisplayString(r.value.result.previous?.pages??"—")+" → "+e.toDisplayString(r.value.result.current.pages),1),e.createElementVNode("dt",null,e.toDisplayString(o.value.dimensions),1),e.createElementVNode("dd",null,e.toDisplayString(r.value.result.previous?.dimensions.join(" / ")??"—")+" → "+e.toDisplayString(r.value.result.current.dimensions.join(" / ")),1),e.createElementVNode("dt",null,e.toDisplayString(o.value.fieldsAdded),1),e.createElementVNode("dd",null,e.toDisplayString(r.value.result.addedFields.join("、")||"—"),1),e.createElementVNode("dt",null,e.toDisplayString(o.value.fieldsRemoved),1),e.createElementVNode("dd",null,e.toDisplayString(r.value.result.removedFields.join("、")||"—"),1)]),e.createElementVNode("div",K,[r.value.result.previous?(e.openBlock(),e.createElementBlock("article",Q,[e.createElementVNode("h4",null,e.toDisplayString(o.value.baselinePreview),1),e.createVNode(e.unref(O.ReportPreview),{"report-id":"baseline",fetcher:r.value.result.previous.fetcher,"show-params":!1,"show-export":!1,"show-print":!1,"show-pdf-window":!1,editable:!1,"excel-import":!1,height:"400px"},null,8,["fetcher"])])):e.createCommentVNode("",!0),e.createElementVNode("article",null,[e.createElementVNode("h4",null,e.toDisplayString(o.value.draftPreview),1),e.createVNode(e.unref(O.ReportPreview),{"report-id":"draft",fetcher:r.value.result.current.fetcher,"show-params":!1,"show-export":!1,"show-print":!1,"show-pdf-window":!1,editable:!1,"excel-import":!1,height:"400px"},null,8,["fetcher"])])])],64)):e.createCommentVNode("",!0)],8,G))}}),Y=$._export_sfc(X,[["__scopeId","data-v-211ee4bf"]]),Z=["aria-label","aria-busy"],ee={key:0,role:"status"},te=["disabled"],le={key:0,class:"mr-review-stale",role:"status"},ne={class:"mr-review-controls"},re=["aria-label","disabled"],oe={value:"0"},ae={value:"20"},se={value:"100"},ie={value:"-1"},ce={key:0,class:"mr-review-note"},ue={class:"mr-review-fixtures"},de={class:"mr-review-note"},me={key:0},pe=["disabled","onClick"],fe={class:"mr-review-fixture-form"},ve=["placeholder","disabled"],ge={key:0},ye=["onUpdate:modelValue","placeholder","disabled"],ke={class:"mr-review-consent"},he=["disabled"],Ee=["disabled"],Se={key:1,role:"alert",class:"is-error"},we={key:1,class:"mr-review-note"},Ve={key:2,class:"is-error",role:"alert"},Ne={key:3,class:"mr-review-stale",role:"status"},De={key:4,class:"mr-review-note"},_e={key:0,class:"mr-review-summary",role:"status"},be={key:0,class:"mr-review-note"},Be={key:1,class:"mr-review-note"},xe={key:2,class:"mr-review-list"},Ce={key:0},Te=["onClick"],Fe={key:3,class:"mr-review-note"},Re={key:4,class:"mr-review-ack"},Me={key:0,class:"mr-review-note"},je={key:1,class:"mr-review-list"},Oe=["onClick"],Pe={key:0,class:"mr-review-scope"},Ae={key:0},$e=["disabled","onClick"],qe={class:"mr-review-note"},Le=e.defineComponent({__name:"TemplateReviewPanel",props:{document:{},previous:{},datasets:{},dataSchemas:{},formats:{},fixtures:{},messages:{}},emits:["locate"],setup(n,{emit:s}){const o=n,r=s,t=e.computed(()=>({...j.TEMPLATE_REVIEW_MESSAGES,...o.messages})),{name:a,consent:p,failure:i,params:g,suite:d,capture:m,remove:D}=H(o,()=>t.value),{report:v,sampleSize:B,acknowledged:y,running:c,stale:S,failure:C,checkedScope:w,checkedFixtures:F,hasTree:R,errors:u,run:_,cancel:k,cancelled:M,progress:b}=z(o,()=>d.value),N=e.ref(),x=e.computed(()=>F.value.find(h=>h.name===N.value));e.watch(S,h=>{h&&(N.value=void 0)});function V(h){const f=/\.pages\[(\d+)\]\.components\[(\d+)\]/.exec(h);r("locate",{path:h,...f?{pageIndex:Number(f[1]),componentIndex:Number(f[2])}:{}})}return(h,f)=>(e.openBlock(),e.createElementBlock("section",{class:"mr-template-review","aria-label":t.value.title,"aria-busy":e.unref(c)},[e.createElementVNode("header",null,[e.createElementVNode("strong",null,e.toDisplayString(t.value.title),1),e.unref(c)&&e.unref(b)?(e.openBlock(),e.createElementBlock("span",ee,e.toDisplayString(e.unref(b).completed)+" / "+e.toDisplayString(e.unref(b).total)+" "+e.toDisplayString(t.value.progress),1)):e.createCommentVNode("",!0),e.unref(c)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:f[0]||(f[0]=(...l)=>e.unref(k)&&e.unref(k)(...l))},e.toDisplayString(t.value.cancel),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",disabled:e.unref(c),onClick:f[1]||(f[1]=(...l)=>e.unref(_)&&e.unref(_)(...l))},e.toDisplayString(e.unref(c)?t.value.running:t.value.run),9,te)]),e.unref(M)?(e.openBlock(),e.createElementBlock("p",le,e.toDisplayString(t.value.cancelled),1)):e.createCommentVNode("",!0),e.createElementVNode("div",ne,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(t.value.samples),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":f[2]||(f[2]=l=>e.isRef(B)?B.value=l:null),"aria-label":t.value.samples,disabled:e.unref(c)||!!e.unref(d).length},[e.createElementVNode("option",oe,e.toDisplayString(t.value.none),1),e.createElementVNode("option",ae,e.toDisplayString(t.value.first20),1),e.createElementVNode("option",se,e.toDisplayString(t.value.first100),1),e.createElementVNode("option",ie,e.toDisplayString(t.value.all),1)],8,re),[[e.vModelSelect,e.unref(B)]])]),e.unref(d).length?(e.openBlock(),e.createElementBlock("span",ce,e.toDisplayString(t.value.namedFixtures)+" · "+e.toDisplayString(e.unref(d).length),1)):e.createCommentVNode("",!0)]),e.createElementVNode("details",ue,[e.createElementVNode("summary",null,[e.createTextVNode(e.toDisplayString(t.value.namedFixtures)+" ",1),e.createElementVNode("small",null,e.toDisplayString(e.unref(d).length)+" / 20",1)]),e.createElementVNode("p",de,e.toDisplayString(t.value.fixtureHint),1),e.unref(d).length?(e.openBlock(),e.createElementBlock("ul",me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(d),(l,E)=>(e.openBlock(),e.createElementBlock("li",{key:l.name},[e.createElementVNode("strong",null,e.toDisplayString(l.name),1),e.createElementVNode("span",null,e.toDisplayString(Object.values(l.datasets).reduce((T,q)=>T+q.length,0))+" "+e.toDisplayString(t.value.rows),1),E>=(n.fixtures?.length??0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",disabled:e.unref(c),onClick:T=>e.unref(D)(E-(n.fixtures?.length??0))},e.toDisplayString(t.value.remove),9,pe)):e.createCommentVNode("",!0)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",fe,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(t.value.fixtureName),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[3]||(f[3]=l=>e.isRef(a)?a.value=l:null),placeholder:t.value.fixturePlaceholder,disabled:e.unref(c)},null,8,ve),[[e.vModelText,e.unref(a)]])]),n.document.template.params?.length?(e.openBlock(),e.createElementBlock("details",ge,[e.createElementVNode("summary",null,e.toDisplayString(t.value.parameters),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.document.template.params,l=>(e.openBlock(),e.createElementBlock("label",{key:l.field},[e.createTextVNode(e.toDisplayString(l.label??l.field),1),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":E=>e.unref(g)[l.field]=E,placeholder:l.defaultValue,disabled:e.unref(c)},null,8,ye),[[e.vModelText,e.unref(g)[l.field]]])]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("label",ke,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[4]||(f[4]=l=>e.isRef(p)?p.value=l:null),type:"checkbox",disabled:e.unref(c)},null,8,he),[[e.vModelCheckbox,e.unref(p)]]),e.createTextVNode(e.toDisplayString(t.value.deidentified),1)]),e.createElementVNode("button",{type:"button",disabled:e.unref(c)||!e.unref(p)||!e.unref(a).trim()||e.unref(d).length>=20,onClick:f[5]||(f[5]=(...l)=>e.unref(m)&&e.unref(m)(...l))},e.toDisplayString(t.value.capture),9,Ee),e.unref(i)?(e.openBlock(),e.createElementBlock("p",Se,e.toDisplayString(e.unref(i)),1)):e.createCommentVNode("",!0)])]),e.unref(R)?(e.openBlock(),e.createElementBlock("p",we,e.toDisplayString(t.value.treeHint),1)):e.createCommentVNode("",!0),e.unref(C)?(e.openBlock(),e.createElementBlock("p",Ve,e.toDisplayString(e.unref(C)),1)):e.createCommentVNode("",!0),e.unref(S)?(e.openBlock(),e.createElementBlock("p",Ne,e.toDisplayString(t.value.stale),1)):e.createCommentVNode("",!0),e.unref(v)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:5},[e.unref(S)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":e.unref(u)})},e.toDisplayString(e.unref(u))+" "+e.toDisplayString(t.value.errors),3),e.createElementVNode("span",null,e.toDisplayString(e.unref(v).issues.length-e.unref(u))+" "+e.toDisplayString(t.value.warnings),1)])),e.createElementVNode("section",null,[e.createElementVNode("h3",null,[e.createTextVNode(e.toDisplayString(t.value.changes)+" ",1),e.createElementVNode("small",null,e.toDisplayString(e.unref(v).changes?.totalChanges??0),1)]),n.previous?e.unref(v).changes?.totalChanges?(e.openBlock(),e.createElementBlock("ol",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v).changes?.changes,(l,E)=>(e.openBlock(),e.createElementBlock("li",{key:E},[e.createElementVNode("div",null,[e.createElementVNode("span",null,e.toDisplayString(t.value.categories[l.category])+" · "+e.toDisplayString(t.value.kinds[l.kind]),1),l.breaking?(e.openBlock(),e.createElementBlock("b",Ce,e.toDisplayString(t.value.breaking),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",onClick:T=>V(l.path)},e.toDisplayString(t.value.locate),9,Te)]),e.createElementVNode("code",null,e.toDisplayString(l.path),1),e.createElementVNode("dl",null,[l.before!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("dt",null,e.toDisplayString(t.value.before),1),e.createElementVNode("dd",null,e.toDisplayString(l.before),1)],64)):e.createCommentVNode("",!0),l.after!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("dt",null,e.toDisplayString(t.value.after),1),e.createElementVNode("dd",null,e.toDisplayString(l.after),1)],64)):e.createCommentVNode("",!0)])]))),128))])):(e.openBlock(),e.createElementBlock("p",Be,e.toDisplayString(t.value.noChanges),1)):(e.openBlock(),e.createElementBlock("p",be,e.toDisplayString(t.value.baseline),1)),e.unref(v).changes?.truncated?(e.openBlock(),e.createElementBlock("p",Fe,e.toDisplayString(t.value.truncated),1)):e.createCommentVNode("",!0),e.unref(v).changes?.breakingChanges?(e.openBlock(),e.createElementBlock("label",Re,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":f[6]||(f[6]=l=>e.isRef(y)?y.value=l:null),type:"checkbox"},null,512),[[e.vModelCheckbox,e.unref(y)]]),e.createTextVNode(e.toDisplayString(t.value.acknowledge),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("section",null,[e.createElementVNode("h3",null,e.toDisplayString(t.value.issues),1),e.unref(v).issues.length?(e.openBlock(),e.createElementBlock("ol",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v).issues,(l,E)=>(e.openBlock(),e.createElementBlock("li",{key:E},[e.createElementVNode("div",null,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":l.severity==="error"})},e.toDisplayString(l.severity==="error"?t.value.errors:t.value.warnings),3),e.createElementVNode("button",{type:"button",onClick:T=>r("locate",l)},e.toDisplayString(t.value.locate),9,Oe)]),e.createElementVNode("p",null,e.toDisplayString(l.message),1),e.createElementVNode("code",null,e.toDisplayString(l.path),1)]))),128))])):(e.openBlock(),e.createElementBlock("p",Me,e.toDisplayString(t.value.noIssues),1))]),e.unref(v).samples.length?(e.openBlock(),e.createElementBlock("section",{key:1,class:e.normalizeClass({"is-stale":e.unref(S)})},[e.createElementVNode("h3",null,e.toDisplayString(t.value.results),1),e.unref(w)?(e.openBlock(),e.createElementBlock("p",Pe,[e.createTextVNode(e.toDisplayString(t.value.scope)+" · "+e.toDisplayString(e.unref(d).length?t.value.namedFixtures:e.unref(w).requested==="-1"?t.value.all:e.unref(w).requested==="0"?t.value.none:e.unref(w).requested+" "+t.value.rows)+" · "+e.toDisplayString(e.unref(w).datasets)+" "+e.toDisplayString(t.value.datasets)+" · "+e.toDisplayString(e.unref(w).rows)+" "+e.toDisplayString(t.value.rows),1),e.unref(w).formats.length?(e.openBlock(),e.createElementBlock("span",Ae," · "+e.toDisplayString(e.unref(w).formats.join(" / ")),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v).samples,l=>(e.openBlock(),e.createElementBlock("div",{key:l.name,class:"mr-review-sample"},[e.createElementVNode("p",null,[e.createElementVNode("strong",null,e.toDisplayString(l.name),1),e.createTextVNode(" · "+e.toDisplayString(l.rows)+" "+e.toDisplayString(t.value.rows)+" · "+e.toDisplayString(l.pages)+" "+e.toDisplayString(t.value.pages)+" · "+e.toDisplayString(e.unref(v).issues.filter(E=>E.fixture===l.name).length)+" "+e.toDisplayString(t.value.issues),1)]),e.createElementVNode("button",{type:"button",disabled:e.unref(S)||e.unref(c),onClick:E=>N.value=N.value===l.name?void 0:l.name},e.toDisplayString(N.value===l.name?t.value.closeCompare:t.value.compare),9,$e)]))),128))],2)):e.createCommentVNode("",!0),x.value&&!e.unref(S)?(e.openBlock(),e.createBlock(Y,{key:2,document:n.document,previous:n.previous,fixture:x.value,messages:n.messages},null,8,["document","previous","fixture","messages"])):e.createCommentVNode("",!0),e.createElementVNode("p",qe,e.toDisplayString(t.value.checked),1)],64)):(e.openBlock(),e.createElementBlock("p",De,e.toDisplayString(t.value.empty),1))],8,Z))}}),ze=$._export_sfc(Le,[["__scopeId","data-v-0a5dda64"]]);exports.default=ze;
|
package/dist/assets-CxHunY_9.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { b as D, i as O, v as P } from "./component-tree-1_QCiQJX.js";
|
|
2
|
-
import { r as R } from "./grid-geometry-D3SJgWFv.js";
|
|
3
|
-
import { b as h, a as C, w as L } from "./progress-Hc2vxoCs.js";
|
|
4
|
-
import { c as j, I } from "./media-Y90dHK9z.js";
|
|
5
|
-
function x(e, t) {
|
|
6
|
-
h(t.signal), C(() => t.onDiagnostic?.(e)), h(t.signal);
|
|
7
|
-
}
|
|
8
|
-
class k extends Error {
|
|
9
|
-
constructor(t) {
|
|
10
|
-
super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`), this.diagnostics = t, this.code = "output-fidelity", this.name = "OutputFidelityError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const T = /* @__PURE__ */ new Set(["text", "rect", "line", "ellipse"]), X = /* @__PURE__ */ new Set(["image", "chart", "barcode", "qrcode"]);
|
|
14
|
-
function G(e, t) {
|
|
15
|
-
if (!e.grid) {
|
|
16
|
-
if (O(e))
|
|
17
|
-
return (t === "pdf" || t === "xlsx") && !/^data:image\/(png|jpe?g);base64,/i.test(e.imageData) ? { code: "unsupported-image-format", message: `${t.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.` } : void 0;
|
|
18
|
-
if (X.has(e.kind)) return { code: "missing-image", message: `${e.kind} requires imageData or a renderer adapter before output.` };
|
|
19
|
-
if (!T.has(e.kind)) return { code: "unsupported-component", message: `Unsupported component kind: ${e.kind}.` };
|
|
20
|
-
if (t === "xlsx" && e.kind !== "text") return { code: "unsupported-component", message: `XLSX data export omits ${e.kind} geometry.` };
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function p(e, t, n, s, i) {
|
|
24
|
-
const r = Object.getOwnPropertyDescriptor(e, "meta")?.value, a = r && Object.getOwnPropertyDescriptor(r, "componentExtension")?.value, o = a && Object.getOwnPropertyDescriptor(a, "id")?.value, d = a && Object.getOwnPropertyDescriptor(a, "version")?.value, c = typeof o == "string" && o.length <= 128 && typeof d == "string" && d.length <= 64 ? { id: o, version: d } : void 0;
|
|
25
|
-
return { ...i, severity: "warning", format: t, pageIndex: n, componentIndex: s, kind: e.kind, nid: e.nid, ...c ? { extension: c } : {} };
|
|
26
|
-
}
|
|
27
|
-
function b(e, t) {
|
|
28
|
-
if (!e || t === "dom") return;
|
|
29
|
-
const n = [];
|
|
30
|
-
return e.rotateDeg && n.push("rotateDeg"), e.opacity !== void 0 && e.opacity !== 1 && n.push("opacity"), t !== "xlsx" && e.align === "justify" && n.push("justify"), t === "xlsx" && e.letterSpacing && n.push("letterSpacing"), n.length ? `${t} does not preserve these styles: ${n.join(", ")}.` : void 0;
|
|
31
|
-
}
|
|
32
|
-
function S(e) {
|
|
33
|
-
if (!e) return;
|
|
34
|
-
const t = ["backgroundColor", "align", "verticalAlign", "lineHeight", "borderTop", "borderRight", "borderBottom", "borderLeft", "borderColor", "lineColor", "lineWidthPt"].filter((n) => e[n] !== void 0);
|
|
35
|
-
return t.length ? `XLSX rich text does not retain independent run styles: ${t.join(", ")}.` : void 0;
|
|
36
|
-
}
|
|
37
|
-
function F(e) {
|
|
38
|
-
if (e.kind !== "text") return;
|
|
39
|
-
const t = S(e.style);
|
|
40
|
-
if (e.leftMm || e.topMm || t) return { code: "unsupported-style", message: `Nested XLSX text is retained as rich text in component order; absolute child offsets and independent paragraph styles are not retained.${t ? ` ${t}` : ""}` };
|
|
41
|
-
}
|
|
42
|
-
function A(e, t, n, s, i, r) {
|
|
43
|
-
const a = (o) => {
|
|
44
|
-
i.push({ ...p(e, t, n, s, { code: "unsupported-style", message: o }), componentPath: r });
|
|
45
|
-
};
|
|
46
|
-
for (const o of e.richParagraphs ?? []) {
|
|
47
|
-
t === "xlsx" && (o.spaceBeforeMm || o.spaceAfterMm || o.indentMm || o.align || o.lineHeight) && a("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");
|
|
48
|
-
const d = b({ align: o.align }, t);
|
|
49
|
-
d && a(d);
|
|
50
|
-
for (const c of o.segments) {
|
|
51
|
-
const u = b(c.style, t) ?? (t === "xlsx" ? S(c.style) : void 0);
|
|
52
|
-
u && a(u);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function $(e, t, n, s, i, r, a) {
|
|
57
|
-
if (a.has(e)) return;
|
|
58
|
-
const o = new Set(a).add(e), d = G(e, t);
|
|
59
|
-
d && r.push({ ...p(e, t, n, s, d), componentPath: i });
|
|
60
|
-
const c = b(e.style, t);
|
|
61
|
-
c && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: c }), componentPath: i }), A(e, t, n, s, r, i), q(e, t, n, s, i, r, o);
|
|
62
|
-
}
|
|
63
|
-
function N(e, t, n) {
|
|
64
|
-
if (e.grid) return { code: "nested-components-omitted", message: "XLSX cannot place a nested grid inside a single cell; the nested grid is omitted." };
|
|
65
|
-
const s = F(e);
|
|
66
|
-
if (s) return s;
|
|
67
|
-
if (O(e) && (e.leftMm < 0 || e.topMm < 0 || e.leftMm + e.widthMm > t + 1e-3 || e.topMm + e.heightMm > n + 1e-3)) return { code: "unsupported-style", message: "XLSX cannot clip a child image to a cell; it retains the original image dimensions." };
|
|
68
|
-
}
|
|
69
|
-
function U(e) {
|
|
70
|
-
let t;
|
|
71
|
-
return (n, s, i, r) => {
|
|
72
|
-
t ??= new Map(R(e.grid, e.widthMm, e.heightMm).cells.map((d) => [`${d.ri}:${d.ci}`, d]));
|
|
73
|
-
const a = t.get(`${s}:${i}`), o = 2 * (e.grid?.paddingMm ?? 0.5);
|
|
74
|
-
return N(n, (a?.widthMm ?? 0) - o - (r?.indentMm ?? 0), (a?.heightMm ?? 0) - o);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function q(e, t, n, s, i, r, a) {
|
|
78
|
-
const o = U(e);
|
|
79
|
-
for (const [d, c] of (e.grid?.cells ?? []).entries()) for (const [u, g] of c.entries()) {
|
|
80
|
-
g?.dataBar !== void 0 && !P(g.dataBar) && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: "Invalid resolved data-bar geometry or color; visual data bars require ordered 0–1 ratios and #RRGGBB colors." }), componentPath: [...i, d, u] });
|
|
81
|
-
const l = b(g?.style, t);
|
|
82
|
-
l && r.push({ ...p(e, t, n, s, { code: "unsupported-style", message: l }), componentPath: [...i, d, u] }), g?.richParagraphs?.length && A({ ...e, richParagraphs: g.richParagraphs }, t, n, s, r, [...i, d, u]);
|
|
83
|
-
for (const [f, m] of (g?.children ?? []).entries()) {
|
|
84
|
-
const M = [...i, d, u, f];
|
|
85
|
-
if (t === "xlsx") {
|
|
86
|
-
const E = o(m, d, u, g);
|
|
87
|
-
if (E && r.push({ ...p(m, t, n, s, E), componentPath: M }), m.grid) continue;
|
|
88
|
-
}
|
|
89
|
-
$(m, t, n, s, M, r, a);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
function H(e, t) {
|
|
94
|
-
D(e);
|
|
95
|
-
const n = [];
|
|
96
|
-
return e.pages.forEach((s, i) => s.components.forEach((r, a) => $(r, t, i, a, [], n, /* @__PURE__ */ new Set()))), n;
|
|
97
|
-
}
|
|
98
|
-
function ne(e, t, n) {
|
|
99
|
-
h(n.signal);
|
|
100
|
-
const s = H(e, t);
|
|
101
|
-
if (s.forEach((i) => x(i, n)), n.fidelity === "strict" && s.length) throw new k(s);
|
|
102
|
-
return s;
|
|
103
|
-
}
|
|
104
|
-
class v extends Error {
|
|
105
|
-
constructor(t, n) {
|
|
106
|
-
super(t.message), this.name = "OutputAssetError", this.diagnostic = t, this.cause = n;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function w(e) {
|
|
110
|
-
if (e.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
111
|
-
}
|
|
112
|
-
function K(e) {
|
|
113
|
-
const t = { maxAssets: 1e3, maxImageBytes: 33554432, maxTotalImageBytes: 134217728, maxDurationMs: 3e4, ...e.assetBudget };
|
|
114
|
-
for (const [n, s] of Object.entries(t))
|
|
115
|
-
if (!Number.isSafeInteger(s) || s <= 0 || s > 2147483647) throw new RangeError(`${n} must be a positive safe integer at most 2147483647.`);
|
|
116
|
-
return t;
|
|
117
|
-
}
|
|
118
|
-
function W(e) {
|
|
119
|
-
const t = /^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);
|
|
120
|
-
if (!t) throw new TypeError("Asset renderers must return an image data URL.");
|
|
121
|
-
return t[1] ? Math.ceil(t[2].length * 3 / 4) : new TextEncoder().encode(decodeURIComponent(t[2])).byteLength;
|
|
122
|
-
}
|
|
123
|
-
function y(e, t, n, s, i) {
|
|
124
|
-
const r = { code: n, message: s, severity: "warning", format: e.options.format ?? "dom", pageIndex: t.pageIndex, componentIndex: t.componentIndex, componentPath: t.componentPath, kind: t.component.kind, nid: t.component.nid };
|
|
125
|
-
if (e.diagnostics.push(r), x(r, { ...e.options, signal: e.signal }), e.options.assetFailure !== "placeholder") throw new v(r, i);
|
|
126
|
-
}
|
|
127
|
-
async function _(e, t, n) {
|
|
128
|
-
const s = e.options.assetRegistry?.rendererFor(t) ?? e.options.assetRenderers?.[t.kind];
|
|
129
|
-
if (t.imageData || !s) return t.imageData;
|
|
130
|
-
if (++e.rendered > e.budget.maxAssets) return y(e, n, "asset-budget-exceeded", "Output exceeded the asset count budget.");
|
|
131
|
-
let i;
|
|
132
|
-
try {
|
|
133
|
-
if (e.active = n, i = await L(s({ ...n, signal: e.signal }), e.signal), w(e.signal), i.length > e.budget.maxImageBytes * 4 + 1024) return y(e, n, "asset-budget-exceeded", "Output exceeded the image payload byte budget.");
|
|
134
|
-
const r = W(i);
|
|
135
|
-
if (r > e.budget.maxImageBytes || e.bytes + r > e.budget.maxTotalImageBytes) return y(e, n, "asset-budget-exceeded", "Output exceeded the encoded image byte budget.");
|
|
136
|
-
/^data:image\/(png|jpe?g);base64,/i.test(i) && e.inspectImage(i), e.bytes += r;
|
|
137
|
-
} catch (r) {
|
|
138
|
-
if (e.signal.aborted || r instanceof v || r instanceof I && r.code === "image-budget-exceeded") throw r;
|
|
139
|
-
return y(e, n, "asset-render-failed", `Asset renderer failed for ${t.kind}; output was not silently omitted.`, r);
|
|
140
|
-
}
|
|
141
|
-
return i;
|
|
142
|
-
}
|
|
143
|
-
function z(e, t) {
|
|
144
|
-
const n = e.active;
|
|
145
|
-
if (!n) {
|
|
146
|
-
t.abort(new Error("Asset rendering exceeded maxDurationMs."));
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const s = { code: "asset-budget-exceeded", message: "Asset rendering exceeded maxDurationMs.", severity: "warning", format: e.options.format ?? "dom", pageIndex: n.pageIndex, componentIndex: n.componentIndex, componentPath: n.componentPath, kind: n.component.kind, nid: n.component.nid };
|
|
150
|
-
e.diagnostics.push(s);
|
|
151
|
-
try {
|
|
152
|
-
x(s, { ...e.options, signal: e.signal });
|
|
153
|
-
} catch (i) {
|
|
154
|
-
t.abort(i);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
t.abort(new v(s));
|
|
158
|
-
}
|
|
159
|
-
async function J(e, t, n, s, i) {
|
|
160
|
-
if (!t?.children?.length) return t;
|
|
161
|
-
const r = [];
|
|
162
|
-
for (const [a, o] of t.children.entries())
|
|
163
|
-
r.push(await B(e, o, { ...n, component: o, componentPath: [...s, a] }, i));
|
|
164
|
-
return r.some((a, o) => a !== t.children[o]) ? { ...t, children: r } : t;
|
|
165
|
-
}
|
|
166
|
-
async function B(e, t, n, s) {
|
|
167
|
-
if (w(e.signal), s.has(t)) throw new TypeError("Cyclic grid children cannot be rendered.");
|
|
168
|
-
let i = e.cache.get(t);
|
|
169
|
-
i || (i = _(e, t, n), e.cache.set(t, i));
|
|
170
|
-
const r = await i;
|
|
171
|
-
w(e.signal);
|
|
172
|
-
let a = t.grid;
|
|
173
|
-
if (a) {
|
|
174
|
-
const o = new Set(s).add(t), d = [];
|
|
175
|
-
for (const [c, u] of a.cells.entries()) {
|
|
176
|
-
const g = [];
|
|
177
|
-
for (const [l, f] of u.entries()) g.push(await J(e, f, n, [...n.componentPath, c, l], o));
|
|
178
|
-
d.push(g);
|
|
179
|
-
}
|
|
180
|
-
d.some((c, u) => c.some((g, l) => g !== a.cells[u][l])) && (a = { ...a, cells: d });
|
|
181
|
-
}
|
|
182
|
-
return r !== t.imageData || a !== t.grid ? { ...t, imageData: r, grid: a } : t;
|
|
183
|
-
}
|
|
184
|
-
function V(e, t, n) {
|
|
185
|
-
const s = /* @__PURE__ */ new Set(), i = (r) => {
|
|
186
|
-
if (h(n), !s.has(r)) {
|
|
187
|
-
if (s.add(r), r.imageData && /^data:image\/(png|jpe?g);base64,/i.test(r.imageData))
|
|
188
|
-
try {
|
|
189
|
-
t(r.imageData);
|
|
190
|
-
} catch (a) {
|
|
191
|
-
if (!(a instanceof I) || a.code === "image-budget-exceeded") throw a;
|
|
192
|
-
}
|
|
193
|
-
for (const a of r.grid?.cells ?? []) for (const o of a) for (const d of o?.children ?? []) i(d);
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
for (const r of e.pages) for (const a of r.components) i(a);
|
|
197
|
-
}
|
|
198
|
-
function Q(e) {
|
|
199
|
-
if (e.options.fidelity === "strict" && e.diagnostics.length) throw new k(e.diagnostics);
|
|
200
|
-
}
|
|
201
|
-
async function re(e, t = {}) {
|
|
202
|
-
h(t.signal), D(e);
|
|
203
|
-
const n = K(t), s = j(t);
|
|
204
|
-
if (V(e, s, t.signal), t.signal?.aborted) throw t.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
205
|
-
const i = new AbortController(), r = () => i.abort(t.signal?.reason);
|
|
206
|
-
if (t.signal?.addEventListener("abort", r, { once: !0 }), !t.assetRegistry && (!t.assetRenderers || !Object.keys(t.assetRenderers).length))
|
|
207
|
-
return t.signal?.removeEventListener("abort", r), { plan: e, diagnostics: [] };
|
|
208
|
-
const a = { options: t, signal: i.signal, diagnostics: [], rendered: 0, bytes: 0, budget: n, cache: /* @__PURE__ */ new WeakMap(), inspectImage: s }, o = setTimeout(() => z(a, i), n.maxDurationMs);
|
|
209
|
-
try {
|
|
210
|
-
const d = [];
|
|
211
|
-
for (const [c, u] of e.pages.entries()) {
|
|
212
|
-
if (c < (t.start ?? 0) || c > (t.end ?? e.pages.length - 1)) {
|
|
213
|
-
d.push(u);
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
const g = [];
|
|
217
|
-
for (const [l, f] of u.components.entries()) g.push(await B(a, f, { component: f, pageIndex: c, componentIndex: l, componentPath: [] }, /* @__PURE__ */ new Set()));
|
|
218
|
-
d.push(g.some((l, f) => l !== u.components[f]) ? { ...u, components: g } : u);
|
|
219
|
-
}
|
|
220
|
-
return w(a.signal), Q(a), { plan: d.some((c, u) => c !== e.pages[u]) ? { ...e, pages: d } : e, diagnostics: a.diagnostics };
|
|
221
|
-
} finally {
|
|
222
|
-
clearTimeout(o), t.signal?.removeEventListener("abort", r);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export {
|
|
226
|
-
k as O,
|
|
227
|
-
re as a,
|
|
228
|
-
v as b,
|
|
229
|
-
H as i,
|
|
230
|
-
x as n,
|
|
231
|
-
ne as r
|
|
232
|
-
};
|
package/dist/assets-vbjAGgk8.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=require("./component-tree-BjZIp6w9.cjs"),P=require("./grid-geometry-D8ReblRV.cjs"),f=require("./progress-B0ctFpKf.cjs"),E=require("./media-B7vnpD8k.cjs");function v(e,t){f.assertOutputActive(t.signal),f.observeOutput(()=>t.onDiagnostic?.(e)),f.assertOutputActive(t.signal)}class M extends Error{constructor(t){super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`),this.diagnostics=t,this.code="output-fidelity",this.name="OutputFidelityError"}}const C=new Set(["text","rect","line","ellipse"]),R=new Set(["image","chart","barcode","qrcode"]);function T(e,t){if(!e.grid){if(m.isImageBackedComponent(e))return(t==="pdf"||t==="xlsx")&&!/^data:image\/(png|jpe?g);base64,/i.test(e.imageData)?{code:"unsupported-image-format",message:`${t.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.`}:void 0;if(R.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!C.has(e.kind))return{code:"unsupported-component",message:`Unsupported component kind: ${e.kind}.`};if(t==="xlsx"&&e.kind!=="text")return{code:"unsupported-component",message:`XLSX data export omits ${e.kind} geometry.`}}}function h(e,t,n,s,i){const r=Object.getOwnPropertyDescriptor(e,"meta")?.value,o=r&&Object.getOwnPropertyDescriptor(r,"componentExtension")?.value,a=o&&Object.getOwnPropertyDescriptor(o,"id")?.value,d=o&&Object.getOwnPropertyDescriptor(o,"version")?.value,c=typeof a=="string"&&a.length<=128&&typeof d=="string"&&d.length<=64?{id:a,version:d}:void 0;return{...i,severity:"warning",format:t,pageIndex:n,componentIndex:s,kind:e.kind,nid:e.nid,...c?{extension:c}:{}}}function w(e,t){if(!e||t==="dom")return;const n=[];return e.rotateDeg&&n.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&n.push("opacity"),t!=="xlsx"&&e.align==="justify"&&n.push("justify"),t==="xlsx"&&e.letterSpacing&&n.push("letterSpacing"),n.length?`${t} does not preserve these styles: ${n.join(", ")}.`:void 0}function A(e){if(!e)return;const t=["backgroundColor","align","verticalAlign","lineHeight","borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"].filter(n=>e[n]!==void 0);return t.length?`XLSX rich text does not retain independent run styles: ${t.join(", ")}.`:void 0}function L(e){if(e.kind!=="text")return;const t=A(e.style);if(e.leftMm||e.topMm||t)return{code:"unsupported-style",message:`Nested XLSX text is retained as rich text in component order; absolute child offsets and independent paragraph styles are not retained.${t?` ${t}`:""}`}}function k(e,t,n,s,i,r){const o=a=>{i.push({...h(e,t,n,s,{code:"unsupported-style",message:a}),componentPath:r})};for(const a of e.richParagraphs??[]){t==="xlsx"&&(a.spaceBeforeMm||a.spaceAfterMm||a.indentMm||a.align||a.lineHeight)&&o("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");const d=w({align:a.align},t);d&&o(d);for(const c of a.segments){const u=w(c.style,t)??(t==="xlsx"?A(c.style):void 0);u&&o(u)}}}function S(e,t,n,s,i,r,o){if(o.has(e))return;const a=new Set(o).add(e),d=T(e,t);d&&r.push({...h(e,t,n,s,d),componentPath:i});const c=w(e.style,t);c&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:c}),componentPath:i}),k(e,t,n,s,r,i),G(e,t,n,s,i,r,a)}function j(e,t,n){if(e.grid)return{code:"nested-components-omitted",message:"XLSX cannot place a nested grid inside a single cell; the nested grid is omitted."};const s=L(e);if(s)return s;if(m.isImageBackedComponent(e)&&(e.leftMm<0||e.topMm<0||e.leftMm+e.widthMm>t+.001||e.topMm+e.heightMm>n+.001))return{code:"unsupported-style",message:"XLSX cannot clip a child image to a cell; it retains the original image dimensions."}}function X(e){let t;return(n,s,i,r)=>{t??=new Map(P.resolveGridLayout(e.grid,e.widthMm,e.heightMm).cells.map(d=>[`${d.ri}:${d.ci}`,d]));const o=t.get(`${s}:${i}`),a=2*(e.grid?.paddingMm??.5);return j(n,(o?.widthMm??0)-a-(r?.indentMm??0),(o?.heightMm??0)-a)}}function G(e,t,n,s,i,r,o){const a=X(e);for(const[d,c]of(e.grid?.cells??[]).entries())for(const[u,g]of c.entries()){g?.dataBar!==void 0&&!m.validDataBar(g.dataBar)&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:"Invalid resolved data-bar geometry or color; visual data bars require ordered 0–1 ratios and #RRGGBB colors."}),componentPath:[...i,d,u]});const l=w(g?.style,t);l&&r.push({...h(e,t,n,s,{code:"unsupported-style",message:l}),componentPath:[...i,d,u]}),g?.richParagraphs?.length&&k({...e,richParagraphs:g.richParagraphs},t,n,s,r,[...i,d,u]);for(const[p,y]of(g?.children??[]).entries()){const D=[...i,d,u,p];if(t==="xlsx"){const I=a(y,d,u,g);if(I&&r.push({...h(y,t,n,s,I),componentPath:D}),y.grid)continue}S(y,t,n,s,D,r,o)}}}function B(e,t){m.assertBoundedRenderTree(e);const n=[];return e.pages.forEach((s,i)=>s.components.forEach((r,o)=>S(r,t,i,o,[],n,new Set))),n}function q(e,t,n){f.assertOutputActive(n.signal);const s=B(e,t);if(s.forEach(i=>v(i,n)),n.fidelity==="strict"&&s.length)throw new M(s);return s}class O extends Error{constructor(t,n){super(t.message),this.name="OutputAssetError",this.diagnostic=t,this.cause=n}}function x(e){if(e.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function F(e){const t={maxAssets:1e3,maxImageBytes:33554432,maxTotalImageBytes:134217728,maxDurationMs:3e4,...e.assetBudget};for(const[n,s]of Object.entries(t))if(!Number.isSafeInteger(s)||s<=0||s>2147483647)throw new RangeError(`${n} must be a positive safe integer at most 2147483647.`);return t}function N(e){const t=/^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);if(!t)throw new TypeError("Asset renderers must return an image data URL.");return t[1]?Math.ceil(t[2].length*3/4):new TextEncoder().encode(decodeURIComponent(t[2])).byteLength}function b(e,t,n,s,i){const r={code:n,message:s,severity:"warning",format:e.options.format??"dom",pageIndex:t.pageIndex,componentIndex:t.componentIndex,componentPath:t.componentPath,kind:t.component.kind,nid:t.component.nid};if(e.diagnostics.push(r),v(r,{...e.options,signal:e.signal}),e.options.assetFailure!=="placeholder")throw new O(r,i)}async function U(e,t,n){const s=e.options.assetRegistry?.rendererFor(t)??e.options.assetRenderers?.[t.kind];if(t.imageData||!s)return t.imageData;if(++e.rendered>e.budget.maxAssets)return b(e,n,"asset-budget-exceeded","Output exceeded the asset count budget.");let i;try{if(e.active=n,i=await f.waitForOutput(s({...n,signal:e.signal}),e.signal),x(e.signal),i.length>e.budget.maxImageBytes*4+1024)return b(e,n,"asset-budget-exceeded","Output exceeded the image payload byte budget.");const r=N(i);if(r>e.budget.maxImageBytes||e.bytes+r>e.budget.maxTotalImageBytes)return b(e,n,"asset-budget-exceeded","Output exceeded the encoded image byte budget.");/^data:image\/(png|jpe?g);base64,/i.test(i)&&e.inspectImage(i),e.bytes+=r}catch(r){if(e.signal.aborted||r instanceof O||r instanceof E.ImageMediaError&&r.code==="image-budget-exceeded")throw r;return b(e,n,"asset-render-failed",`Asset renderer failed for ${t.kind}; output was not silently omitted.`,r)}return i}function H(e,t){const n=e.active;if(!n){t.abort(new Error("Asset rendering exceeded maxDurationMs."));return}const s={code:"asset-budget-exceeded",message:"Asset rendering exceeded maxDurationMs.",severity:"warning",format:e.options.format??"dom",pageIndex:n.pageIndex,componentIndex:n.componentIndex,componentPath:n.componentPath,kind:n.component.kind,nid:n.component.nid};e.diagnostics.push(s);try{v(s,{...e.options,signal:e.signal})}catch(i){t.abort(i);return}t.abort(new O(s))}async function K(e,t,n,s,i){if(!t?.children?.length)return t;const r=[];for(const[o,a]of t.children.entries())r.push(await $(e,a,{...n,component:a,componentPath:[...s,o]},i));return r.some((o,a)=>o!==t.children[a])?{...t,children:r}:t}async function $(e,t,n,s){if(x(e.signal),s.has(t))throw new TypeError("Cyclic grid children cannot be rendered.");let i=e.cache.get(t);i||(i=U(e,t,n),e.cache.set(t,i));const r=await i;x(e.signal);let o=t.grid;if(o){const a=new Set(s).add(t),d=[];for(const[c,u]of o.cells.entries()){const g=[];for(const[l,p]of u.entries())g.push(await K(e,p,n,[...n.componentPath,c,l],a));d.push(g)}d.some((c,u)=>c.some((g,l)=>g!==o.cells[u][l]))&&(o={...o,cells:d})}return r!==t.imageData||o!==t.grid?{...t,imageData:r,grid:o}:t}function W(e,t,n){const s=new Set,i=r=>{if(f.assertOutputActive(n),!s.has(r)){if(s.add(r),r.imageData&&/^data:image\/(png|jpe?g);base64,/i.test(r.imageData))try{t(r.imageData)}catch(o){if(!(o instanceof E.ImageMediaError)||o.code==="image-budget-exceeded")throw o}for(const o of r.grid?.cells??[])for(const a of o)for(const d of a?.children??[])i(d)}};for(const r of e.pages)for(const o of r.components)i(o)}function _(e){if(e.options.fidelity==="strict"&&e.diagnostics.length)throw new M(e.diagnostics)}async function z(e,t={}){f.assertOutputActive(t.signal),m.assertBoundedRenderTree(e);const n=F(t),s=E.createImageMediaInspector(t);if(W(e,s,t.signal),t.signal?.aborted)throw t.signal.reason??new DOMException("The operation was aborted.","AbortError");const i=new AbortController,r=()=>i.abort(t.signal?.reason);if(t.signal?.addEventListener("abort",r,{once:!0}),!t.assetRegistry&&(!t.assetRenderers||!Object.keys(t.assetRenderers).length))return t.signal?.removeEventListener("abort",r),{plan:e,diagnostics:[]};const o={options:t,signal:i.signal,diagnostics:[],rendered:0,bytes:0,budget:n,cache:new WeakMap,inspectImage:s},a=setTimeout(()=>H(o,i),n.maxDurationMs);try{const d=[];for(const[c,u]of e.pages.entries()){if(c<(t.start??0)||c>(t.end??e.pages.length-1)){d.push(u);continue}const g=[];for(const[l,p]of u.components.entries())g.push(await $(o,p,{component:p,pageIndex:c,componentIndex:l,componentPath:[]},new Set));d.push(g.some((l,p)=>l!==u.components[p])?{...u,components:g}:u)}return x(o.signal),_(o),{plan:d.some((c,u)=>c!==e.pages[u])?{...e,pages:d}:e,diagnostics:o.diagnostics}}finally{clearTimeout(a),t.signal?.removeEventListener("abort",r)}}exports.OutputAssetError=O;exports.OutputFidelityError=M;exports.inspectOutputCapabilities=B;exports.notifyOutputDiagnostic=v;exports.reportOutputDiagnostics=q;exports.resolvePlanAssets=z;
|
package/dist/auto-BkdGiNtr.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { s as A, c as C, a as q } from "./prepared-BwjwEzFz.js";
|
|
2
|
-
import { J as U } from "./json-snapshot-Kgn459Oj.js";
|
|
3
|
-
import { b as T, R as S, v as I, c as $ } from "./protocol-Bs9-ohHN.js";
|
|
4
|
-
import { a as H } from "./progress-Hc2vxoCs.js";
|
|
5
|
-
import { c as N, e as G } from "./runtime-BDf5x1i1.js";
|
|
6
|
-
import { D as j, R as M, t as R, v as J, b as L, c as W } from "./sha256-BDQ1Qk7A.js";
|
|
7
|
-
class O extends Error {
|
|
8
|
-
constructor(r) {
|
|
9
|
-
super("报表 Worker 无法启动"), this.cause = r, this.name = "ReportWorkerStartError";
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
let K = 0;
|
|
13
|
-
function D(e) {
|
|
14
|
-
const r = new Error("报表 Worker 任务已取消");
|
|
15
|
-
return r.name = "AbortError", Object.defineProperty(r, "cause", { value: e }), r;
|
|
16
|
-
}
|
|
17
|
-
function X(e, r) {
|
|
18
|
-
if (!e || typeof e != "object") return;
|
|
19
|
-
const t = e;
|
|
20
|
-
return t.protocol === S && t.id === r ? t : void 0;
|
|
21
|
-
}
|
|
22
|
-
function Q(e, r = {}) {
|
|
23
|
-
const t = r.timeoutMs ?? 12e4;
|
|
24
|
-
if (!Number.isFinite(t) || t <= 0 || t > 2147483647) throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");
|
|
25
|
-
const n = (o, s, a, f) => a?.aborted ? Promise.reject(D(a.reason)) : new Promise((v, i) => {
|
|
26
|
-
let g;
|
|
27
|
-
try {
|
|
28
|
-
g = e();
|
|
29
|
-
} catch (l) {
|
|
30
|
-
i(new O(l));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const w = `mach-report-${Date.now()}-${++K}`;
|
|
34
|
-
let m = !1, u = () => {
|
|
35
|
-
}, y;
|
|
36
|
-
const p = (l, c) => {
|
|
37
|
-
if (m) return;
|
|
38
|
-
m = !0, y && clearTimeout(y);
|
|
39
|
-
let b;
|
|
40
|
-
try {
|
|
41
|
-
u();
|
|
42
|
-
} catch (E) {
|
|
43
|
-
b = E;
|
|
44
|
-
}
|
|
45
|
-
a?.removeEventListener("abort", x), l ??= b, Promise.resolve().then(() => g.terminate()).then(
|
|
46
|
-
() => l === void 0 ? v(c) : i(l),
|
|
47
|
-
(E) => i(l ?? E)
|
|
48
|
-
);
|
|
49
|
-
}, x = () => p(D(a?.reason)), d = (l) => {
|
|
50
|
-
const c = X(l, w);
|
|
51
|
-
if (!(!c || m)) {
|
|
52
|
-
if ("type" in c && c.type === "event") {
|
|
53
|
-
const b = "event" in c ? c.event : void 0;
|
|
54
|
-
I(b, s) ? U(f, b, a) : p(new Error("报表 Worker 返回无效阶段事件"));
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
c.error && typeof c.error.name == "string" && typeof c.error.message == "string" ? p(new T(c.error)) : $(c.result, o) && (o === "prepare" || "format" in c.result && "format" in s && c.result.format === s.format) ? p(void 0, c.result) : p(new Error("报表 Worker 返回无效响应"));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
try {
|
|
61
|
-
if (u = g.subscribe(d, (l) => p(l ?? new Error("报表 Worker 执行失败"))), m) {
|
|
62
|
-
u();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (a?.addEventListener("abort", x, { once: !0 }), y = setTimeout(() => p(new T({ name: "ReportRuntimeError", code: "timeout", message: `报表 Worker 执行超过 ${t}ms` })), t), a?.aborted) x();
|
|
66
|
-
else {
|
|
67
|
-
const { onEvent: l, signal: c, ...b } = s, E = V(b);
|
|
68
|
-
g.postMessage({ protocol: S, id: w, operation: o, input: b, ...r.budget ? { budget: r.budget } : {} }, E);
|
|
69
|
-
}
|
|
70
|
-
} catch (l) {
|
|
71
|
-
p(l);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
return { exportPrepared: (o, s, a) => n("exportPrepared", o, s, a), prepare: (o, s, a) => n("prepare", o, s, a), export: (o, s, a) => n("export", o, s, a) };
|
|
75
|
-
}
|
|
76
|
-
function V(e) {
|
|
77
|
-
return e.pdf ? (e.pdf = A(e.pdf), (e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes]).filter((t) => t instanceof Uint8Array).map((t) => t.buffer)) : [];
|
|
78
|
-
}
|
|
79
|
-
function Y(e, r = {}) {
|
|
80
|
-
return Q(() => {
|
|
81
|
-
const t = e();
|
|
82
|
-
return {
|
|
83
|
-
postMessage: (n, o) => t.postMessage(n, o),
|
|
84
|
-
terminate: () => t.terminate(),
|
|
85
|
-
subscribe: (n, o) => {
|
|
86
|
-
const s = (f) => n(f.data), a = (f) => o(f instanceof ErrorEvent ? new Error(f.message) : new Error("报表 Worker 消息无法解码"));
|
|
87
|
-
return t.addEventListener("message", s), t.addEventListener("error", a), t.addEventListener("messageerror", a), () => {
|
|
88
|
-
t.removeEventListener("message", s), t.removeEventListener("error", a), t.removeEventListener("messageerror", a);
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}, r);
|
|
93
|
-
}
|
|
94
|
-
const Z = { cells: 2e4, pages: 20, bytes: 2e6 };
|
|
95
|
-
function P(e) {
|
|
96
|
-
return e.cells >= e.limits.cells || e.pages >= e.limits.pages || e.bytes >= e.limits.bytes || e.capped;
|
|
97
|
-
}
|
|
98
|
-
function k(e) {
|
|
99
|
-
return ++e.visits >= 1e5 && (e.capped = !0), !P(e);
|
|
100
|
-
}
|
|
101
|
-
function h(e) {
|
|
102
|
-
return typeof e == "string" ? e.length * 2 : 0;
|
|
103
|
-
}
|
|
104
|
-
function F(e, r) {
|
|
105
|
-
for (const t of e ?? []) {
|
|
106
|
-
if (!k(r)) return;
|
|
107
|
-
for (const n of t.segments) {
|
|
108
|
-
if (!k(r)) return;
|
|
109
|
-
r.bytes += h(n.text);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function z(e, r, t) {
|
|
114
|
-
if (t > 32) {
|
|
115
|
-
r.capped = !0;
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (k(r)) {
|
|
119
|
-
r.bytes += h(e.text) + h(e.rawText) + h(e.imageData), F(e.richParagraphs, r);
|
|
120
|
-
for (const n of e.lines ?? []) {
|
|
121
|
-
if (!k(r)) return;
|
|
122
|
-
r.bytes += h(n);
|
|
123
|
-
}
|
|
124
|
-
for (const n of e.grid?.cells ?? []) {
|
|
125
|
-
if (!k(r)) return;
|
|
126
|
-
for (const o of n) {
|
|
127
|
-
if (!k(r)) return;
|
|
128
|
-
if (o) {
|
|
129
|
-
r.cells++, r.bytes += h(o.text) + h(o.rawText) + h(o.value), F(o.richParagraphs, r);
|
|
130
|
-
for (const s of o.children ?? []) {
|
|
131
|
-
if (P(r)) return;
|
|
132
|
-
z(s, r, t + 1);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function ee(e) {
|
|
140
|
-
const r = { ...Z, ...e.thresholds };
|
|
141
|
-
for (const t of Object.values(r)) if (!Number.isSafeInteger(t) || t <= 0) throw new RangeError("导出隔离阈值应为正安全整数");
|
|
142
|
-
return r;
|
|
143
|
-
}
|
|
144
|
-
function re(e, r) {
|
|
145
|
-
const t = ee(r), n = e.pdf?.customFontFaces ? Object.values(e.pdf.customFontFaces) : [e.pdf?.customFontBytes], o = { pages: e.prepared.plan.pages.length, cells: 0, bytes: n.reduce((f, v) => f + (v?.byteLength ?? 0), 0), visits: 0, capped: !1, limits: t };
|
|
146
|
-
for (const f of e.prepared.plan.pages) {
|
|
147
|
-
if (P(o)) break;
|
|
148
|
-
for (const v of f.components) {
|
|
149
|
-
if (P(o)) break;
|
|
150
|
-
z(v, o, 0);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
let s = P(o) ? "worker" : "local", a = o.capped ? "scan-limit" : s === "worker" ? "threshold" : "small-task";
|
|
154
|
-
return r.mode === "local" && (s = "local", a = "explicit-local"), r.mode === "worker" && (s = "worker", a = "explicit-worker"), Object.values(e.xlsx ?? {}).some((f) => typeof f == "function") && (s = "local", a = "nonserializable-options"), { mode: s, reason: a, estimate: { pages: o.pages, cells: o.cells, bytes: o.bytes }, hardCancellation: s === "worker" };
|
|
155
|
-
}
|
|
156
|
-
function te(e) {
|
|
157
|
-
if (e.mode !== void 0 && !["auto", "local", "worker"].includes(e.mode)) throw new TypeError("无效的导出执行模式");
|
|
158
|
-
if (e.fallback !== void 0 && !["local", "error"].includes(e.fallback)) throw new TypeError("无效的导出回退策略");
|
|
159
|
-
J({ ...e.budget, maxDurationMs: e.timeoutMs ?? e.budget?.maxDurationMs ?? 12e4 });
|
|
160
|
-
}
|
|
161
|
-
function _(e, r) {
|
|
162
|
-
H(() => e.onDecision?.({ ...r, estimate: { ...r.estimate } }));
|
|
163
|
-
}
|
|
164
|
-
function B(e, r) {
|
|
165
|
-
return { ...e, mode: "local", reason: r, hardCancellation: !1 };
|
|
166
|
-
}
|
|
167
|
-
function oe(e, r) {
|
|
168
|
-
const t = { ...j, ...r.budget }, n = C(e.prepared, t.maxPreparedBytes, e.signal), o = G(n.prepared, t);
|
|
169
|
-
n.prepared.stats = o.stats;
|
|
170
|
-
const s = { ...e, prepared: n.prepared, pdf: A(e.pdf), xlsx: q(e.xlsx) };
|
|
171
|
-
return { request: s, forward: () => ({ ...s, prepared: n.forward() }) };
|
|
172
|
-
}
|
|
173
|
-
function se(e, r) {
|
|
174
|
-
te(e);
|
|
175
|
-
const t = { ...e, thresholds: { ...e.thresholds }, budget: { ...j, ...e.budget } }, n = t.timeoutMs ?? t.budget.maxDurationMs ?? 12e4, o = N({ reports: {}, budget: { ...t.budget, maxDurationMs: n } }), s = /* @__PURE__ */ new Set();
|
|
176
|
-
let a = !1;
|
|
177
|
-
const f = t.mode !== "worker" && t.fallback !== "error";
|
|
178
|
-
async function v(i, g) {
|
|
179
|
-
const w = Date.now(), m = () => {
|
|
180
|
-
const d = n - (Date.now() - w);
|
|
181
|
-
if (d <= 0) throw new M("timeout", `报表执行超过 ${n}ms`);
|
|
182
|
-
return d;
|
|
183
|
-
};
|
|
184
|
-
let u = re(i, t);
|
|
185
|
-
if (u.reason === "nonserializable-options" && t.mode === "worker") throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");
|
|
186
|
-
if (u.mode === "worker" && !r) {
|
|
187
|
-
if (!f) throw new O(new Error("未配置 workerFactory"));
|
|
188
|
-
u = B(u, "worker-unavailable");
|
|
189
|
-
}
|
|
190
|
-
const y = oe(i, t), p = y.request;
|
|
191
|
-
if (_(t, u), R(i.signal), u.mode === "worker")
|
|
192
|
-
try {
|
|
193
|
-
const d = r(m());
|
|
194
|
-
if (!d.exportPrepared) throw new TypeError("隔离执行器缺少 exportPrepared");
|
|
195
|
-
const { signal: l, onEvent: c, ...b } = p, E = await d.exportPrepared(b, l, c);
|
|
196
|
-
return R(l), L(t.budget, "maxOutputBytes", E.bytes.byteLength), { ...E, execution: u };
|
|
197
|
-
} catch (d) {
|
|
198
|
-
if (!(d instanceof O) || !f) throw d;
|
|
199
|
-
R(i.signal), u = B(u, "worker-start-failed"), _(t, u);
|
|
200
|
-
}
|
|
201
|
-
const x = g ? await W(i.signal, m(), (d) => g({ ...p, signal: d })) : await W(i.signal, m(), (d) => o.exportPrepared({ ...y.forward(), signal: d }));
|
|
202
|
-
return R(i.signal), L(t.budget, "maxOutputBytes", x.bytes.byteLength), { ...x, execution: u };
|
|
203
|
-
}
|
|
204
|
-
return {
|
|
205
|
-
async exportPrepared(i, g) {
|
|
206
|
-
if (a) throw new M("closed", "导出执行器已释放");
|
|
207
|
-
if (R(i.signal), s.size >= 2) throw new M("queue-full", "同时导出的任务已达 2 个,请等待完成后重试");
|
|
208
|
-
const w = new AbortController();
|
|
209
|
-
s.add(w);
|
|
210
|
-
const m = () => w.abort(i.signal?.reason);
|
|
211
|
-
i.signal?.addEventListener("abort", m, { once: !0 });
|
|
212
|
-
try {
|
|
213
|
-
return await v({ ...i, signal: w.signal }, g);
|
|
214
|
-
} finally {
|
|
215
|
-
i.signal?.removeEventListener("abort", m), s.delete(w);
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
cancel() {
|
|
219
|
-
for (const i of s) i.abort();
|
|
220
|
-
},
|
|
221
|
-
dispose() {
|
|
222
|
-
a = !0;
|
|
223
|
-
for (const i of s) i.abort();
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function ne(e = {}) {
|
|
228
|
-
const r = e.workerFactory, t = { timeoutMs: e.timeoutMs ?? e.budget?.maxDurationMs, budget: { ...e.budget } };
|
|
229
|
-
return se(e, r ? (n) => Y(r, { ...t, timeoutMs: n }) : void 0);
|
|
230
|
-
}
|
|
231
|
-
const de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
232
|
-
__proto__: null,
|
|
233
|
-
createAutoReportExporter: ne
|
|
234
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
235
|
-
export {
|
|
236
|
-
O as R,
|
|
237
|
-
Y as a,
|
|
238
|
-
de as b,
|
|
239
|
-
ne as c
|
|
240
|
-
};
|
package/dist/auto-Tq7ReIC1.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const T=require("./prepared-BiSz_9vN.cjs"),S=require("./json-snapshot-I5VI84Vp.cjs"),R=require("./protocol-C8VWF9An.cjs"),I=require("./progress-B0ctFpKf.cjs"),_=require("./runtime-DsJt1PIf.cjs"),d=require("./sha256-DgZAKXqI.cjs");class M extends Error{constructor(r){super("报表 Worker 无法启动"),this.cause=r,this.name="ReportWorkerStartError"}}let j=0;function W(e){const r=new Error("报表 Worker 任务已取消");return r.name="AbortError",Object.defineProperty(r,"cause",{value:e}),r}function U(e,r){if(!e||typeof e!="object")return;const t=e;return t.protocol===R.REPORT_WORKER_PROTOCOL&&t.id===r?t:void 0}function C(e,r={}){const t=r.timeoutMs??12e4;if(!Number.isFinite(t)||t<=0||t>2147483647)throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");const n=(o,s,a,u)=>a?.aborted?Promise.reject(W(a.reason)):new Promise((v,c)=>{let w;try{w=e()}catch(l){c(new M(l));return}const E=`mach-report-${Date.now()}-${++j}`;let m=!1,f=()=>{},k;const b=(l,i)=>{if(m)return;m=!0,k&&clearTimeout(k);let g;try{f()}catch(h){g=h}a?.removeEventListener("abort",x),l??=g,Promise.resolve().then(()=>w.terminate()).then(()=>l===void 0?v(i):c(l),h=>c(l??h))},x=()=>b(W(a?.reason)),p=l=>{const i=U(l,E);if(!(!i||m)){if("type"in i&&i.type==="event"){const g="event"in i?i.event:void 0;R.validReportWorkerEvent(g,s)?S.notifyReportTaskEvent(u,g,a):b(new Error("报表 Worker 返回无效阶段事件"));return}i.error&&typeof i.error.name=="string"&&typeof i.error.message=="string"?b(new R.ReportWorkerError(i.error)):R.validReportWorkerResult(i.result,o)&&(o==="prepare"||"format"in i.result&&"format"in s&&i.result.format===s.format)?b(void 0,i.result):b(new Error("报表 Worker 返回无效响应"))}};try{if(f=w.subscribe(p,l=>b(l??new Error("报表 Worker 执行失败"))),m){f();return}if(a?.addEventListener("abort",x,{once:!0}),k=setTimeout(()=>b(new R.ReportWorkerError({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),a?.aborted)x();else{const{onEvent:l,signal:i,...g}=s,h=z(g);w.postMessage({protocol:R.REPORT_WORKER_PROTOCOL,id:E,operation:o,input:g,...r.budget?{budget:r.budget}:{}},h)}}catch(l){b(l)}});return{exportPrepared:(o,s,a)=>n("exportPrepared",o,s,a),prepare:(o,s,a)=>n("prepare",o,s,a),export:(o,s,a)=>n("export",o,s,a)}}function z(e){return e.pdf?(e.pdf=T.snapshotPdfFonts(e.pdf),(e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes]).filter(t=>t instanceof Uint8Array).map(t=>t.buffer)):[]}function A(e,r={}){return C(()=>{const t=e();return{postMessage:(n,o)=>t.postMessage(n,o),terminate:()=>t.terminate(),subscribe:(n,o)=>{const s=u=>n(u.data),a=u=>o(u instanceof ErrorEvent?new Error(u.message):new Error("报表 Worker 消息无法解码"));return t.addEventListener("message",s),t.addEventListener("error",a),t.addEventListener("messageerror",a),()=>{t.removeEventListener("message",s),t.removeEventListener("error",a),t.removeEventListener("messageerror",a)}}}},r)}const N={cells:2e4,pages:20,bytes:2e6};function P(e){return e.cells>=e.limits.cells||e.pages>=e.limits.pages||e.bytes>=e.limits.bytes||e.capped}function O(e){return++e.visits>=1e5&&(e.capped=!0),!P(e)}function y(e){return typeof e=="string"?e.length*2:0}function L(e,r){for(const t of e??[]){if(!O(r))return;for(const n of t.segments){if(!O(r))return;r.bytes+=y(n.text)}}}function B(e,r,t){if(t>32){r.capped=!0;return}if(O(r)){r.bytes+=y(e.text)+y(e.rawText)+y(e.imageData),L(e.richParagraphs,r);for(const n of e.lines??[]){if(!O(r))return;r.bytes+=y(n)}for(const n of e.grid?.cells??[]){if(!O(r))return;for(const o of n){if(!O(r))return;if(o){r.cells++,r.bytes+=y(o.text)+y(o.rawText)+y(o.value),L(o.richParagraphs,r);for(const s of o.children??[]){if(P(r))return;B(s,r,t+1)}}}}}}function $(e){const r={...N,...e.thresholds};for(const t of Object.values(r))if(!Number.isSafeInteger(t)||t<=0)throw new RangeError("导出隔离阈值应为正安全整数");return r}function H(e,r){const t=$(r),n=e.pdf?.customFontFaces?Object.values(e.pdf.customFontFaces):[e.pdf?.customFontBytes],o={pages:e.prepared.plan.pages.length,cells:0,bytes:n.reduce((u,v)=>u+(v?.byteLength??0),0),visits:0,capped:!1,limits:t};for(const u of e.prepared.plan.pages){if(P(o))break;for(const v of u.components){if(P(o))break;B(v,o,0)}}let s=P(o)?"worker":"local",a=o.capped?"scan-limit":s==="worker"?"threshold":"small-task";return r.mode==="local"&&(s="local",a="explicit-local"),r.mode==="worker"&&(s="worker",a="explicit-worker"),Object.values(e.xlsx??{}).some(u=>typeof u=="function")&&(s="local",a="nonserializable-options"),{mode:s,reason:a,estimate:{pages:o.pages,cells:o.cells,bytes:o.bytes},hardCancellation:s==="worker"}}function G(e){if(e.mode!==void 0&&!["auto","local","worker"].includes(e.mode))throw new TypeError("无效的导出执行模式");if(e.fallback!==void 0&&!["local","error"].includes(e.fallback))throw new TypeError("无效的导出回退策略");d.validateBudget({...e.budget,maxDurationMs:e.timeoutMs??e.budget?.maxDurationMs??12e4})}function F(e,r){I.observeOutput(()=>e.onDecision?.({...r,estimate:{...r.estimate}}))}function D(e,r){return{...e,mode:"local",reason:r,hardCancellation:!1}}function K(e,r){const t={...d.DEFAULT_REPORT_RUNTIME_BUDGET,...r.budget},n=T.capturePreparedHandoff(e.prepared,t.maxPreparedBytes,e.signal),o=_.enforcePrepared(n.prepared,t);n.prepared.stats=o.stats;const s={...e,prepared:n.prepared,pdf:T.snapshotPdfFonts(e.pdf),xlsx:T.snapshotXlsxOptions(e.xlsx)};return{request:s,forward:()=>({...s,prepared:n.forward()})}}function X(e,r){G(e);const t={...e,thresholds:{...e.thresholds},budget:{...d.DEFAULT_REPORT_RUNTIME_BUDGET,...e.budget}},n=t.timeoutMs??t.budget.maxDurationMs??12e4,o=_.createReportRuntime({reports:{},budget:{...t.budget,maxDurationMs:n}}),s=new Set;let a=!1;const u=t.mode!=="worker"&&t.fallback!=="error";async function v(c,w){const E=Date.now(),m=()=>{const p=n-(Date.now()-E);if(p<=0)throw new d.ReportRuntimeError("timeout",`报表执行超过 ${n}ms`);return p};let f=H(c,t);if(f.reason==="nonserializable-options"&&t.mode==="worker")throw new TypeError("Worker 模式不接受函数选项;请使用本地模式或可序列化配置");if(f.mode==="worker"&&!r){if(!u)throw new M(new Error("未配置 workerFactory"));f=D(f,"worker-unavailable")}const k=K(c,t),b=k.request;if(F(t,f),d.throwIfAborted(c.signal),f.mode==="worker")try{const p=r(m());if(!p.exportPrepared)throw new TypeError("隔离执行器缺少 exportPrepared");const{signal:l,onEvent:i,...g}=b,h=await p.exportPrepared(g,l,i);return d.throwIfAborted(l),d.assertBudget(t.budget,"maxOutputBytes",h.bytes.byteLength),{...h,execution:f}}catch(p){if(!(p instanceof M)||!u)throw p;d.throwIfAborted(c.signal),f=D(f,"worker-start-failed"),F(t,f)}const x=w?await d.controlled(c.signal,m(),p=>w({...b,signal:p})):await d.controlled(c.signal,m(),p=>o.exportPrepared({...k.forward(),signal:p}));return d.throwIfAborted(c.signal),d.assertBudget(t.budget,"maxOutputBytes",x.bytes.byteLength),{...x,execution:f}}return{async exportPrepared(c,w){if(a)throw new d.ReportRuntimeError("closed","导出执行器已释放");if(d.throwIfAborted(c.signal),s.size>=2)throw new d.ReportRuntimeError("queue-full","同时导出的任务已达 2 个,请等待完成后重试");const E=new AbortController;s.add(E);const m=()=>E.abort(c.signal?.reason);c.signal?.addEventListener("abort",m,{once:!0});try{return await v({...c,signal:E.signal},w)}finally{c.signal?.removeEventListener("abort",m),s.delete(E)}},cancel(){for(const c of s)c.abort()},dispose(){a=!0;for(const c of s)c.abort()}}}function q(e={}){const r=e.workerFactory,t={timeoutMs:e.timeoutMs??e.budget?.maxDurationMs,budget:{...e.budget}};return X(e,r?n=>A(r,{...t,timeoutMs:n}):void 0)}const J=Object.freeze(Object.defineProperty({__proto__:null,createAutoReportExporter:q},Symbol.toStringTag,{value:"Module"}));exports.ReportWorkerStartError=M;exports.auto=J;exports.createAutoReportExporter=q;exports.createBrowserReportExecutor=A;
|
package/dist/charts-aCtoswXq.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const w=require("./matrix-0hywp0-F.cjs"),g=["#2563eb","#0d9488","#d97706","#7c3aed","#dc2626","#0284c7"];function E(e){if(!["bar","line","stackedBar","percentBar"].includes(e.type))throw new Error("未知图表类型");if(!Array.isArray(e.categories)||!Array.isArray(e.series)||!e.categories.length||e.categories.length>200||!e.series.length||e.series.length>12)throw new Error("图表支持 1–200 个分类、1–12 个系列;大数据应先聚合");const t=w.chartArray(e.categories,200,"图表分类"),r=w.chartArray(e.series,12,"图表系列").map(a=>({...a,values:w.chartArray(a?.values,200,"图表数值")}));for(const a of t)if(typeof a!="string")throw new Error("图表分类应为字符串");x(e);for(const a of r)A(a,t.length);return{...e,categories:t,series:r}}function x(e){for(const t of["leftMm","topMm","widthMm","heightMm"])if(!Number.isFinite(e[t])||e[t]<0)throw new Error(`${t} 应为有限非负数`);if(e.widthMm<45||e.heightMm<35)throw new Error("图表至少需要 45×35mm");if(!Number.isFinite(e.leftMm+e.widthMm)||!Number.isFinite(e.topMm+e.heightMm))throw new Error("图表几何范围溢出")}function A(e,t){if(!e||typeof e.name!="string"||!Array.isArray(e.values)||e.values.length!==t)throw new Error("图表系列应提供名称及逐分类的有限数字或 null");for(const r of e.values)if(r!==null&&!Number.isFinite(r))throw new Error("图表系列应提供名称及逐分类的有限数字或 null");if(e.color!==void 0&&!/^#[\da-f]{6}$/i.test(e.color))throw new Error("图表颜色应为 #RRGGBB")}function y(e,t,r,a,c,n=.8){return{kind:"line",leftMm:Math.min(e,r),topMm:Math.min(t,a),widthMm:Math.abs(r-e),heightMm:Math.abs(a-t),lineDirection:a<t?"up":"down",style:{lineColor:c,lineWidthPt:n}}}function o(e,t,r,a,c="center"){return{kind:"text",text:e,leftMm:t,topMm:r,widthMm:a,heightMm:5,style:{fontSize:8,color:"#475569",align:c,verticalAlign:"middle"}}}function M(e){return Number(e.toPrecision(5)).toString()}function N(e){let t=0,r=0;const a=B(e)?S(e):void 0;if(a)t=a.min,r=a.max;else for(const u of e.series)for(const f of u.values)f!==null&&(t=Math.min(t,f),r=Math.max(r,f));t===r&&(r=t+1);const c=e.leftMm+13,n=e.topMm+8,h=e.widthMm-17,i=e.heightMm-23,l=Math.max(Math.abs(t),Math.abs(r),1),m=t/l,s=r/l-m;return{left:c,top:n,width:h,height:i,min:t,max:r,y:u=>n+i*(1-(u/l-m)/s)}}function B(e){return e.type==="stackedBar"||e.type==="percentBar"}function S(e){let t=0,r=e.type==="percentBar"?100:0;for(let a=0;a<e.categories.length;a++){let c=0,n=0;for(const h of e.series){const i=h.values[a]??0;i<0?n+=i:c+=i}if(!Number.isFinite(c)||!Number.isFinite(n))throw new Error("图表堆叠合计溢出,请先明确缩放单位");t=Math.min(t,n),r=Math.max(r,c)}return{min:t,max:r}}function z(e){if(e.type!=="percentBar")return e;const t=e.categories.map((r,a)=>{let c=0;for(const n of e.series){const h=n.values[a];if(h!==null&&h<0)throw new Error("占比图需要非负度量,负数口径应由业务明确处理");c=Math.max(c,h??0)}return{scale:c,total:c?e.series.reduce((n,h)=>n+(h.values[a]??0)/c,0):0}});return{...e,series:e.series.map(r=>({...r,values:r.values.map((a,c)=>{if(a===null)return null;const{scale:n,total:h}=t[c];return n&&h?a/n/h*100:0})}))}}function F(e,t){const r=[],a=t.width/e.categories.length;return e.categories.forEach((c,n)=>{let h=0,i=0;e.series.forEach((l,m)=>{const s=l.values[n];if(s==null)return;const u=s<0?i:h,f=u+s;s<0?i=f:h=f;const b=Math.min(t.y(u),t.y(f)),d=Math.abs(t.y(f)-t.y(u)),C=l.color??g[m%g.length],v=t.left+a*(n+.15),k=a*.7;r.push({kind:"rect",leftMm:v,topMm:b,widthMm:k,heightMm:d,style:{backgroundColor:C,borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1}}),e.showValues&&d>=5&&r.push({...o(e.type==="percentBar"?`${M(s)}%`:M(s),v,b+d/2-2.5,k),style:{fontSize:7,color:"#ffffff",align:"center"}})})}),r}function R(e,t){const r=[];e.title&&r.push({...o(e.title,e.leftMm,e.topMm,e.widthMm),style:{fontSize:10,bold:!0,align:"left"}});for(let n=0;n<=4;n++){const h=n/4,i=t.min*(1-h)+t.max*h,l=t.y(i);r.push(y(t.left,l,t.left+t.width,l,"#e2e8f0",.4),o(`${M(i)}${e.type==="percentBar"?"%":""}`,e.leftMm,l-2.5,11,"right"))}r.push(y(t.left,t.top,t.left,t.top+t.height,"#94a3b8"));const a=Math.max(1,Math.ceil(e.categories.length/Math.max(1,Math.floor(t.width/14))));e.categories.forEach((n,h)=>{h%a===0&&r.push(o(n,t.left+(h+.5)*t.width/e.categories.length-7,t.top+t.height+1,14))});const c=t.width/e.series.length;return e.series.forEach((n,h)=>{r.push({...o(n.name,t.left+h*c,e.topMm+e.heightMm-5,c),style:{fontSize:8,color:n.color??g[h%g.length],align:"center"}})}),r}function W(e,t,r,a){const c=[],n=r.color??g[a%g.length],h=t.width/e.categories.length,i=h*.75/e.series.length;let l;return r.values.forEach((m,s)=>{if(m===null){l=void 0;return}const u=t.left+(s+.5)*h,f=t.y(m);e.type==="bar"?c.push({kind:"rect",leftMm:t.left+s*h+h*.125+a*i,topMm:Math.min(f,t.y(0)),widthMm:i,heightMm:Math.abs(t.y(0)-f),style:{backgroundColor:n,borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1}}):(l&&c.push(y(l.x,l.y,u,f,n,1.2)),c.push({kind:"ellipse",leftMm:u-.7,topMm:f-.7,widthMm:1.4,heightMm:1.4,style:{backgroundColor:n,borderColor:n}}),l={x:u,y:f}),e.showValues&&c.push({...o(M(m),u-h/2,Math.max(t.top,f-5),h),style:{fontSize:7,color:n,align:"center"}})}),c}function $(e,t){let r=0,a=!1;for(const c of t.values){if(c===null){a=!1;continue}r+=1+ +!!e.showValues,e.type==="line"&&a&&r++,a=!0}return r}function L(e){const t=e.categories.length,r=Math.max(1,Math.ceil(t/Math.max(1,Math.floor((e.widthMm-17)/14)))),a=11+ +!!e.title+Math.ceil(t/r)+e.series.length;return e.series.reduce((c,n)=>c+$(e,n),a)}function G(e){e=z(E(e));const t=N(e);return[...R(e,t),...B(e)?F(e,t):e.series.flatMap((r,a)=>W(e,t,r,a))]}exports.chartComponentUpperBound=L;exports.createChartComponents=G;
|