| 26 | `);return V}function LB($,q,Q={},K){let J=Q||{};J.slideMargin=J.slideMargin||J.slideMargin===0?J.slideMargin:0.5;let Z=J.w||$.presLayout.width,G=[],W=[],B=[],V=[],U=[],w=[0.5,0.5,0.5,0.5],F=0;if(!document.getElementById(q))throw Error('tableToSlides: Table ID "'+q+'" does not exist!');if(K===null||K===void 0?void 0:K._margin){if(Array.isArray(K._margin))w=K._margin;else if(!isNaN(K._margin))w=[K._margin,K._margin,K._margin,K._margin];J.slideMargin=w}else if(J===null||J===void 0?void 0:J.slideMargin){if(Array.isArray(J.slideMargin))w=J.slideMargin;else if(!isNaN(J.slideMargin))w=[J.slideMargin,J.slideMargin,J.slideMargin,J.slideMargin]}if(Z=(J.w?v0(J.w):$.presLayout.width)-v0(w[1]+w[3]),J.verbose)console.log("[[VERBOSE MODE]]"),console.log("|-- `tableToSlides` ----------------------------------------------------|"),console.log(`| tableProps.h .................................... = ${J.h}`),console.log(`| tableProps.w .................................... = ${J.w}`),console.log(`| pptx.presLayout.width ........................... = ${($.presLayout.width/L0).toFixed(1)}`),console.log(`| pptx.presLayout.height .......................... = ${($.presLayout.height/L0).toFixed(1)}`),console.log(`| emuSlideTabW .................................... = ${(Z/L0).toFixed(1)}`);let M=document.querySelectorAll(`#${q} tr:first-child th`);if(M.length===0)M=document.querySelectorAll(`#${q} tr:first-child td`);if(M.forEach((f)=>{let L=f;if(L.getAttribute("colspan"))for(let D=0;D<Number(L.getAttribute("colspan"));D++)U.push(Math.round(L.offsetWidth/Number(L.getAttribute("colspan"))));else U.push(L.offsetWidth)}),U.forEach((f)=>{F+=f}),U.forEach((f,L)=>{let D=Number((Number(Z)*(f/F*100)/100/L0).toFixed(2)),z=0,N=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(N)z=Number(N.getAttribute("data-pptx-min-width"));let H=document.querySelector(`#${q} thead tr:first-child th:nth-child(${L+1})`);if(H)z=Number(H.getAttribute("data-pptx-width"));V.push(z>D?z:D)}),J.verbose)console.log(`| arrColW ......................................... = [${V.join(", ")}]`);["thead","tbody","tfoot"].forEach((f)=>{document.querySelectorAll(`#${q} ${f} tr`).forEach((L)=>{let D=L,z=[];switch(Array.from(D.cells).forEach((N)=>{let H=window.getComputedStyle(N).getPropertyValue("color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(","),v=window.getComputedStyle(N).getPropertyValue("background-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");if(window.getComputedStyle(N).getPropertyValue("background-color")==="rgba(0, 0, 0, 0)"||window.getComputedStyle(N).getPropertyValue("transparent"))v=["255","255","255"];let j={align:null,bold:window.getComputedStyle(N).getPropertyValue("font-weight")==="bold"||Number(window.getComputedStyle(N).getPropertyValue("font-weight"))>=500,border:null,color:g7(Number(H[0]),Number(H[1]),Number(H[2])),fill:{color:g7(Number(v[0]),Number(v[1]),Number(v[2]))},fontFace:(window.getComputedStyle(N).getPropertyValue("font-family")||"").split(",")[0].replace(/"/g,"").replace("inherit","").replace("initial","")||null,fontSize:Number(window.getComputedStyle(N).getPropertyValue("font-size").replace(/[a-z]/gi,"")),margin:null,colspan:Number(N.getAttribute("colspan"))||null,rowspan:Number(N.getAttribute("rowspan"))||null,valign:null};if(["left","center","right","start","end"].includes(window.getComputedStyle(N).getPropertyValue("text-align"))){let n=window.getComputedStyle(N).getPropertyValue("text-align").replace("start","left").replace("end","right");j.align=n==="center"?"center":n==="left"?"left":n==="right"?"right":null}if(["top","middle","bottom"].includes(window.getComputedStyle(N).getPropertyValue("vertical-align"))){let n=window.getComputedStyle(N).getPropertyValue("vertical-align");j.valign=n==="top"?"top":n==="middle"?"middle":n==="bottom"?"bottom":null}if(window.getComputedStyle(N).getPropertyValue("padding-left"))j.margin=[0,0,0,0],["padding-top","padding-right","padding-bottom","padding-left"].forEach((d,_)=>{j.margin[_]=Math.round(Number(window.getComputedStyle(N).getPropertyValue(d).replace(/\D/gi,"")))});if(window.getComputedStyle(N).getPropertyValue("border-top-width")||window.getComputedStyle(N).getPropertyValue("border-right-width")||window.getComputedStyle(N).getPropertyValue("border-bottom-width")||window.getComputedStyle(N).getPropertyValue("border-left-width"))j.border=[null,null,null,null],["top","right","bottom","left"].forEach((d,_)=>{let X=Math.round(Number(window.getComputedStyle(N).getPropertyValue("border-"+d+"-width").replace("px",""))),P=[];P=window.getComputedStyle(N).getPropertyValue("border-"+d+"-color").replace(/\s+/gi,"").replace("rgba(","").replace("rgb(","").replace(")","").split(",");let g=g7(Number(P[0]),Number(P[1]),Number(P[2]));j.border[_]={pt:X,color:g}});z.push({_type:D0.tablecell,text:N.innerText,options:j})}),f){case"thead":G.push(z);break;case"tbody":W.push(z);break;case"tfoot":B.push(z);break;default:console.log(`table parsing: unexpected table part: ${f}`);break}})}),J._arrObjTabHeadRows=G||null,J.colW=V,ZJ([...G,...W,...B],J,$.presLayout,K).forEach((f,L)=>{let D=$.addSlide({masterName:J.masterSlideName||null});if(L===0)J.y=J.y||w[0];if(L>0)J.y=J.autoPageSlideStartY||J.newSlideStartY||w[0];if(J.verbose)console.log(`| opts.autoPageSlideStartY: ${J.autoPageSlideStartY} / arrInchMargins[0]: ${w[0]} => opts.y = ${J.y}`);if(D.addTable(f.rows,{x:J.x||w[3],y:J.y,w:Number(Z)/L0,colW:V,autoPage:!1}),J.addImage)if(J.addImage.options=J.addImage.options||{},!J.addImage.image||!J.addImage.image.path&&!J.addImage.image.data)console.warn("Warning: tableToSlides.addImage requires either `path` or `data`");else D.addImage({path:J.addImage.image.path,data:J.addImage.image.data,x:J.addImage.options.x,y:J.addImage.options.y,w:J.addImage.options.w,h:J.addImage.options.h});if(J.addShape)D.addShape(J.addShape.shapeName,J.addShape.options||{});if(J.addTable)D.addTable(J.addTable.rows,J.addTable.options||{});if(J.addText)D.addText(J.addText.text,J.addText.options||{})})}var HB=0;function vB($,q){if($.bkgd)q.bkgd=$.bkgd;if($.objects&&Array.isArray($.objects)&&$.objects.length>0)$.objects.forEach((Q,K)=>{let J=Object.keys(Q)[0],Z=q;if(W1[J]&&J==="chart")GJ(Z,Q[J].type,Q[J].data,Q[J].opts);else if(W1[J]&&J==="image")WJ(Z,Q[J]);else if(W1[J]&&J==="line")E7(Z,B1.LINE,Q[J]);else if(W1[J]&&J==="rect")E7(Z,B1.RECTANGLE,Q[J]);else if(W1[J]&&J==="text")L5(Z,[{text:Q[J].text}],Q[J].options,!1);else if(W1[J]&&J==="placeholder")Q[J].options.placeholder=Q[J].options.name,delete Q[J].options.name,Q[J].options._placeholderType=Q[J].options.type,delete Q[J].options.type,Q[J].options._placeholderIdx=100+K,L5(Z,[{text:Q[J].text}],Q[J].options,!0)});if($.slideNumber&&typeof $.slideNumber==="object")q._slideNumberProps=$.slideNumber}function GJ($,q,Q,K){var J;function Z(w){if(!w||w.style==="none")return;if(w.size!==void 0&&(isNaN(Number(w.size))||w.size<=0))console.warn("Warning: chart.gridLine.size must be greater than 0."),delete w.size;if(w.style&&!["solid","dash","dot"].includes(w.style))console.warn("Warning: chart.gridLine.style options: `solid`, `dash`, `dot`."),delete w.style;if(w.cap&&!["flat","square","round"].includes(w.cap))console.warn("Warning: chart.gridLine.cap options: `flat`, `square`, `round`."),delete w.cap}let G=++HB,W={_type:null,text:null,options:null,chartRid:null},B=null,V=[];if(Array.isArray(q))q.forEach((w)=>{V=V.concat(w.data)}),B=Q||K;else V=Q,B=K;V.forEach((w,F)=>{if(w._dataIndex=F,w.labels!==void 0&&!Array.isArray(w.labels[0]))w.labels=[w.labels]});let U=B&&typeof B==="object"?B:{};if(U._type=q,U.x=typeof U.x<"u"&&U.x!=null&&!isNaN(Number(U.x))?U.x:1,U.y=typeof U.y<"u"&&U.y!=null&&!isNaN(Number(U.y))?U.y:1,U.w=U.w||"50%",U.h=U.h||"50%",U.objectName=U.objectName?k0(U.objectName):`Chart ${$._slideObjects.filter((w)=>w._type===D0.chart).length}`,!["bar","col"].includes(U.barDir||""))U.barDir="col";if(U._type===q0.AREA){if(!["stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if(U._type===q0.BAR){if(!["clustered","stacked","percentStacked"].includes(U.barGrouping||""))U.barGrouping="clustered"}if(U._type===q0.BAR3D){if(!["clustered","stacked","standard","percentStacked"].includes(U.barGrouping||""))U.barGrouping="standard"}if((J=U.barGrouping)===null||J===void 0?void 0:J.includes("tacked")){if(!U.barGapWidthPct)U.barGapWidthPct=50}if(U.dataLabelPosition){if(U._type===q0.AREA||U._type===q0.BAR3D||U._type===q0.DOUGHNUT||U._type===q0.RADAR)delete U.dataLabelPosition;if(U._type===q0.PIE){if(!["bestFit","ctr","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BUBBLE||U._type===q0.BUBBLE3D||U._type===q0.LINE||U._type===q0.SCATTER){if(!["b","ctr","l","r","t"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(U._type===q0.BAR){if(!["stacked","percentStacked"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}if(!["clustered"].includes(U.barGrouping||"")){if(!["ctr","inBase","inEnd","outEnd"].includes(U.dataLabelPosition))delete U.dataLabelPosition}}}if(U.dataLabelBkgrdColors=U.dataLabelBkgrdColors||!U.dataLabelBkgrdColors?U.dataLabelBkgrdColors:!1,!["b","l","r","t","tr"].includes(U.legendPos||""))U.legendPos="r";if(!["cone","coneToMax","box","cylinder","pyramid","pyramidToMax"].includes(U.bar3DShape||""))U.bar3DShape="box";if(!["circle","dash","diamond","dot","none","square","triangle"].includes(U.lineDataSymbol||""))U.lineDataSymbol="circle";if(!["gap","span"].includes(U.displayBlanksAs||""))U.displayBlanksAs="span";if(!["standard","marker","filled"].includes(U.radarStyle||""))U.radarStyle="standard";if(U.lineDataSymbolSize=U.lineDataSymbolSize&&!isNaN(U.lineDataSymbolSize)?U.lineDataSymbolSize:6,U.lineDataSymbolLineSize=U.lineDataSymbolLineSize&&!isNaN(U.lineDataSymbolLineSize)?Y0(U.lineDataSymbolLineSize):Y0(0.75),U.layout)["x","y","w","h"].forEach((w)=>{let F=U.layout[w];if(isNaN(Number(F))||F<0||F>1)console.warn("Warning: chart.layout."+w+" can only be 0-1"),delete U.layout[w]});if(U.catGridLine=U.catGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),U.valGridLine=U.valGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{}),U.serGridLine=U.serGridLine||(U._type===q0.SCATTER?{color:"D9D9D9",size:1}:{style:"none"}),Z(U.catGridLine),Z(U.valGridLine),Z(U.serGridLine),c7(U.shadow),U.showDataTable=U.showDataTable||!U.showDataTable?U.showDataTable:!1,U.showDataTableHorzBorder=U.showDataTableHorzBorder||!U.showDataTableHorzBorder?U.showDataTableHorzBorder:!0,U.showDataTableVertBorder=U.showDataTableVertBorder||!U.showDataTableVertBorder?U.showDataTableVertBorder:!0,U.showDataTableOutline=U.showDataTableOutline||!U.showDataTableOutline?U.showDataTableOutline:!0,U.showDataTableKeys=U.showDataTableKeys||!U.showDataTableKeys?U.showDataTableKeys:!0,U.showLabel=U.showLabel||!U.showLabel?U.showLabel:!1,U.showLegend=U.showLegend||!U.showLegend?U.showLegend:!1,U.showPercent=U.showPercent||!U.showPercent?U.showPercent:!0,U.showTitle=U.showTitle||!U.showTitle?U.showTitle:!1,U.showValue=U.showValue||!U.showValue?U.showValue:!1,U.showLeaderLines=U.showLeaderLines||!U.showLeaderLines?U.showLeaderLines:!1,U.catAxisLineShow=typeof U.catAxisLineShow<"u"?U.catAxisLineShow:!0,U.valAxisLineShow=typeof U.valAxisLineShow<"u"?U.valAxisLineShow:!0,U.serAxisLineShow=typeof U.serAxisLineShow<"u"?U.serAxisLineShow:!0,U.v3DRotX=!isNaN(U.v3DRotX)&&U.v3DRotX>=-90&&U.v3DRotX<=90?U.v3DRotX:30,U.v3DRotY=!isNaN(U.v3DRotY)&&U.v3DRotY>=0&&U.v3DRotY<=360?U.v3DRotY:30,U.v3DRAngAx=U.v3DRAngAx||!U.v3DRAngAx?U.v3DRAngAx:!0,U.v3DPerspective=!isNaN(U.v3DPerspective)&&U.v3DPerspective>=0&&U.v3DPerspective<=240?U.v3DPerspective:30,U.barGapWidthPct=!isNaN(U.barGapWidthPct)&&U.barGapWidthPct>=0&&U.barGapWidthPct<=1000?U.barGapWidthPct:150,U.barGapDepthPct=!isNaN(U.barGapDepthPct)&&U.barGapDepthPct>=0&&U.barGapDepthPct<=1000?U.barGapDepthPct:150,U.chartColors=Array.isArray(U.chartColors)?U.chartColors:U._type===q0.PIE||U._type===q0.DOUGHNUT?NB:z8,U.chartColorsOpacity=U.chartColorsOpacity&&!isNaN(U.chartColorsOpacity)?U.chartColorsOpacity:null,U.border=U.border&&typeof U.border==="object"?U.border:null,U.border&&(!U.border.pt||isNaN(U.border.pt)))U.border.pt=v6.pt;if(U.border&&(!U.border.color||typeof U.border.color!=="string"))U.border.color=v6.color;if(U.plotArea=U.plotArea||{},U.plotArea.border=U.plotArea.border&&typeof U.plotArea.border==="object"?U.plotArea.border:null,U.plotArea.border&&(!U.plotArea.border.pt||isNaN(U.plotArea.border.pt)))U.plotArea.border.pt=v6.pt;if(U.plotArea.border&&(!U.plotArea.border.color||typeof U.plotArea.border.color!=="string"))U.plotArea.border.color=v6.color;if(U.border)U.plotArea.border=U.border;if(U.plotArea.fill=U.plotArea.fill||{color:null,transparency:null},U.fill)U.plotArea.fill.color=U.fill;if(U.chartArea=U.chartArea||{},U.chartArea.border=U.chartArea.border&&typeof U.chartArea.border==="object"?U.chartArea.border:null,U.chartArea.border)U.chartArea.border={color:U.chartArea.border.color||v6.color,pt:U.chartArea.border.pt||v6.pt};if(U.chartArea.roundedCorners=typeof U.chartArea.roundedCorners==="boolean"?U.chartArea.roundedCorners:!0,U.dataBorder=U.dataBorder&&typeof U.dataBorder==="object"?U.dataBorder:null,U.dataBorder&&(!U.dataBorder.pt||isNaN(U.dataBorder.pt)))U.dataBorder.pt=0.75;if(U.dataBorder&&U.dataBorder.color){let w=typeof U.dataBorder.color==="string"&&U.dataBorder.color.length===6&&/^[0-9A-Fa-f]{6}$/.test(U.dataBorder.color),F=Object.values(D5).includes(U.dataBorder.color);if(!w&&!F)U.dataBorder.color="F9F9F9"}if(!U.dataLabelFormatCode&&U._type===q0.SCATTER)U.dataLabelFormatCode="General";if(!U.dataLabelFormatCode&&(U._type===q0.PIE||U._type===q0.DOUGHNUT))U.dataLabelFormatCode=U.showPercent?"0%":"General";if(U.dataLabelFormatCode=U.dataLabelFormatCode&&typeof U.dataLabelFormatCode==="string"?U.dataLabelFormatCode:"#,##0",!U.dataLabelFormatScatter&&U._type===q0.SCATTER)U.dataLabelFormatScatter="custom";if(U.lineSize=typeof U.lineSize==="number"?U.lineSize:2,U.valAxisMajorUnit=typeof U.valAxisMajorUnit==="number"?U.valAxisMajorUnit:null,U._type===q0.AREA||U._type===q0.BAR||U._type===q0.BAR3D||U._type===q0.LINE)U.catAxisMultiLevelLabels=!!U.catAxisMultiLevelLabels;else delete U.catAxisMultiLevelLabels;return W._type="chart",W.options=U,W.chartRid=a2($),$._relsChart.push({rId:a2($),data:V,opts:U,type:U._type,globalId:G,fileName:`chart${G}.xml`,Target:`/ppt/charts/chart${G}.xml`}),$._slideObjects.push(W),W}function WJ($,q){let Q={_type:null,text:null,options:null,image:null,imageRid:null,hyperlink:null},K=q.x||0,J=q.y||0,Z=q.w||0,G=q.h||0,W=q.sizing||null,B=q.hyperlink||"",V=q.data||"",U=q.path||"",w=a2($),F=q.objectName?k0(q.objectName):`Image ${$._slideObjects.filter((k)=>k._type===D0.image).length}`;if(!U&&!V)return console.error("ERROR: addImage() requires either 'data' or 'path' parameter!"),null;else if(U&&typeof U!=="string")return console.error(`ERROR: addImage() 'path' should be a string, ex: {path:'/img/sample.png'} - you sent ${String(U)}`),null;else if(V&&typeof V!=="string")return console.error(`ERROR: addImage() 'data' should be a string, ex: {data:'image/png;base64,NMP[...]'} - you sent ${String(V)}`),null;else if(V&&typeof V==="string"&&!V.toLowerCase().includes("base64,"))return console.error("ERROR: Image `data` value lacks a base64 header! Ex: 'image/png;base64,NMP[...]')"),null;let M=(U.substring(U.lastIndexOf("/")+1).split("?")[0].split(".").pop().split("#")[0]||"png").toLowerCase();if(V&&/image\/(\w+);/.exec(V)&&/image\/(\w+);/.exec(V).length>0)M=/image\/(\w+);/.exec(V)[1];else if(V===null||V===void 0?void 0:V.toLowerCase().includes("image/svg+xml"))M="svg";if(Q._type=D0.image,Q.image=U||"preencoded.png",Q.options={x:K||0,y:J||0,w:Z||1,h:G||1,altText:q.altText||"",rounding:typeof q.rounding==="boolean"?q.rounding:!1,sizing:W,placeholder:q.placeholder,rotate:q.rotate||0,flipV:q.flipV||!1,flipH:q.flipH||!1,transparency:q.transparency||0,objectName:F,shadow:c7(q.shadow)},M==="svg")$._relsMedia.push({path:U||V+"png",type:"image/png",extn:"png",data:V||"",rId:w,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`,isSvgPng:!0,svgSize:{w:H0(Q.options.w,"X",$._presLayout),h:H0(Q.options.h,"Y",$._presLayout)}}),Q.imageRid=w,$._relsMedia.push({path:U||V,type:"image/svg+xml",extn:M,data:V||"",rId:w+1,Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w+1;else{let k=$._relsMedia.filter((f)=>f.path&&f.path===U&&f.type==="image/"+M&&!f.isDuplicate)[0];$._relsMedia.push({path:U||"preencoded."+M,type:"image/"+M,extn:M,data:V||"",rId:w,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.${M}`}),Q.imageRid=w}if(typeof B==="object")if(!B.url&&!B.slide)throw Error("ERROR: `hyperlink` option requires either: `url` or `slide`");else w++,$._rels.push({type:D0.hyperlink,data:B.slide?"slide":"dummy",rId:w,Target:B.url||B.slide.toString()}),B._rId=w,Q.hyperlink=B;$._slideObjects.push(Q)}function fB($,q){let Q=q.x||0,K=q.y||0,J=q.w||2,Z=q.h||2,G=q.data||"",W=q.link||"",B=q.path||"",V=q.type||"audio",U="",w=q.cover||YB,F=q.objectName?k0(q.objectName):`Media ${$._slideObjects.filter((k)=>k._type===D0.media).length}`,M={_type:D0.media};if(!B&&!G&&V!=="online")throw Error("addMedia() error: either `data` or `path` are required!");else if(G&&!G.toLowerCase().includes("base64,"))throw Error("addMedia() error: `data` value lacks a base64 header! Ex: 'video/mpeg;base64,NMP[...]')");else if(!w.toLowerCase().includes("base64,"))throw Error("addMedia() error: `cover` value lacks a base64 header! Ex: 'data:image/png;base64,iV[...]')");if(V==="online"&&!W)throw Error("addMedia() error: online videos require `link` value");if(U=q.extn||(G?G.split(";")[0].split("/")[1]:B.split(".").pop())||"mp3",M.mtype=V,M.media=B||"preencoded.mov",M.options={},M.options.x=Q,M.options.y=K,M.options.w=J,M.options.h=Z,M.options.objectName=F,V==="online"){let k=a2($);$._relsMedia.push({path:B||"preencoded"+U,data:"dummy",type:"online",extn:U,rId:k,Target:W}),M.mediaRid=k,$._relsMedia.push({path:"preencoded.png",data:w,type:"image/png",extn:"png",rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}else{let k=$._relsMedia.filter((L)=>L.path&&L.path===B&&L.type===V+"/"+U&&!L.isDuplicate)[0],f=a2($);$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:f,isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+1}.${U}`}),M.mediaRid=f,$._relsMedia.push({path:B||"preencoded"+U,type:V+"/"+U,extn:U,data:G||"",rId:a2($),isDuplicate:!!(k===null||k===void 0?void 0:k.Target),Target:(k===null||k===void 0?void 0:k.Target)?k.Target:`../media/media-${$._slideNum}-${$._relsMedia.length+0}.${U}`}),$._relsMedia.push({path:"preencoded.png",type:"image/png",extn:"png",data:w,rId:a2($),Target:`../media/image-${$._slideNum}-${$._relsMedia.length+1}.png`})}$._slideObjects.push(M)}function RB($,q){$._slideObjects.push({_type:D0.notes,text:[{text:q}]})}function E7($,q,Q){let K=typeof Q==="object"?Q:{};K.line=K.line||{type:"none"};let J={_type:D0.text,shape:q||B1.RECTANGLE,options:K,text:null};if(!q)throw Error("Missing/Invalid shape parameter! Example: `addShape(pptxgen.shapes.LINE, {x:1, y:1, w:1, h:1});`");let Z={type:K.line.type||"solid",color:K.line.color||JJ,transparency:K.line.transparency||0,width:K.line.width||1,dashType:K.line.dashType||"solid",beginArrowType:K.line.beginArrowType||null,endArrowType:K.line.endArrowType||null};if(typeof K.line==="object"&&K.line.type!=="none")K.line=Z;if(K.x=K.x||(K.x===0?0:1),K.y=K.y||(K.y===0?0:1),K.w=K.w||(K.w===0?0:1),K.h=K.h||(K.h===0?0:1),K.objectName=K.objectName?k0(K.objectName):`Shape ${$._slideObjects.filter((G)=>G._type===D0.text).length}`,typeof K.line==="string"){let G=Z;G.color=String(K.line),K.line=G}if(typeof K.lineSize==="number")K.line.width=K.lineSize;if(typeof K.lineDash==="string")K.line.dashType=K.lineDash;if(typeof K.lineHead==="string")K.line.beginArrowType=K.lineHead;if(typeof K.lineTail==="string")K.line.endArrowType=K.lineTail;g6($,J),$._slideObjects.push(J)}function IB($,q,Q,K,J,Z,G){let W=[$],B=Q&&typeof Q==="object"?Q:{};B.objectName=B.objectName?k0(B.objectName):`Table ${$._slideObjects.filter((F)=>F._type===D0.table).length}`;{if(q===null||q.length===0||!Array.isArray(q))throw Error("addTable: Array expected! EX: 'slide.addTable( [rows], {options} );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)");if(!q[0]||!Array.isArray(q[0]))throw Error("addTable: 'rows' should be an array of cells! EX: 'slide.addTable( [ ['A'], ['B'], {text:'C',options:{align:'center'}} ] );' (https://gitbrent.github.io/PptxGenJS/docs/api-tables.html)")}let V=[];if(q.forEach((F)=>{let M=[];if(Array.isArray(F))F.forEach((k)=>{let f={_type:D0.tablecell,text:"",options:typeof k==="object"&&k.options?k.options:{}};if(typeof k==="string"||typeof k==="number")f.text=k.toString();else if(k.text){if(typeof k.text==="string"||typeof k.text==="number")f.text=k.text.toString();else if(k.text)f.text=k.text;if(k.options&&typeof k.options==="object")f.options=k.options}f.options.border=f.options.border||B.border||[{type:"none"},{type:"none"},{type:"none"},{type:"none"}];let L=f.options.border;if(!Array.isArray(L)&&typeof L==="object")f.options.border=[L,L,L,L];if(!f.options.border[0])f.options.border[0]={type:"none"};if(!f.options.border[1])f.options.border[1]={type:"none"};if(!f.options.border[2])f.options.border[2]={type:"none"};if(!f.options.border[3])f.options.border[3]={type:"none"};[0,1,2,3].forEach((z)=>{f.options.border[z]={type:f.options.border[z].type||H6.type,color:f.options.border[z].color||H6.color,pt:typeof f.options.border[z].pt==="number"?f.options.border[z].pt:H6.pt}}),M.push(f)});else console.log("addTable: tableRows has a bad row. A row should be an array of cells. You provided:"),console.log(F);V.push(M)}),B.x=H0(B.x||(B.x===0?0:L0/2),"X",J),B.y=H0(B.y||(B.y===0?0:L0/2),"Y",J),B.h)B.h=H0(B.h,"Y",J);if(B.fontSize=B.fontSize||k2,B.margin=B.margin===0||B.margin?B.margin:KJ,typeof B.margin==="number")B.margin=[Number(B.margin),Number(B.margin),Number(B.margin),Number(B.margin)];if(JSON.stringify({arrRows:V}).indexOf("hyperlink")===-1){if(!B.color)B.color=B.color||Q2}if(typeof B.border==="string")console.warn("addTable `border` option must be an object. Ex: `{border: {type:'none'}}`"),B.border=null;else if(Array.isArray(B.border))[0,1,2,3].forEach((F)=>{B.border[F]=B.border[F]?{type:B.border[F].type||H6.type,color:B.border[F].color||H6.color,pt:B.border[F].pt||H6.pt}:{type:"none"}});if(B.autoPage=typeof B.autoPage==="boolean"?B.autoPage:!1,B.autoPageRepeatHeader=typeof B.autoPageRepeatHeader==="boolean"?B.autoPageRepeatHeader:!1,B.autoPageHeaderRows=typeof B.autoPageHeaderRows<"u"&&!isNaN(Number(B.autoPageHeaderRows))?Number(B.autoPageHeaderRows):1,B.autoPageLineWeight=typeof B.autoPageLineWeight<"u"&&!isNaN(Number(B.autoPageLineWeight))?Number(B.autoPageLineWeight):0,B.autoPageLineWeight){if(B.autoPageLineWeight>1)B.autoPageLineWeight=1;else if(B.autoPageLineWeight<-1)B.autoPageLineWeight=-1}let U=M8;if(K&&typeof K._margin<"u"){if(Array.isArray(K._margin))U=K._margin;else if(!isNaN(Number(K._margin)))U=[Number(K._margin),Number(K._margin),Number(K._margin),Number(K._margin)]}if(B.colW){let F=V[0].reduce((M,k)=>{var f;if(((f=k===null||k===void 0?void 0:k.options)===null||f===void 0?void 0:f.colspan)&&typeof k.options.colspan==="number")M+=k.options.colspan;else M+=1;return M},0);if(typeof B.colW==="string"||typeof B.colW==="number")B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length===1&&F>1)B.w=Math.floor(Number(B.colW)*F),B.colW=null;else if(B.colW&&Array.isArray(B.colW)&&B.colW.length!==F)console.warn("addTable: mismatch: (colW.length != data.length) Therefore, defaulting to evenly distributed col widths."),B.colW=null}else if(B.w)B.w=H0(B.w,"X",J);else B.w=Math.floor(J._sizeW/L0-U[1]-U[3]);if(B.x&&B.x<20)B.x=v0(B.x);if(B.y&&B.y<20)B.y=v0(B.y);if(B.w&&typeof B.w==="number"&&B.w<20)B.w=v0(B.w);if(B.h&&typeof B.h==="number"&&B.h<20)B.h=v0(B.h);V.forEach((F)=>{F.forEach((M,k)=>{if(typeof M==="number"||typeof M==="string")F[k]={_type:D0.tablecell,text:String(F[k]),options:B};else if(typeof M==="object"){if(typeof M.text==="number")F[k].text=F[k].text.toString();else if(typeof M.text>"u"||M.text===null)F[k].text="";F[k].options=M.options||{},F[k]._type=D0.tablecell}})});let w=[];if(B&&!B.autoPage)g6($,V),$._slideObjects.push({_type:D0.table,arrTabRows:V,options:Object.assign({},B)});else{if(B.autoPageRepeatHeader)B._arrObjTabHeadRows=V.filter((F,M)=>M<B.autoPageHeaderRows);ZJ(V,B,J,K).forEach((F,M)=>{if(!G($._slideNum+M))W.push(Z({masterName:(K===null||K===void 0?void 0:K._name)||null}));if(M>0)B.y=v0(B.autoPageSlideStartY||B.newSlideStartY||U[0]);{let k=G($._slideNum+M);if(B.autoPage=!1,g6(k,F.rows),k.addTable(F.rows,Object.assign({},B)),M>0)w.push(k)}})}return w}function L5($,q,Q,K){let J={_type:K?D0.placeholder:D0.text,shape:(Q===null||Q===void 0?void 0:Q.shape)||B1.RECTANGLE,text:!q||q.length===0?[{text:"",options:null}]:q,options:Q||{}};function Z(G){{if(!G.placeholder)G.color=G.color||J.options.color||$.color||Q2;if(G.placeholder||K)G.bullet=G.bullet||!1;if(G.placeholder&&$._slideLayout&&$._slideLayout._slideObjects){let W=$._slideLayout._slideObjects.filter((B)=>B._type==="placeholder"&&B.options&&B.options.placeholder&&B.options.placeholder===G.placeholder)[0];if(W===null||W===void 0?void 0:W.options)G=Object.assign(Object.assign({},G),W.options)}if(G.objectName=G.objectName?k0(G.objectName):`Text ${$._slideObjects.filter((W)=>W._type===D0.text).length}`,G.shape===B1.LINE){let W={type:G.line.type||"solid",color:G.line.color||JJ,transparency:G.line.transparency||0,width:G.line.width||1,dashType:G.line.dashType||"solid",beginArrowType:G.line.beginArrowType||null,endArrowType:G.line.endArrowType||null};if(typeof G.line==="object")G.line=W;if(typeof G.line==="string"){let B=W;if(typeof G.line==="string")B.color=G.line;G.line=B}if(typeof G.lineSize==="number")G.line.width=G.lineSize;if(typeof G.lineDash==="string")G.line.dashType=G.lineDash;if(typeof G.lineHead==="string")G.line.beginArrowType=G.lineHead;if(typeof G.lineTail==="string")G.line.endArrowType=G.lineTail}if(G.line=G.line||{},G.lineSpacing=G.lineSpacing&&!isNaN(G.lineSpacing)?G.lineSpacing:null,G.lineSpacingMultiple=G.lineSpacingMultiple&&!isNaN(G.lineSpacingMultiple)?G.lineSpacingMultiple:null,G._bodyProp=G._bodyProp||{},G._bodyProp.autoFit=G.autoFit||!1,G._bodyProp.anchor=!G.placeholder?I6.ctr:null,G._bodyProp.vert=G.vert||null,G._bodyProp.wrap=typeof G.wrap==="boolean"?G.wrap:!0,G.inset&&!isNaN(Number(G.inset))||G.inset===0)G._bodyProp.lIns=v0(G.inset),G._bodyProp.rIns=v0(G.inset),G._bodyProp.tIns=v0(G.inset),G._bodyProp.bIns=v0(G.inset);if(typeof G.underline==="boolean"&&G.underline===!0)G.underline={style:"sng"}}{if((G.align||"").toLowerCase().indexOf("c")===0)G._bodyProp.align=R6.center;else if((G.align||"").toLowerCase().indexOf("l")===0)G._bodyProp.align=R6.left;else if((G.align||"").toLowerCase().indexOf("r")===0)G._bodyProp.align=R6.right;else if((G.align||"").toLowerCase().indexOf("j")===0)G._bodyProp.align=R6.justify;if((G.valign||"").toLowerCase().indexOf("b")===0)G._bodyProp.anchor=I6.b;else if((G.valign||"").toLowerCase().indexOf("m")===0)G._bodyProp.anchor=I6.ctr;else if((G.valign||"").toLowerCase().indexOf("t")===0)G._bodyProp.anchor=I6.t}return c7(G.shadow),G}J.options=Z(J.options),J.text.forEach((G)=>G.options=Z(G.options||{})),g6($,J.text||""),$._slideObjects.push(J)}function CB($){($._slideLayout._slideObjects||[]).forEach((q)=>{if(q._type===D0.placeholder){if($._slideObjects.filter((Q)=>Q.options&&Q.options.placeholder===q.options.placeholder).length===0)L5($,[{text:""}],q.options,!1)}})}function BJ($,q){var Q;if(q.bkgd){if(!q.background)q.background={};if(typeof q.bkgd==="string")q.background.color=q.bkgd;else{if(q.bkgd.data)q.background.data=q.bkgd.data;if(q.bkgd.path)q.background.path=q.bkgd.path;if(q.bkgd.src)q.background.path=q.bkgd.src}}if((Q=q.background)===null||Q===void 0?void 0:Q.fill)q.background.color=q.background.fill;if($&&($.path||$.data)){$.path=$.path||"preencoded.png";let K=($.path.split(".").pop()||"png").split("?")[0];if(K==="jpg")K="jpeg";q._relsMedia=q._relsMedia||[];let J=q._relsMedia.length+1;q._relsMedia.push({path:$.path,type:D0.image,extn:K,data:$.data||null,rId:J,Target:`../media/${(q._name||"").replace(/\s+/gi,"-")}-image-${q._relsMedia.length+1}.${K}`}),q._bkgdImgRid=J}}function g6($,q,Q){let K=[];if(typeof q==="string"||typeof q==="number")return;else if(Array.isArray(q))K=q;else if(typeof q==="object")K=[q];K.forEach((J,Z)=>{if(Q&&Q[Z]&&Q[Z].hyperlink)J.options=Object.assign(Object.assign({},J.options),Q[Z]);if(Array.isArray(J)){let G=[];J.forEach((W)=>{if(W.options&&!W.text.options)G.push(W.options)}),g6($,J,G)}else if(Array.isArray(J.text))g6($,J.text,Q&&Q[Z]?[Q[Z]]:void 0);else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&!J.options.hyperlink._rId)if(typeof J.options.hyperlink!=="object")console.log("ERROR: text `hyperlink` option should be an object. Ex: `hyperlink: {url:'https://github.com'}` ");else if(!J.options.hyperlink.url&&!J.options.hyperlink.slide)console.log("ERROR: 'hyperlink requires either: `url` or `slide`'");else{let G=a2($);$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:G,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()}),J.options.hyperlink._rId=G}else if(J&&typeof J==="object"&&J.options&&J.options.hyperlink&&J.options.hyperlink._rId){if($._rels.filter((G)=>G.rId===J.options.hyperlink._rId).length===0)$._rels.push({type:D0.hyperlink,data:J.options.hyperlink.slide?"slide":"dummy",rId:J.options.hyperlink._rId,Target:k0(J.options.hyperlink.url)||J.options.hyperlink.slide.toString()})}})}class zJ{constructor($){var q;this.addSlide=$.addSlide,this.getSlide=$.getSlide,this._name=`Slide ${$.slideNumber}`,this._presLayout=$.presLayout,this._rId=$.slideRId,this._rels=[],this._relsChart=[],this._relsMedia=[],this._setSlideNum=$.setSlideNum,this._slideId=$.slideId,this._slideLayout=$.slideLayout||null,this._slideNum=$.slideNumber,this._slideObjects=[],this._slideNumberProps=((q=this._slideLayout)===null||q===void 0?void 0:q._slideNumberProps)?this._slideLayout._slideNumberProps:null}set bkgd($){if(this._bkgd=$,!this._background||!this._background.color){if(!this._background)this._background={};if(typeof $==="string")this._background.color=$}}get bkgd(){return this._bkgd}set background($){if(this._background=$,$)BJ($,this)}get background(){return this._background}set color($){this._color=$}get color(){return this._color}set hidden($){this._hidden=$}get hidden(){return this._hidden}set slideNumber($){this._slideNumberProps=$,this._setSlideNum($)}get slideNumber(){return this._slideNumberProps}get newAutoPagedSlides(){return this._newAutoPagedSlides}addChart($,q,Q){let K=Q||{};return K._type=$,GJ(this,$,q,Q),this}addImage($){return WJ(this,$),this}addMedia($){return fB(this,$),this}addNotes($){return RB(this,$),this}addShape($,q){return E7(this,$,q),this}addTable($,q){return this._newAutoPagedSlides=IB(this,$,q,this._slideLayout,this._presLayout,this.addSlide,this.getSlide),this}addText($,q){return L5(this,typeof $==="string"||typeof $==="number"?[{text:$,options:q}]:$,q,!1),this}}function jB($,q){return W2(this,void 0,void 0,function*(){let Q=$.data;return yield new Promise((K,J)=>{var Z,G;let W=new _7.default,B=(Q.length-1)*2+1,V=((G=(Z=Q[0])===null||Z===void 0?void 0:Z.labels)===null||G===void 0?void 0:G.length)>1;W.folder("_rels"),W.folder("docProps"),W.folder("xl/_rels"),W.folder("xl/tables"),W.folder("xl/theme"),W.folder("xl/worksheets"),W.folder("xl/worksheets/_rels"),W.file("[Content_Types].xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/> <Default Extension="xml" ContentType="application/xml"/> <Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/> <Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/> <Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/> <Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/> <Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/> <Override PartName="/xl/tables/table1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"/> <Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/> <Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>\n'),W.file("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships> |