import{a as E}from"./chunk-YQXLYYOT.js";import{d as T,f as I}from"./chunk-S3ADKFO2.js";import{d as k,n as M}from"./chunk-I5MYHHJE.js";import{Ab as h,Bb as P,Db as S,Eb as v,Fb as y,Fc as m,Gb as r,Gc as f,Hb as o,Hc as F,Ib as C,Tb as O,Vb as d,Wa as l,gb as _,ic as s,jc as x,kc as p,lb as b,rb as u,zb as w}from"./chunk-CKLXM6EG.js";function B(i,e){if(i&1&&(r(0,"p",3),s(1),m(2,"translate"),o(),r(3,"p",10),s(4),m(5,"translate"),o()),i&2){let t=d();l(),x(f(2,2,"SO")),l(3),p("( ",f(5,4,t.titleForPrint)," )")}}function H(i,e){if(i&1&&(s(0),m(1,"translate")),i&2){let t=d();x(f(1,1,t.titleForPrint))}}function D(i,e){if(i&1&&(r(0,"div",6)(1,"div",11)(2,"span",12),s(3),m(4,"translate"),o(),r(5,"span",13)(6,"span"),s(7),o()()()()),i&2){let t=e.$implicit,n=d();l(3),p(" ",f(4,2,n.translationPrefix+"."+t)," "),l(4),p(" ",n.getNestedValue(t)," ")}}function N(i,e){if(i&1&&(r(0,"th"),s(1),m(2,"translate"),o()),i&2){let t=e.$implicit,n=d();l(),p(" ",F(2,1,n.translationPrefix+"."+((t==null?null:t.key)||t),n.getTranslateParams(t))," ")}}function V(i,e){if(i&1&&(r(0,"td"),s(1),o()),i&2){let t=e.$implicit,n=d().$implicit,a=d();l(),p(" ",a.getValuee(n,t)," ")}}function A(i,e){if(i&1&&(r(0,"tr"),u(1,V,2,1,"td",9),o()),i&2){let t=d();l(),y("ngForOf",t.itemsHeaders)}}var j=class i{constructor(e){this.currencyService=e}data;keys;itemsHeaders;translationPrefix;titleForPrint;So=!1;getNestedValue(e,t=this.data){return this.getValue(e,t)}getValue(e,t){return e.split(".").reduce((n,a)=>n?.[a],t)}getValuee(e,t){if(typeof t=="object"&&t!==null){let a=e[t.key],c=e[t.key2];return`${a??"---"} ${c??""}`.trim()}let n=t.match(/(\w+)\[(\w+)\]/);if(n){let a=n[1],c=n[2],g=e[a];return Array.isArray(g)?g.map($=>$[c]):null}return t.split(".").reduce((a,c)=>a?.[c],e)}ngOnInit(){}getTranslateParams(e){let n=((typeof e=="object"&&e!==null?e.key:e)||"").toLowerCase();return this.currencyService.getTranslateParams(n)}print(){setTimeout(()=>{let e=document.getElementById("print");if(!e)return;let t=window.open("","_blank","width=1200,height=800");if(!t)return;let n=localStorage.getItem("direction")||"ltr",a=Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).map(c=>c.outerHTML).join(`
`);t.document.open(),t.document.write(`
      <html>
        <head>
          <link rel="stylesheet"
            href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
          ${a}
          <style>
            body { direction: ${n}; }

            table {
              width: 100% !important;
              table-layout: fixed;
            }

            th, td {
              word-wrap: break-word;
              font-size: 11px;
            }

            @media print {
              @page {
                size: A4 landscape;   /* \u2705 KEY FIX */
                margin: 8mm;
              }

              body {
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
              }
            }
          </style>
        </head>
        <body onload="window.print();window.close();">
          ${e.innerHTML}
        </body>
            <script>
          window.onafterprint = function () {
            window.close();
          };

          window.onload = function () {
            window.print();
          };
        <\/script>
      </html>
    `),t.document.close()})}static \u0275fac=function(t){return new(t||i)(_(E))};static \u0275cmp=b({type:i,selectors:[["app-print-for-show-one"]],inputs:{data:"data",keys:"keys",itemsHeaders:"itemsHeaders",translationPrefix:"translationPrefix",titleForPrint:"titleForPrint",So:"So"},decls:17,vars:3,consts:[[1,"bg-orange","border-0","text-center","d-flex","justify-content-center",3,"click"],[1,"fa-solid","fa-download","text-center"],["id","print",1,"my-5","d-none"],[1,"text-center","fs-2","fw-bold","my-3"],[1,"container-fluid"],[1,"row","g-3"],[1,"col-md-6","col-sm-6"],[1,"table","table-bordered","mt-4"],[1,"text-center"],[4,"ngFor","ngForOf"],[1,"text-center","fs-4","fw-bold","my-3"],[1,"dotted-field"],[1,"label","fw-bold"],[1,"dots"]],template:function(t,n){t&1&&(r(0,"button",0),O("click",function(){return n.print()}),C(1,"i",1),o(),r(2,"Div",2)(3,"p",3),w(4,B,6,6)(5,H,2,3),o(),r(6,"div",4)(7,"div",5),S(8,D,8,4,"div",6,P),o()(),r(10,"div")(11,"table",7)(12,"thead",8)(13,"tr"),u(14,N,3,4,"th",9),o()(),r(15,"tbody"),u(16,A,2,1,"tr",9),o()()()()),t&2&&(l(4),h(n.So?4:5),l(4),v(n.keys),l(6),y("ngForOf",n.itemsHeaders),l(2),y("ngForOf",n.data==null?null:n.data.items))},dependencies:[I,M,k,T],styles:["[_nghost-%COMP%]     .bg-orange{border-radius:8px;background-color:var(--secondary-color);display:flex;width:32px;height:32px;padding:8px;justify-content:center;align-items:center;gap:16px;aspect-ratio:1/1;color:#fff}.dotted-field[_ngcontent-%COMP%]{display:flex;align-items:center;gap:8px}.dotted-field[_ngcontent-%COMP%]   .dots[_ngcontent-%COMP%]{flex:1;border-bottom:1px dotted #000;margin-top:5px}.table[_ngcontent-%COMP%]{width:100%;border:1px solid black}.accordion-title[_ngcontent-%COMP%]{display:none!important}@media print{table.table-bordered[_ngcontent-%COMP%]   td[_ngcontent-%COMP%], table.table-bordered[_ngcontent-%COMP%]   th[_ngcontent-%COMP%]{padding:30px!important}}"]})};export{j as a};
