1"use strict";(self.webpackChunknsa_portal=self.webpackChunknsa_portal||[]).push([[4867],{96462(e,t,r){r.d(t,{CL:()=>s,bf:()=>n});const i=e=>{const t=Number(e);return Number.isFinite(t)?t:0};function s(e){return(e=>!!e&&"webstore"===e.source)(e)?{isWebstore:!0,processing:Math.max(0,i(e._omg_processing)),tax:Math.max(0,i(e._omg_tax)),shipping:Math.max(0,i(e._omg_shipping)),ccFees:Math.max(0,i(e._omg_cc_fees))}:{isWebstore:!1,processing:0,tax:0,shipping:0,ccFees:0}}function n(e,t){const r=s(e),i=(e,r)=>({cells:[{value:"",style:"border:none"},{value:"",style:"border:none"},{value:"",style:"border:none"},{value:"<strong>"+e+"</strong>",style:"text-align:right;border:none"},{value:t(r),style:"text-align:right;border:none"}]}),n=[];return r.shipping>0&&n.push(i("Shipping (charged at checkout)",r.shipping)),r.processing>0&&n.push(i("Online processing fee",r.processing)),r.tax>0&&n.push(i("Sales tax (collected at checkout)",r.tax)),{rows:n,extra:Math.round(100*(r.shipping+r.processing+r.tax))/100}}},4867(e,t,r){r.d(t,{$t:()=>O,EN:()=>d,G5:()=>u,HF:()=>b,I2:()=>R,Jt:()=>w,Lz:()=>D,TT:()=>j,TV:()=>W,Tj:()=>v,UY:()=>I,X$:()=>P,ZV:()=>X,bW:()=>_,dP:()=>T,er:()=>Y,ev:()=>y,iA:()=>N,lF:()=>M,lP:()=>E,oL:()=>k,oR:()=>L,rQ:()=>a,u$:()=>c,w8:()=>F});var i=r(81032),s=r(9479),n=r(14113),o=r(11672),l=r(96462);const a=o.rQ,c=(o.rT,o.auTierDisc),u=o.isAdidasPriced,_=o.isAU,d=o.auCostMult,h=/^(?:MEN|MENS|MEN'S|WOMEN|WOMENS|WOMEN'S|LADIES|LADIES'|LADY|ADULT|UNISEX)\s+(.+)$/,f=/^(?:YOUTH|YTH|BOYS|BOY'S|GIRLS|GIRL'S|JUNIOR|JUNIORS|JR)\s+(.+)$/,p={XS:"YXS",S:"YS",SMALL:"YS",SM:"YS",M:"YM",MEDIUM:"YM",MD:"YM",L:"YL",LARGE:"YL",LG:"YL",XL:"YXL",XLARGE:"YXL","X-LARGE":"YXL"},g=/\bONE\s*SIZE\b|\bOSFA\b|\bOSFM\b/,v=e=>{if(!e)return e;const t=String(e).toUpperCase().trim();if(i.pv[t])return i.pv[t];let r=t.match(h);if(r){const e=r[1].trim();return i.pv[e]||e}if(r=t.match(f),r){const e=r[1].trim();return p[e]||i.pv[e]||e}return g.test(t)?"OSFA":t},I=function(e,t,r){var i,s,n,o;let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const a=e.find(e=>e.deco_vendor_id===t&&e.deco_type===r);if(!a||null===(i=a.pricing_tiers)||void 0===i||null===(s=i.tiers)||void 0===s||!s.length)return null;const c=l.qty||1,u=a.pricing_tiers.tiers;let _=null;if("embroidery"===r){const e=l.stitches||8e3;_=u.find(t=>e>=t.min_stitches&&e<=(t.max_stitches||999999))}else if("screen_print"===r){const e=l.colors||1;_=u.find(t=>t.colors===e)||u[u.length-1]}else"dtf"===r&&(_=u.find(e=>e.size_key===l.dtf_size)||u[0]);if(!_||null===(n=_.qty_breaks)||void 0===n||!n.length)return null;const d=_.qty_breaks.slice().sort((e,t)=>e.min_qty-t.min_qty);let h=(null===(o=d[0])||void 0===o?void 0:o.price)||0;for(const f of d)c>=f.min_qty&&(h=f.price);return"screen_print"===r&&a.upcharges&&(l.underbase&&a.upcharges.underbase&&(h*=1+a.upcharges.underbase),l.fleece&&a.upcharges.fleece&&(h*=1+a.upcharges.fleece),l.mesh&&a.upcharges.mesh&&(h*=1+a.upcharges.mesh),h=Math.round(100*h)/100),h};let z=o.SP,m=o.EM,S=o.NP,b=o.DTF,M=o.TWA,y=o.TWN,E=["Front","Back","Left Chest","Right Chest","Left Sleeve","Right Sleeve","Collar","Yoke","Left Leg","Right Leg","Other"],O=["Primary","Billing","Shipping","Coach","Athletic Director","Equipment Manager","Booster Club","Other"];try{const e=JSON.parse(localStorage.getItem("nsa_settings")||"{}");e.SP&&e.SP._v===z._v&&(z=e.SP),e.EM&&e.EM._v===m._v&&(m=e.EM),e.NP&&(S=e.NP),e.DTF&&(b=e.DTF),e.TWA&&(M=e.TWA),e.TWN&&(y=e.TWN),e.POSITIONS&&(E=e.POSITIONS),e.CONTACT_ROLES&&(O=e.CONTACT_ROLES)}catch(U){}const x=()=>({SP:z,EM:m,NP:S,DTF:b,TWA:M,TWN:y});o.decoSplitRuns;const L=o.decoSplitQty;
1function T(e,t,r,i){return o.dP(x(),e,t,r,i)}const N=(e,t,r)=>{const i={},n=(0,s.G0)(e).filter(e=>e&&e.link_group&&e.art_file_id);return n.length?(n.forEach(n=>{let o=0;if((r||[]).forEach(t=>{t&&t.id!==e.id&&(0,s.G0)(t).forEach(e=>{e&&e.link_group&&e.link_group===n.link_group&&e.deco_type===n.deco_type&&(o+=(0,s.Iz)(e.total_units))})}),o<=0)return;const l=((0,s.Iz)(t&&t[n.art_file_id])||(0,s.Iz)(n.total_units))+o;l>(i[n.art_file_id]||0)&&(i[n.art_file_id]=l)}),i):i},k=(e,t,r,i,n)=>{const o=T(e,t,r,e&&"art"===e.kind&&e.art_file_id&&n&&n[e.art_file_id]>i?n[e.art_file_id]:i);return(null!=o._nq?o._nq:e.reversible?2*t:t)*(0,s.Iz)(o.cost)},A=e=>/fleece|hood|sweat|crew|jogger/i.test(e||""),q=e=>/\bmesh\b/i.test(e||""),C=(e,t)=>{if(e&&Array.isArray(e.color_ways)&&t&&t.color_way_id){const r=e.color_ways.find(e=>e&&e.id===t.color_way_id);if(r&&Array.isArray(r.inks)){const e=r.inks.filter(e=>String(e||"").trim()).length;if(e>0)return e}}if(e&&e.ink_colors){const t=e.ink_colors.split("\n").filter(e=>e.trim()).length;if(t>0)return t}return(0,s.Iz)(t&&t.tbd_colors)||1},Y=(e,t,r,i,o,l,a,c,u,_)=>{if(!r||"art"!==r.kind||"outside"!==r.fulfillment||!r.vendor)return 0;const d=(0,n.decoConcreteType)(e,r);if(!d)return 0;if((!_||!_.ignorePoCoverage)&&((0,n.decoIsOutsourced)(u&&u[t],d)||r.deco_po_id))return 0;const h=(a||[]).find(e=>e&&e.name===r.vendor),f=h&&h.id;if(!f)return 0;const p=(o||[]).find(e=>e&&e.id===r.art_file_id),g=(e&&Array.isArray(e.items)?e.items[t]:null)||{},v=(g.name||"")+" "+(g.sku||""),z="screen_print"===d,m=I(c,f,d,{qty:l,colors:C(p,r),stitches:(0,s.Iz)(p&&p.stitches)||(0,s.Iz)(r.tbd_stitches)||void 0,underbase:z&&(0,n.garmentNeedsUnderbase)(g.color),fleece:z&&A(v),mesh:z&&q(v)});return null==m?0:(r.reversible?2*i:i)*m},D=(e,t,r,i,s,o,l,a,c,u)=>(0,n.isDecoOutsourced)(e,t,r,u)?Y(e,t,r,i,s,o,a,c,u):k(r,i,s,o,l),P=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.36;const r=(0,s.Iz)(e);return r>0?Math.round(r/(1-t)*100)/100:0},w=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!e)return{rev:0,ship:0,tax:0,grand:0};const r=(0,s.i6)(e),i=(0,s.rX)(e),n={};r.forEach(e=>{const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),r=t>0?t:Math.max(0,(0,s.Iz)(e.est_qty));r&&(0,s.n_)(e).forEach(e=>{"art"===e.kind&&e.art_file_id&&(n[e.art_file_id]=(n[e.art_file_id]||0)+(null!=L(e)?L(e):r)*(e.reversible?2:1))})});let o=0;r.forEach(e=>{const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),r=t>0?t:Math.max(0,(0,s.Iz)(e.est_qty));r&&(e.is_free_promo||(e._sizeSells&&t>0?Object.entries((0,s.u5)(e)).forEach(t=>{var r;let[i,n]=t;const l=(0,s.Iz)(n);l>0&&(o+=l*((null===(r=e._sizeSells)||void 0===r?void 0:r[i])||(0,s.Iz)(e.unit_sell)))}):o+=r*(0,s.Iz)(e.unit_sell)),(0,s.n_)(e).forEach(e=>{const t="art"===e.kind&&e.art_file_id?n[e.art_file_id]:r,l=T(e,r,i,t),a=null!=l._nq?l._nq:e.reversible?2*r:r;o+=a*(0,s.Iz)(l.sell)}))});const a=(0,l.CL)(e);o+=a.processing;const c=("pct"===e.shipping_type?o*(0,s.Iz)(e.shipping_value)/100:(0,s.Iz)(e.shipping_value))+a.shipping,u=e.tax_exempt?0:"webstore"===e.source?(0,s.Iz)(e.tax_rate):(0,s.Iz)(e.tax_rate||t),_=o*u;return{rev:o,ship:c,tax:_,grand:o+c+_+a.tax}},F=e=>{if(!e)return!1;if(e.promo_applied)return!0;const t=(0,s.i6)(e).filter(e=>{const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0);return(t>0?t:Math.max(0,(0,s.Iz)(e.est_qty)))>0});return t.length>0&&t.every(e=>e.is_free_promo||e.is_promo)},R=(e,t,r,i)=>{if(!e)return{rev:0,cost:0,margin:0,pct:0};const o=(0,s.i6)(e),a=(0,s.rX)(e),c={};o.forEach(e=>{const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),r=t>0?t:Math.max(0,(0,s.Iz)(e.est_qty));r&&(0,s.n_)(e).forEach(e=>{"art"===e.kind&&e.art_file_id&&(c[e.art_file_id]=(c[e.art_file_id]||0)+(null!=L(e)?L(e):r)*(e.reversible?2:1))})});const u=N(e,c,t),_=(0,n.outsourcedDecoTypes)(e);let d=0,h=0;o.forEach((t,n)=>{const o=Object.values((0,s.u5)(t)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),l=o>0?o:Math.max(0,(0,s.Iz)(t.est_qty));l&&(t.is_free_promo||(t._sizeSells&&o>
10?Object.entries((0,s.u5)(t)).forEach(e=>{var r;let[i,n]=e;const o=(0,s.Iz)(n);o>0&&(d+=o*((null===(r=t._sizeSells)||void 0===r?void 0:r[i])||(0,s.Iz)(t.unit_sell)))}):d+=l*(0,s.Iz)(t.unit_sell)),t._sizeCosts&&o>0?Object.entries((0,s.u5)(t)).forEach(e=>{var r;let[i,n]=e;const o=(0,s.Iz)(n);o>0&&(h+=o*((null===(r=t._sizeCosts)||void 0===r?void 0:r[i])||(0,s.Iz)(t.nsa_cost)))}):h+=l*(0,s.Iz)(t.nsa_cost),(0,s.n_)(t).forEach(t=>{const o="art"===t.kind&&t.art_file_id?c[t.art_file_id]:l,f=T(t,l,a,o),p=null!=f._nq?f._nq:t.reversible?2*l:l;d+=p*(0,s.Iz)(f.sell),h+=D(e,n,t,l,a,o,u,r,i,_)}))}),(e.deco_pos||[]).forEach(e=>{const t=(0,s.Iz)(e._bill_cost);h+=t>0?t:(0,s.Iz)(e.qty||0)*(0,s.Iz)(e.unit_cost||0)});const f=(0,s.Iz)(e._shipping_cost||e._shipstation_cost||0)||(e._shipments||[]).reduce((e,t)=>e+(0,s.Iz)(t.shipping_cost||0),0);h+=f+(0,s.Iz)(e._inbound_freight||0)+(0,s.VF)(e);const p=(0,l.CL)(e);d+=p.processing,h+=p.ccFees;const g=("pct"===e.shipping_type?d*((0,s.Iz)(e.shipping_value)/100):(0,s.Iz)(e.shipping_value))+p.shipping,v=d+g,I=v-h;return{rev:d,cost:h,shipRev:g,margin:I,pct:v>0?Math.round(I/v*100):0}},j=e=>{let{sos:t,invs:r,histInvs:i,famIds:o,start:l,end:c}=e;const u=new Set(o||[]),_=e=>{const t=(e=>{const t=String(e||"");if(/^\d{4}-\d{2}-\d{2}/.test(t))return t.slice(0,10);const r=new Date(t);return isNaN(r.getTime())?"":r.getFullYear()+"-"+String(r.getMonth()+1).padStart(2,"0")+"-"+String(r.getDate()).padStart(2,"0")})(e);return!!t&&t>=l&&t<=c},d=(t||[]).filter(e=>e&&u.has(e.customer_id)&&_(e.order_date||e.created_at)&&((e,t)=>{if(!e)return!1;const r=(t||[]).filter(t=>t&&t.so_id===e.id&&"void"!==t.status);if(!r.length)return!1;const i=r.reduce((e,t)=>e+(0,s.Iz)(t.total),0);return i>0?r.reduce((e,t)=>e+(0,s.Iz)(t.paid),0)>=i-.01:r.every(e=>"paid"===e.status)})(e,r)).reduce((e,t)=>e+function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2;if(!e)return 0;const r=(0,s.i6)(e),i=(0,s.rX)(e),o={};r.forEach(e=>{const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),r=t>0?t:Math.max(0,(0,s.Iz)(e.est_qty));r&&(0,s.n_)(e).forEach(e=>{"art"===e.kind&&e.art_file_id&&(o[e.art_file_id]=(o[e.art_file_id]||0)+(null!=L(e)?L(e):r)*(e.reversible?2:1))})});const l=(0,n.outsourcedDecoTypes)(e);let a=0;return r.forEach((r,c)=>{if(r.is_free_promo)return;const u=Object.values((0,s.u5)(r)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),_=u>0?u:Math.max(0,(0,s.Iz)(r.est_qty));if(!_)return;let d=0,h=0;r._sizeSells&&u>0?Object.entries((0,s.u5)(r)).forEach(e=>{let[t,i]=e;const n=(0,s.Iz)(i);var o,l;n>0&&(d+=n*((null===(o=r._sizeSells)||void 0===o?void 0:o[t])||(0,s.Iz)(r.unit_sell)),h+=n*((null===(l=r._sizeCosts)||void 0===l?void 0:l[t])||(0,s.Iz)(r.nsa_cost)))}):(d+=_*(0,s.Iz)(r.unit_sell),h+=_*(0,s.Iz)(r.nsa_cost)),(0,s.n_)(r).forEach(t=>{const r="art"===t.kind&&t.art_file_id?o[t.art_file_id]:_,a=T(t,_,i,r),u=null!=a._nq?a._nq:t.reversible?2*_:_;d+=u*(0,s.Iz)(a.sell),(0,n.isDecoOutsourced)(e,c,t,l)||(h+=u*(0,s.Iz)(a.cost))}),(d>0?(d-h)/d:0)>=t&&(a+=d)}),a}(t),0),h=(i||[]).filter(e=>e&&u.has(e.customer_id)&&String(e.status||"").trim().toLowerCase().startsWith("paid")&&_(e.date||e.invoice_date)).reduce((e,t)=>{const r=null!=t.subtotal?(0,s.Iz)(t.subtotal):(0,s.Iz)(t.total)-(0,s.Iz)(t.tax);return e+("credit_memo"===t.invoice_type?-Math.abs(r):r)},0);return{soSpend:a(d),histSpend:a(h),total:a(d+h)}},W=e=>{if(!e)return 0;const t=(0,s.i6)(e);let r=0;return t.forEach(e=>{if(e.is_free_promo)return;if(!u(e.brand))return;const t=Object.values((0,s.u5)(e)).reduce((e,t)=>e+Math.max(0,(0,s.Iz)(t)),0),i=t>0?t:Math.max(0,(0,s.Iz)(e.est_qty));i&&(e._sizeSells&&t>0?Object.entries((0,s.u5)(e)).forEach(t=>{var i;let[n,o]=t;const l=(0,s.Iz)(o);l>0&&(r+=l*((null===(i=e._sizeSells)||void 0===i?void 0:i[n])||(0,s.Iz)(e.unit_sell)))}):r+=i*(0,s.Iz)(e.unit_sell))}),r},X=(e,t,r)=>{const i=(null===e||void 0===e?void 0:e[r])||[];if(null===e||void 0===e||!e.parent_id)return i;const s=null===t||void 0===t?void 0:t.find(t=>t.id===e.parent_id),n=(null===s||void 0===s?void 0:s[r])||[];if(!n.length)return i;const o="pantone_colors"===r?"code":"name",l=new Set(i.map(e=>(e[o]||"").toUpperCase()));return[...i,...n.filter(e=>!l.has((e[o]||"").toUpperCase()))]}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.