{"version":3,"file":"default/js/productDetail.js","mappings":";;;;;;;;;;AAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV,mDAAmD;AACnD;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AClCa;AACb;AACA;AACA;AACA,WAAW,QAAQ;AACnB,aAAa,QAAQ;AACrB;AACA;AACA,0CAA0C;AAC1C,oBAAoB,oBAAoB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA,6CAA6C,oCAAoC;AACjF;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB;AACjB,iBAAiB;AACjB,sBAAsB;;;;;;;;;;;;AClDT;AACb,kBAAkB,mBAAO,CAAC,+GAAqB;AAC/C,sBAAsB,mBAAO,CAAC,iHAAsB;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA,MAAM;AACN;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,SAAS;AACpB;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB;;AAEA;AACA;AACA;AACA,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,sBAAsB;AACpC;;AAEA;AACA;AACA;AACA,WAAW,yBAAyB;AACpC,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,UAAU;AACrB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,UAAU;AACrB,WAAW,UAAU;AACrB,WAAW,SAAS;AACpB;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB;AACA;;AAEA;AACA;AACA,WAAW,mBAAmB;AAC9B,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,YAAY;AACvB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA,YAAY,QAAQ;AACpB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,UAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA,WAAW,kBAAkB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;;AAEjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;;AAEA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AC3pCa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C;AACA;AACA;AACA;AACA;AACA,+FAA+F;AAC/F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACvEa;AACb,kBAAkB,mBAAO,CAAC,qHAAwB;AAClD,WAAW,mBAAO,CAAC,8FAAQ;;AAE3B;AACA;AACA,WAAW,SAAS;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA,OAAO,MAAM,WAAW,aAAa;AACrC;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,+EAA+E;AAC/E;AACA;AACA;AACA,cAAc,sCAAsC;AACpD;AACA;AACA;AACA,cAAc,MAAM;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,6CAA6C,mCAAmC;;AAEhF;AACA,6CAA6C,wCAAwC;;AAErF;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,aAAa;AACb,UAAU;AACV;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;;AAEA,uCAAuC;AACvC;AACA;;AAEA,6CAA6C;AAC7C;AACA;AACA;AACA;;AAEA,4CAA4C;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;;;;;;;;;;;ACzaa;;AAEb,mBAAmB,mBAAO,CAAC,iIAAgC;;AAE3D;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA,uDAAuD,sBAAsB;AAC7E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB,uDAAuD;AACvD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;AChRa;;;AAGb;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;;;;;;;;;;;;AC3FA;AACa;;AAEb;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;;AAEb;AACA;AACA,SAAS;AACT,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAM;AACN;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA,WAAW,aAAa;AACxB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wFAAwF,IAAI,qBAAqB,EAAE;AACnH;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,cAAc;AACd;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;ACpgBa;;AAEb;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;;ACZA;AACa;;AAEb;AACA;AACA,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,QAAQ;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,aAAa;AACxB,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;;AAEtB,2DAA2D;;AAE3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;;;;;;;;;;;ACvQA;AACA,IAAI,KAAyC;AAC7C,IAAI,iCAAO,EAAE,mCAAE;AACf;AACA,KAAK;AAAA,kGAAC,GAAG,CAGsD;AAC/D,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,yBAAyB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,6BAA6B,gEAAgE;AAC7F;AACA;AACA;AACA,CAAC;;;;;;UCzGD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;;;ACtBa;;AAEb,qBAAqB,mBAAO,CAAC,sFAAQ;;AAErC;AACA,mBAAmB,mBAAO,CAAC,0GAAkB;AAC7C,mBAAmB,mBAAO,CAAC,8GAAoB;AAC/C,mBAAmB,mBAAO,CAAC,oIAA+B;AAC1D,mBAAmB,mBAAO,CAAC,gIAA6B;AACxD,CAAC;;;;;;;;ACTD,mBAAO,CAAC,yEAAe,IAAI","sources":["webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/components/focus.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/helpers/pageHelpers.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/product/base.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/product/countdown.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/product/detail.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/product/pdpInstoreInventory.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/product/wishlist.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/storeLocator/storeLocator.js","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/util.js","webpack://sfra-startup-kit/./cartridges/app_storefront_base/cartridge/client/default/js/storeLocator/storeLocator.js","webpack://sfra-startup-kit/./node_modules/svg4everybody/dist/svg4everybody.js","webpack://sfra-startup-kit/webpack/bootstrap","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/productDetail.js","webpack://sfra-startup-kit/./node_modules/svg-spritemap-webpack-plugin/svg4everybody-helper.js"],"sourcesContent":["'use strict';\n\nmodule.exports = {\n setTabNextFocus: function (focusParams) {\n var KEYCODE_TAB = 9;\n var isTabPressed = (focusParams.event.key === 'Tab' || focusParams.event.keyCode === KEYCODE_TAB);\n\n if (!isTabPressed) {\n return;\n }\n\n var firstFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.firstElementSelector);\n var lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.lastElementSelector);\n\n if ($(focusParams.containerSelector + ' ' + focusParams.lastElementSelector).is(':disabled')) {\n lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.nextToLastElementSelector);\n if ($('.product-quickview.product-set').length > 0) {\n var linkElements = $(focusParams.containerSelector + ' a#fa-link.share-icons');\n lastFocusableEl = linkElements[linkElements.length - 1];\n }\n }\n\n if (focusParams.event.shiftKey) /* shift + tab */ {\n if ($(':focus').is(firstFocusableEl)) {\n lastFocusableEl.focus();\n focusParams.event.preventDefault();\n }\n } else /* tab */ {\n if ($(':focus').is(lastFocusableEl)) { // eslint-disable-line\n firstFocusableEl.focus();\n focusParams.event.preventDefault();\n }\n }\n }\n};\n","'use strict';\n/**\n * @function getCookie\n *\n * @param {string} key - The cookie name\n * @returns {string} value - the value of the cookie if found, null otherwise\n **/\nfunction getCookie(key) {\n var cookies = document.cookie.split(';');\n for (var i = 0; i < cookies.length; i++) {\n var tokens = cookies[i].split('=');\n var cookieKey = tokens[0].trim();\n if (cookieKey === key) {\n return tokens[1];\n }\n }\n return '';\n}\n\n/**\n * @function setCookie\n *\n * @param {string} key - The cookie name\n * @param {string} value - The cookie value\n * @param {integer} minutes - The number of minutes to expire the cookie\n **/\nfunction setCookie(key, value, minutes) {\n var date = new Date();\n date.setTime(date + (minutes * 60 * 1000));\n\n document.cookie = key + '=' + value + '; expires=' + date.toGMTString() + '; path=/';\n}\n\n/**\n * @function isMobileDevice\n * \n * @returns {boolean} value - the value true if the device is mobile\n **/\nfunction isMobileDevice() {\n // condition to check if device is tablet IOS \n let isIpad = /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1 && window.innerWidth <= 991;\n\n if (/Android|webOS|iPhone|iPod|iPad|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) && window.innerWidth <= 991 || isIpad) {\n return true;\n }\n return false;\n}\n\nexports.setCookie = setCookie;\nexports.getCookie = getCookie;\nexports.isMobileDevice = isMobileDevice;\n","'use strict';\nvar focusHelper = require('../components/focus');\nvar countdownHelper = require('../product/countdown');\n\nfunction removeMainProductBonusProductModal() {\n let url = $('.choose-bonus-product-dialog').data('removeproducturl');\n if ($('.choose-bonus-product-dialog').data('updatequantityurl') !== 'undefined') {\n url = $('.choose-bonus-product-dialog').data('updatequantityurl');\n }\n $.ajax({\n url: url,\n method: 'GET',\n success: function (data) {\n $('.minicart').trigger('count:update', data);\n }\n });\n}\n\n/**\n * Retrieves the relevant pid value\n * @param {jquery} $el - DOM container for a given add to cart button\n * @return {string} - value to be used when adding product to cart\n */\nfunction getPidValue($el) {\n var pid;\n\n if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) {\n pid = $($el).closest('.modal-content').find('.product-quickview').data('pid');\n } else if ($('.product-set-detail').length || $('.product-set').length) {\n pid = $($el).closest('.product-detail').attr('data-pid');\n } else {\n pid = $('.product-detail:not(\".bundle-item\")').data('pid');\n }\n\n return pid;\n}\n\n/**\n * Retrieve contextual quantity selector\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {jquery} - quantity selector DOM container\n */\nfunction getQuantitySelector($el) {\n var quantitySelected;\n if ($el && $('.set-items').length) {\n quantitySelected = $($el).closest('.product-detail').find('.quantity-select');\n } else if ($el && $('.product-bundle').length) {\n var quantitySelectedModal = $($el).closest('.modal-footer').find('.quantity-select');\n var quantitySelectedPDP = $($el).closest('.bundle-footer').find('.quantity-select');\n if (quantitySelectedModal.val() === undefined) {\n quantitySelected = quantitySelectedPDP;\n } else {\n quantitySelected = quantitySelectedModal;\n }\n } else {\n quantitySelected = $('.quantity-select');\n }\n return quantitySelected;\n}\n\n/**\n * Retrieves the value associated with the Quantity pull-down menu\n * @param {jquery} $el - DOM container for the relevant quantity\n * @return {string} - value found in the quantity input\n */\nfunction getQuantitySelected($el) {\n return getQuantitySelector($el).val();\n}\n\n/**\n * Process the attribute values for an attribute that has image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n * @param {Object} msgs - object containing resource messages\n */\nfunction processSwatchValues(attr, $productContainer, msgs) {\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer.find('[data-attr=\"' + attr.id + '\"] [data-attr-value=\"' +\n attrValue.value + '\"]');\n var $swatchButton = $attrValue.parent();\n\n if (attrValue.selected) {\n $attrValue.addClass('selected');\n $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText);\n } else {\n $attrValue.removeClass('selected');\n $attrValue.siblings('.selected-assistive-text').empty();\n }\n\n if (attrValue.url) {\n $swatchButton.attr('data-url', attrValue.url);\n } else {\n $swatchButton.removeAttr('data-url');\n }\n\n // Disable if not selectable\n $attrValue.removeClass('selectable unselectable');\n\n $attrValue.addClass(attrValue.selectable ? 'selectable' : 'unselectable');\n });\n}\n\n/**\n * Process attribute values associated with an attribute that does not have image swatches\n *\n * @param {Object} attr - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {Object[]} attr.values - Array of attribute value objects\n * @param {string} attr.values.value - Attribute coded value\n * @param {string} attr.values.url - URL to de/select an attribute value of the product\n * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be\n * selected. If there is no variant that corresponds to a specific combination of attribute\n * values, an attribute may be disabled in the Product Detail Page\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction processNonSwatchValues(attr, $productContainer) {\n var $attr = '[data-attr=\"' + attr.id + '\"]';\n var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first');\n $defaultOption.attr('value', attr.resetUrl);\n\n attr.values.forEach(function (attrValue) {\n var $attrValue = $productContainer\n .find($attr + ' [data-attr-value=\"' + attrValue.value + '\"]');\n $attrValue.attr('value', attrValue.url)\n .removeAttr('disabled');\n\n if (!attrValue.selectable) {\n $attrValue.attr('disabled', true);\n }\n });\n}\n\n/**\n * Routes the handling of attribute processing depending on whether the attribute has image\n * swatches or not\n *\n * @param {Object} attrs - Attribute\n * @param {string} attr.id - Attribute ID\n * @param {jQuery} $productContainer - DOM element for a given product\n * @param {Object} msgs - object containing resource messages\n */\nfunction updateAttrs(attrs, $productContainer, msgs) {\n // Currently, the only attribute type that has image swatches is Color.\n var attrsWithSwatches = ['color'];\n\n attrs.forEach(function (attr) {\n if (attrsWithSwatches.indexOf(attr.id) > -1) {\n processSwatchValues(attr, $productContainer, msgs);\n } else {\n processNonSwatchValues(attr, $productContainer);\n }\n });\n}\n\n/**\n * Updates the availability status in the Product Detail Page\n *\n * @param {Object} response - Ajax response object after an\n * attribute value has been [de]selected\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nfunction updateAvailability(response, $productContainer) {\n var availabilityValue = '';\n var availabilityMessages = response.product.availability.messages;\n if (!response.product.readyToOrder) {\n availabilityValue = '
  • ' + response.resources.info_selectforstock + '
  • ';\n } else {\n availabilityMessages.forEach(function (message) {\n availabilityValue += '
  • ' + message + '
  • ';\n });\n }\n\n $($productContainer).trigger('product:updateAvailability', {\n product: response.product,\n $productContainer: $productContainer,\n message: availabilityValue,\n resources: response.resources\n });\n}\n\n/**\n * Generates html for product attributes section\n *\n * @param {array} attributes - list of attributes\n * @return {string} - Compiled HTML\n */\nfunction getAttributesHtml(attributes) {\n if (!attributes) {\n return '';\n }\n\n var html = '';\n\n attributes.forEach(function (attributeGroup) {\n if (attributeGroup.ID === 'mainAttributes') {\n attributeGroup.attributes.forEach(function (attribute) {\n html += '
    ' + attribute.label + ': ' +\n attribute.value + '
    ';\n });\n }\n });\n\n return html;\n}\n\n/**\n * @typedef UpdatedOptionValue\n * @type Object\n * @property {string} id - Option value ID for look up\n * @property {string} url - Updated option value selection URL\n */\n\n/**\n * @typedef OptionSelectionResponse\n * @type Object\n * @property {string} priceHtml - Updated price HTML code\n * @property {Object} options - Updated Options\n * @property {string} options.id - Option ID\n * @property {UpdatedOptionValue[]} options.values - Option values\n */\n\n/**\n * Updates DOM using post-option selection Ajax response\n *\n * @param {OptionSelectionResponse} optionsHtml - Ajax response optionsHtml from selecting a product option\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction updateOptions(optionsHtml, $productContainer) {\n // Update options\n $productContainer.find('.product-options').empty().html(optionsHtml);\n}\n\n/**\n * Dynamically creates Bootstrap carousel from response containing images\n * @param {Object[]} imgs - Array of large product images,along with related information\n * @param {jQuery} $productContainer - DOM element for a given product\n */\nfunction createCarousel(imgs, $productContainer) {\n var carousel = $productContainer.find('.carousel');\n $(carousel).carousel('dispose');\n var carouselId = $(carousel).attr('id');\n $(carousel).empty().append('
      ');\n for (var i = 0; i < imgs.length; i++) {\n $('
      \"'
      ').appendTo($(carousel).find('.carousel-inner'));\n $('
    1. ').appendTo($(carousel).find('.carousel-indicators'));\n }\n $($(carousel).find('.carousel-item')).first().addClass('active');\n $($(carousel).find('.carousel-indicators > li')).first().addClass('active');\n if (imgs.length === 1) {\n $($(carousel).find('.carousel-indicators, a[class^=\"carousel-control-\"]')).detach();\n }\n $(carousel).carousel();\n $($(carousel).find('.carousel-indicators')).attr('aria-hidden', true);\n}\n\n/**\n * Parses JSON from Ajax call made whenever an attribute value is [de]selected\n * @param {Object} response - response from Ajax call\n * @param {Object} response.product - Product object\n * @param {string} response.product.id - Product ID\n * @param {Object[]} response.product.variationAttributes - Product attributes\n * @param {Object[]} response.product.images - Product images\n * @param {boolean} response.product.hasRequiredAttrsSelected - Flag as to whether all required\n * attributes have been selected. Used partially to\n * determine whether the Add to Cart button can be enabled\n * @param {jQuery} $productContainer - DOM element for a given product.\n */\nfunction handleVariantResponse(response, $productContainer, isSizeAttr) {\n var isChoiceOfBonusProducts =\n $productContainer.parents('.choose-bonus-product-dialog').length > 0;\n var isVaraint;\n if (response.product.variationAttributes) {\n updateAttrs(response.product.variationAttributes, $productContainer, response.resources);\n isVaraint = response.product.productType === 'variant';\n if (isChoiceOfBonusProducts && isVaraint) {\n $productContainer.parent('.bonus-product-item')\n .data('pid', response.product.id);\n\n $productContainer.parent('.bonus-product-item')\n .data('ready-to-order', response.product.readyToOrder);\n }\n }\n\n // Update primary images\n if (!isSizeAttr) {\n var primaryImageUrls = response.product.images.large;\n createCarousel(primaryImageUrls, $productContainer);\n }\n\n // Update pricing\n if (!isChoiceOfBonusProducts) {\n var $priceSelector = $('.prices .price', $productContainer).length ?\n $('.prices .price', $productContainer) :\n $('.prices .price');\n $priceSelector.replaceWith(response.product.price.html);\n }\n\n // Update saving text\n var $savingSelector = $('.pdp-saving');\n\n if ($savingSelector.length) {\n $savingSelector.empty();\n\n if (response.product.savingPrice && response.product.savingPrice.html) {\n $savingSelector.html(response.product.savingPrice.html);\n }\n }\n\n // Update promotions\n $productContainer.find('.promotions').empty().html(response.product.promotionsHtml);\n\n updateAvailability(response, $productContainer);\n\n if (isChoiceOfBonusProducts) {\n var $selectButton = $productContainer.find('.select-bonus-product');\n $selectButton.trigger('bonusproduct:updateSelectButton', {\n product: response.product,\n $productContainer: $productContainer\n });\n } else {\n // Enable \"Add to Cart\" button if all required attributes have been selected\n $('body').trigger('product:updateAddToCart', {\n product: response.product,\n $productContainer: $productContainer\n }).trigger('product:statusUpdate', response.product);\n }\n\n // Update attributes\n $productContainer.find('.main-attributes').empty()\n .html(getAttributesHtml(response.product.attributes));\n}\n\n/**\n * @typespec UpdatedQuantity\n * @type Object\n * @property {boolean} selected - Whether the quantity has been selected\n * @property {string} value - The number of products to purchase\n * @property {string} url - Compiled URL that specifies variation attributes, product ID, options,\n * etc.\n */\n\n/**\n * Updates the quantity DOM elements post Ajax call\n * @param {UpdatedQuantity[]} quantities -\n * @param {jQuery} $productContainer - DOM container for a given product\n */\nfunction updateQuantities(quantities, $productContainer) {\n if ($productContainer.parent('.bonus-product-item').length <= 0) {\n var optionsHtml = quantities.map(function (quantity) {\n var selected = quantity.selected ? ' selected ' : '';\n return '';\n }).join('');\n getQuantitySelector($productContainer).empty().html(optionsHtml);\n }\n}\n\n/**\n * Updates DOM using post-option selection Ajax response\n *\n * @param {htmlString} badgesHtml - Ajax response badgesHtml from selecting a product option\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction updateBadges(badgesHtml, $productContainer) {\n // Updates product badges\n $productContainer.find('.product-badges').empty().html(badgesHtml);\n}\n\n/**\n * Updates DOM using post-option selection Ajax response\n *\n * @param {htmlString} specialOrder - Ajax response specialOrder from selecting a product option\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction updateSpecialOrder(specialOrder, $productContainer) {\n if (specialOrder.isSpecialOrder && specialOrder.specialOrderRenderedTemplate) {\n $productContainer.find('.special-order-container').empty().html(specialOrder.specialOrderRenderedTemplate);\n } else {\n $productContainer.find('.special-order-container').empty();\n }\n}\n\n/**\n * Updates DOM using post-option selection Ajax response\n *\n * @param {htmlString} v12eligibility - Ajax response v12eligibility from selecting a product option\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction updateV12FinanceCalculator(v12eligibility, $productContainer) {\n if (v12eligibility.eligible && v12eligibility.v12RenderedTemplate) {\n $productContainer.find('.v12-row').empty().html(v12eligibility.v12RenderedTemplate);\n } else {\n $productContainer.find('.v12-row').empty();\n }\n}\n\nfunction updateV12ModalValues(v12_cashPrice, v12_cashDeposit, v12_minDepositPercentage, v12_maxDepositPercentage, currencySymbol) {\n $('.v12-form #cashPrice').val(v12_cashPrice);\n $('.v12-form #cashDeposit').val(v12_cashDeposit);\n $('.v12-form #deposit').val(v12_minDepositPercentage);\n $('.v12-form #depRange').attr('min', v12_minDepositPercentage);\n $('.v12-form #depRange').attr('max', v12_maxDepositPercentage);\n $('.v12-form .body.v12').data('currency', currencySymbol);\n var $depRange = $('#depRange').val();\n\n if ($depRange) {\n $('.deposit-range-input').val($depRange);\n }\n\n $('#productsList').trigger('change');\n}\n\n/**\n * updates the product view when a product attribute is selected or deselected or when\n * changing quantity\n * @param {string} selectedValueUrl - the Url for the selected variation value\n * @param {jQuery} $productContainer - DOM element for current product\n */\nfunction attributeSelect(selectedValueUrl, $productContainer, isSizeAttr) {\n if (selectedValueUrl) {\n $('body').trigger('product:beforeAttributeSelect', {\n url: selectedValueUrl,\n container: $productContainer\n });\n\n $.ajax({\n url: selectedValueUrl,\n method: 'GET',\n success: function (data) {\n handleVariantResponse(data, $productContainer, isSizeAttr);\n updateOptions(data.product.optionsHtml, $productContainer);\n updateQuantities(data.product.quantities, $productContainer);\n if (data.product.badges && data.product.badges.badgesRenderedTemplate) {\n updateBadges(data.product.badges.badgesRenderedTemplate, $productContainer);\n } else {\n $productContainer.find('.product-badges').empty();\n }\n\n if (data.product.specialOrder) {\n updateSpecialOrder(data.product.specialOrder, $productContainer);\n }\n\n if (data.product.v12eligibility) {\n updateV12FinanceCalculator(data.product.v12eligibility, $productContainer);\n }\n\n if (data.v12_cashDeposit && data.v12_cashPrice\n && data.v12_minDepositPercentage >= 0\n && data.v12_maxDepositPercentage\n && data.currencySymbol\n ) {\n updateV12ModalValues(data.v12_cashPrice, data.v12_cashDeposit, data.v12_minDepositPercentage, data.v12_maxDepositPercentage, data.currencySymbol);\n }\n\n $productContainer.find('.add-to-wish-list').toggleClass('d-none', data.product.wishlistItemExists);\n $productContainer.find('.remove-from-wish-list').toggleClass('d-none', !data.product.wishlistItemExists);\n\n updateProductStockAvailability($productContainer, data.product.id);\n getCountdownTimerStatus($productContainer, data.product.id);\n\n $('body').trigger('product:afterAttributeSelect', {\n data: data,\n container: $productContainer\n });\n $.spinner().stop();\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }\n}\n\nfunction updateProductStockAvailability($container, productID) {\n var productStockAvailabilityURL = $('input[name=productStockAvailabilityURL]').val();\n var $productStockAvailability = $container.find('.product-stock-availablity');\n $.ajax({\n url: productStockAvailabilityURL + '?pid=' + productID,\n method: 'GET',\n success: function (response) {\n $productStockAvailability.html(response);\n }\n });\n}\n\nfunction getCountdownTimerStatus($container, productID) {\n var isCountdownTimerEnabledURL = $('input[name=isCountdownTimerEnabledURL]').val();\n var $countdownTimer = $container.find('.countdown-wrapper');\n \n if (isCountdownTimerEnabledURL) {\n $.ajax({\n url: isCountdownTimerEnabledURL + '?pid=' + productID,\n method: 'GET',\n success: function (response) {\n $countdownTimer.html(response);\n if (response) {\n countdownHelper.init();\n }\n }\n });\n }\n}\n\n/**\n * Retrieves url to use when adding a product to the cart\n *\n * @return {string} - The provided URL to use when adding a product to the cart\n */\nfunction getAddToCartUrl() {\n return $('.add-to-cart-url').val();\n}\n\n/**\n * Parses the html for a modal window\n * @param {string} html - representing the body and footer of the modal window\n *\n * @return {Object} - Object with properties body and footer.\n */\nfunction parseHtml(html) {\n var $html = $('
      ').append($.parseHTML(html));\n\n var body = $html.find('.choice-of-bonus-product');\n var footer = $html.find('.modal-footer').children();\n\n return {\n body: body,\n footer: footer\n };\n}\n\n/**\n * Retrieves url to use when adding a product to the cart\n *\n * @param {Object} data - data object used to fill in dynamic portions of the html\n */\nfunction chooseBonusProducts(data) {\n $('.modal-body').spinner().start();\n\n if ($('#chooseBonusProductModal').length !== 0) {\n $('#chooseBonusProductModal').remove();\n }\n var bonusUrl;\n if (data.bonusChoiceRuleBased) {\n bonusUrl = data.showProductsUrlRuleBased;\n } else {\n bonusUrl = data.showProductsUrlListBased;\n }\n\n var htmlString = '' +\n '
      ' +\n '' +\n '
      ' +\n '' +\n '
      ' +\n '
      ' +\n '
      ' +\n ' ' + data.labels.selectprods + '' +\n '

      ' + data.labels.description + '

      ' +\n '
      ' +\n ' ' +\n '
      ' +\n '
      ' +\n '
      ' +\n '
      ' +\n '
      ' +\n '
      ';\n $('body').append(htmlString);\n $('.modal-body').spinner().start();\n\n $.ajax({\n url: bonusUrl,\n method: 'GET',\n dataType: 'json',\n success: function (response) {\n var parsedHtml = parseHtml(response.renderedTemplate);\n $('#chooseBonusProductModal .modal-body').empty();\n $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage);\n $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText);\n $('#chooseBonusProductModal .modal-body').html(parsedHtml.body);\n $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer);\n $('#chooseBonusProductModal').modal('show');\n $.spinner().stop();\n },\n error: function () {\n $.spinner().stop();\n }\n });\n}\n\n/**\n * Updates the Mini-Cart quantity value after the customer has pressed the \"Add to Cart\" button\n * @param {string} response - ajax response from clicking the add to cart button\n */\nfunction handlePostCartAdd(response) {\n $('.minicart').trigger('count:update', response);\n var messageType = response.error ? 'alert-danger' : 'alert-success';\n // show add to cart toast\n if (response.newBonusDiscountLineItem &&\n Object.keys(response.newBonusDiscountLineItem).length !== 0) {\n chooseBonusProducts(response.newBonusDiscountLineItem);\n } else {\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append(\n '
      '\n );\n }\n\n $('.add-to-cart-messages').append(\n '
      ' +\n response.message +\n '
      '\n );\n\n setTimeout(function () {\n $('.add-to-basket-alert').remove();\n }, 5000);\n }\n}\n\n/**\n * Retrieves the bundle product item ID's for the Controller to replace bundle master product\n * items with their selected variants\n *\n * @return {string[]} - List of selected bundle product item ID's\n */\nfunction getChildProducts() {\n var childProducts = [];\n $('.bundle-item').each(function () {\n childProducts.push({\n pid: $(this).find('.product-id').text(),\n quantity: parseInt($(this).find('label.quantity').data('quantity'), 10)\n });\n });\n\n return childProducts.length ? JSON.stringify(childProducts) : [];\n}\n\n/**\n * Hides the finance calculator modal if the specified target element\n * is within the modal's DOM hierarchy.\n *\n * @param {HTMLElement} target - The DOM element to check against the finance calculator modal.\n */\nfunction hideModalIfInFinanceCalculator(target) {\n if (target && $(target).length && $(target).closest('#financeCalculatorModal').length) {\n $('#financeCalculatorModal').modal('hide');\n }\n}\n\n/**\n * Retrieve product options\n *\n * @param {jQuery} $productContainer - DOM element for current product\n * @return {string} - Product options and their selected values\n */\nfunction getOptions($productContainer) {\n var options = $productContainer\n .find('.product-option')\n .map(function () {\n var $elOption = $(this).find('.options-select');\n var urlValue = $elOption.val();\n var selectedValueId = $elOption.find('option[value=\"' + urlValue + '\"]')\n .data('value-id');\n return {\n optionId: $(this).data('option-id'),\n selectedValueId: selectedValueId\n };\n }).toArray();\n\n return JSON.stringify(options);\n}\n\n/**\n * Makes a call to the server to report the event of adding an item to the cart\n *\n * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false\n */\nfunction miniCartReportingUrl(url) {\n if (url) {\n $.ajax({\n url: url,\n method: 'GET',\n success: function (response) {\n $('.minicart .klaviyo').html(response);\n },\n error: function () {\n // no reporting urls hit on the server\n }\n });\n }\n}\n\nmodule.exports = {\n attributeSelect: attributeSelect,\n methods: {\n editBonusProducts: function (data) {\n chooseBonusProducts(data);\n },\n miniCartReportingUrl: miniCartReportingUrl\n },\n\n focusChooseBonusProductModal: function () {\n $('body').on('shown.bs.modal', '#chooseBonusProductModal', function () {\n $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'true');\n $('#chooseBonusProductModal .close').focus();\n });\n },\n\n onClosingChooseBonusProductModal: function () {\n $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () {\n $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'false');\n });\n },\n\n trapChooseBonusProductModalFocus: function () {\n $('body').on('keydown', '#chooseBonusProductModal', function (e) {\n var focusParams = {\n event: e,\n containerSelector: '#chooseBonusProductModal',\n firstElementSelector: '.close',\n lastElementSelector: '.add-bonus-products'\n };\n focusHelper.setTabNextFocus(focusParams);\n });\n },\n\n colorAttribute: function () {\n $(document).on('click', '[data-attr=\"color\"] button', function (e) {\n e.preventDefault();\n\n if ($(this).attr('disabled')) {\n return;\n }\n var $productContainer = $(this).closest('.set-item');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.product-detail');\n }\n\n attributeSelect($(this).attr('data-url'), $productContainer);\n });\n },\n\n selectAttribute: function () {\n $(document).on('change', 'select[class*=\"select-\"], .options-select', function (e) {\n e.preventDefault();\n\n var $productContainer = $(this).closest('.set-item');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.product-detail');\n }\n attributeSelect(e.currentTarget.value, $productContainer);\n });\n },\n\n availability: function () {\n $(document).on('change', '.quantity-select', function (e) {\n e.preventDefault();\n\n var $productContainer = $(this).closest('.product-detail');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.modal-content').find('.product-quickview');\n }\n\n if ($('.bundle-items', $productContainer).length === 0) {\n attributeSelect($(e.currentTarget).find('option:selected').data('url'),\n $productContainer);\n }\n });\n },\n openBisnModal: function () {\n $(document).on('click', 'button.back-in-stock', function (e) {\n $('body').trigger('effect:Ripple', {\n button: $(this),\n event: e,\n afterAnimationFinish: function () {\n $('#bisnModal').modal('show');\n }\n });\n });\n },\n notifyBackInStock: function () {\n $('.js-back-in-stock-form').submit(function (e) {\n e.preventDefault();\n var productID = $('.product-detail.product-wrapper').attr('data-pid');\n $('.js-bis-product-id').val(productID);\n var form = $(this);\n var url = form.attr('action');\n form.spinner().start();\n fetch(url, {\n method: 'POST',\n body: form.serialize(),\n headers: {\n 'Content-type': 'application/x-www-form-urlencoded'\n }\n })\n .then(res => res.json())\n .then(data => {\n form.spinner().stop();\n if (data && data.success) {\n $('input[name$=dwfrm_backInStock_email]').val('');\n $('#bisnModal').modal('hide');\n $('#bisnModalSuccess').modal('show');\n } else {\n $('.js-back-in-stock-msg').text(data.msg).addClass('text-danger').removeClass('text-success');\n }\n })\n .catch(error => {\n $('.js-back-in-stock-msg').text(error).addClass('text-danger').removeClass('text-success');\n });\n\n return false;\n });\n },\n addToCart: function () {\n $(document).on('click', 'button.add-to-cart, button.add-to-cart-global', function (e) {\n var addToCart = $('.add-to-cart');\n var readyToOrder = addToCart.attr('data-readytoorder');\n var addToCartUrl;\n var pid;\n var pidsObj;\n var setPids;\n var v12productId = $('.v12-form').find('#productId') ? $('.v12-form').find('#productId').val() : null;\n var v12productGuid = $('.v12-form').find('#productGuid') ? $('.v12-form').find('#productGuid').val() : null;\n var v12productValue = $('.v12-form').find('#productValue') ? $('.v12-form').find('#productValue').val() : null;\n var v12depositPercentage = $('.v12-form').find('#depRange') ? $('.v12-form').find('#depRange').val() : null;\n var isSpecialOrder = $('#isSpecialOrder').val();\n var specialOrderInput = $('#special-order-text');\n var specialOrder = specialOrderInput && isSpecialOrder ? specialOrderInput.val() : null;\n var errorMessages = document.querySelectorAll('.error-msg');\n var hasError = false;\n errorMessages.forEach(errMsg => {\n errMsg.style.display = 'none';\n errMsg.classList.remove('target');\n\n // If the order is not ready to be placed we display an error\n if (readyToOrder !== 'true') {\n errMsg.style.display = 'inline';\n hasError = true;\n }\n if (isSpecialOrder === 'true') {\n if (!specialOrder) {\n errMsg.style.display = 'inline';\n hasError = true;\n } else if (specialOrder) {\n var pattern = /^[\\u0020-\\u007E]*$/;\n var hasRegExError = !specialOrder.match(pattern);\n if (hasRegExError) {\n specialOrderInput.addClass('is-invalid');\n hasError = true;\n } else {\n specialOrderInput.removeClass('is-invalid');\n }\n }\n }\n if (hasError) {\n errMsg.classList.add('target');\n }\n });\n\n $('body').trigger('effect:Ripple', {\n button: $(this),\n event: e\n });\n\n if (hasError) {\n document.querySelector('.target').scrollIntoView({\n behavior: 'smooth'\n });\n return;\n }\n\n $('body').trigger('product:beforeAddToCart', this);\n\n if ($('.set-items').length && $(this).hasClass('add-to-cart-global')) {\n setPids = [];\n\n $('.product-detail').each(function () {\n if (!$(this).hasClass('product-set-detail')) {\n setPids.push({\n pid: $(this).find('.product-id').text(),\n qty: $(this).find('.quantity-select').val(),\n options: getOptions($(this))\n });\n }\n });\n pidsObj = JSON.stringify(setPids);\n }\n\n pid = getPidValue($(this));\n\n var $productContainer = $(this).closest('.product-detail');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail');\n }\n\n addToCartUrl = getAddToCartUrl();\n\n var form = {\n pid: pid,\n pidsObj: pidsObj,\n childProducts: getChildProducts(),\n quantity: getQuantitySelected($(this))\n };\n\n if (specialOrder) {\n form.specialOrderMsg = specialOrder;\n }\n\n if (v12productId) {\n form.v12productId = v12productId;\n }\n\n if (v12productGuid) {\n form.v12productGuid = v12productGuid;\n }\n\n if (v12productValue) {\n form.v12productValue = v12productValue;\n }\n\n if (v12depositPercentage) {\n form.v12depositPercentage = v12depositPercentage;\n }\n\n if (!$('.bundle-item').length) {\n form.options = getOptions($productContainer);\n }\n\n $(this).trigger('updateAddToCartFormData', form);\n if (addToCartUrl) {\n $.ajax({\n url: addToCartUrl,\n method: 'POST',\n data: form,\n success: function (data) {\n handlePostCartAdd(data);\n $('body').trigger('product:afterAddToCart', data);\n $.spinner().stop();\n\n //if there are no bonus products, show minicart\n if (!data.newBonusDiscountLineItem.bonuspids) {\n var minicartTime = $('.minicart-total').attr('data-minicartshowtime');\n if (minicartTime) {\n $('.minicart').trigger('open');\n setTimeout(function () {\n $('.minicart .popover').removeClass('show');\n }, minicartTime);\n }\n }\n\n miniCartReportingUrl(data.reportingURL);\n hideModalIfInFinanceCalculator(e.currentTarget);\n },\n error: function () {\n $.spinner().stop();\n }\n });\n }\n });\n },\n selectBonusProduct: function () {\n $(document).on('click', '.select-bonus-product', function (e) {\n var $choiceOfBonusProduct = $(this).parents('.choice-of-bonus-product');\n var pid = $(this).data('pid');\n var maxPids = $('.choose-bonus-product-dialog').data('total-qty');\n // submittedQty is set to 1 as current implementation only allows 1 bonus product to be selected\n var submittedQty = 1;\n var totalQty = 0;\n $.each($('#chooseBonusProductModal .selected-bonus-products .selected-pid'), function () {\n totalQty += $(this).data('qty');\n });\n totalQty += submittedQty;\n var optionID = $choiceOfBonusProduct.find('.product-option').data('option-id');\n var valueId = $choiceOfBonusProduct.find('.options-select option:selected').data('valueId');\n if (totalQty <= maxPids) {\n var selectedBonusProductHtml = '' +\n '
      ' +\n '
      ' +\n $choiceOfBonusProduct.find('.product-name').html() +\n '
      ' +\n '
      ' +\n '
      ';\n $('#chooseBonusProductModal .selected-bonus-products').append(selectedBonusProductHtml);\n $('.pre-cart-products').html(totalQty);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n } else {\n $('.selected-bonus-products .bonus-summary').addClass('alert-danger');\n }\n $(e.currentTarget).find('input').prop('checked', true);\n $('.choice-of-bonus-product').removeClass('selected-item');\n $('input:checked').closest('.choice-of-bonus-product').addClass('selected-item');\n $('.modal-footer .error-msg').addClass('d-none');\n });\n },\n removeBonusProduct: function () {\n $(document).on('click', '.selected-pid', function () {\n $(this).remove();\n var $selected = $('#chooseBonusProductModal .selected-bonus-products .selected-pid');\n var count = 0;\n if ($selected.length) {\n $selected.each(function () {\n count += parseInt($(this).data('qty'), 10);\n });\n }\n\n $('.pre-cart-products').html(count);\n $('.selected-bonus-products .bonus-summary').removeClass('alert-danger');\n });\n },\n enableBonusProductSelection: function () {\n $('body').on('bonusproduct:updateSelectButton', function (e, response) {\n $('button.select-bonus-product', response.$productContainer).attr('disabled',\n (!response.product.readyToOrder || !response.product.available));\n var pid = response.product.id;\n $('button.select-bonus-product', response.$productContainer).data('pid', pid);\n });\n },\n showMoreBonusProducts: function () {\n $(document).on('click', '.show-more-bonus-products', function () {\n var url = $(this).data('url');\n $('.modal-content').spinner().start();\n $.ajax({\n url: url,\n method: 'GET',\n success: function (html) {\n var parsedHtml = parseHtml(html);\n $('.modal-body').append(parsedHtml.body);\n $('.show-more-bonus-products:first').remove();\n $('.modal-content').spinner().stop();\n },\n error: function () {\n $('.modal-content').spinner().stop();\n }\n });\n });\n },\n addBonusProductsToCart: function () {\n $(document).on('click', '.add-bonus-products', function () {\n var $readyToOrderBonusProducts = $('.choose-bonus-product-dialog .selected-pid');\n if (!$readyToOrderBonusProducts.length) {\n $('.modal-footer .modal-error-msg').removeClass('d-none');\n return;\n }\n var queryString = '?pids=';\n var url = $('.choose-bonus-product-dialog').data('addtocarturl');\n var pidsObject = {\n bonusProducts: []\n };\n\n $.each($readyToOrderBonusProducts, function () {\n var qtyOption =\n parseInt($(this)\n .data('qty'), 10);\n\n var option = null;\n if (qtyOption > 0) {\n if ($(this).data('optionid') && $(this).data('option-selected-value')) {\n option = {};\n option.optionId = $(this).data('optionid');\n option.productId = $(this).data('pid');\n option.selectedValueId = $(this).data('option-selected-value');\n }\n pidsObject.bonusProducts.push({\n pid: $(this).data('pid'),\n qty: qtyOption,\n options: [option]\n });\n pidsObject.totalQty = qtyOption;\n }\n });\n queryString += JSON.stringify(pidsObject);\n queryString = queryString + '&uuid=' + $('.choose-bonus-product-dialog').data('uuid');\n queryString = queryString + '&pliuuid=' + $('.choose-bonus-product-dialog').data('pliuuid');\n $.spinner().start();\n $.ajax({\n url: url + queryString,\n method: 'POST',\n success: function (data) {\n $.spinner().stop();\n if (data.error) {\n $('#chooseBonusProductModal').modal('hide');\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append('
      ');\n }\n $('.add-to-cart-messages').append(\n '
      ' +\n data.errorMessage + '
      '\n );\n setTimeout(function () {\n $('.add-to-basket-alert').remove();\n }, 3000);\n } else {\n $('body').trigger('product:afterAddToCart');\n var minicartTime = $('.minicart-total').attr('data-minicartshowtime');\n if (minicartTime) {\n $('.minicart').trigger('open');\n setTimeout(function () {\n $('.minicart .popover').removeClass('show');\n }, minicartTime);\n }\n $('.configure-bonus-product-attributes').html(data);\n $('.bonus-products-step2').removeClass('hidden-xl-down');\n $('#chooseBonusProductModal').data('withGift', 'true');\n $('#chooseBonusProductModal').modal('hide');\n\n if ($('.add-to-cart-messages').length === 0) {\n $('body').append('
      ');\n }\n $('.minicart-quantity').html(data.totalQty);\n $('.minicart-link').attr({\n 'aria-label': data.minicartCountOfItems,\n title: data.minicartCountOfItems\n });\n $('.add-to-cart-messages').append(\n '
      ' +\n data.msgSuccess + '
      '\n );\n setTimeout(function () {\n $('.add-to-basket-alert').remove();\n if ($('.cart-page').length) {\n location.reload();\n }\n }, 1500);\n }\n },\n error: function () {\n $.spinner().stop();\n }\n });\n });\n },\n\n proceedWithoutGift: function () {\n $(document).on('click', '.proceed-without-gift button', function () {\n $('#chooseBonusProductModal').data('withGift', 'false');\n $('#chooseBonusProductModal').modal('hide');\n var minicartTime = $('.minicart-total').attr('data-minicartshowtime');\n if (minicartTime) {\n $('.minicart').trigger('open');\n setTimeout(function () {\n $('.minicart .popover').removeClass('show');\n }, minicartTime);\n }\n });\n },\n\n getPidValue: getPidValue,\n getQuantitySelected: getQuantitySelected,\n updateProductStockAvailability: updateProductStockAvailability,\n removeMainProductBonusProductModal: removeMainProductBonusProductModal,\n chooseBonusProducts: chooseBonusProducts\n};\n","'use strict';\n\nmodule.exports = {\n init: function () {\n // Enter the times for the timed banner to start and end below\n var cContainer = $('.countdown');\n \n var cStartTime = cContainer.attr(\"data-start-time\"),\n cEndTime = cContainer.attr(\"data-end-time\");\n \n if ($('.countdownTimer').length) {\n var pad = function(n, len) { // leading 0's\n var s = n.toString();\n return (new Array((len - s.length + 1)).join('0')) + s;\n };\n \n if (cEndTime < 0 || cEndTime > 23 || cStartTime < 0 || cStartTime >= 23) {\n console.warn('Time for countdown timer should be set between 0 and 23');\n }\n \n var timeNow = new Date();\n var nextDay = new Date(timeNow);\n nextDay.setDate(nextDay.getDate() + 1);\n nextDay = nextDay.toDateString().split(' ');\n nextDay = nextDay[1] + ' ' + nextDay[2];\n \n if ((timeNow.getHours() < cEndTime) && (timeNow.getHours() >= cStartTime)) {\n changeToTimer();\n }\n \n if (cEndTime > cStartTime && cEndTime <= 23 && cStartTime >= 0) {\n window.setInterval(\n function countDown() {\n var now = new Date(),\n hrs,\n mins,\n str,\n target;\n \n if (now.getDay() >= 0) {\n target = cEndTime; // 12:00 hrs is default cut-off point\n \n if (now.getHours() == cStartTime) {\n changeToTimer();\n }\n \n if ((now.getHours() < target) && (now.getHours() >= cStartTime)) { // don't do anything if we're past the cut-off point\n hrs = (target - 1) - now.getHours();\n if (hrs < 0) hrs = 0;\n mins = 59 - now.getMinutes();\n if (mins === 0 || mins < 0) {\n cContainer.hide();\n }\n str = pad(hrs, 1) + ' hrs ' + pad(mins, 1) + ' mins ';\n $('.countdownTimer').html(str);\n $('.nextDay').html(nextDay);\n } \n } else {\n cContainer.hide();\n }\n }, 1000\n );\n }\n }\n /**\n * Show timer\n */\n function changeToTimer() {\n cContainer.fadeIn('slow');\n }\n }\n};","'use strict';\nlet pageHelpers = require('../helpers/pageHelpers');\nvar base = require('./base');\n\n/**\n * Enable/disable UI elements\n * @param {boolean} enableOrDisable - true or false\n */\nfunction updateAddToCartEnableDisableOtherElements(enableOrDisable) {\n $('button.add-to-cart-global').attr('disabled', enableOrDisable);\n}\n\n/**\n * Animates old element before hiding it and showing the new one\n * @param {number} degrees - number of degrees to rotate the old element\n * @param {jQuery} $old - old element to animate and then hide\n * @param {jQuery} $new - new element to show after hiding old one\n */\nfunction rotateAndSwitch(degrees, $old, $new) {\n $({deg:0}).animate({deg: degrees}, {\n duration: 300,\n step: function (now) {\n $old.css({\n transform: 'rotate(' + now + 'deg)'\n });\n },\n complete: function () {\n $old.addClass('d-none');\n $new.removeClass('d-none');\n }\n });\n}\n\nmodule.exports = {\n methods: {\n updateAddToCartEnableDisableOtherElements: updateAddToCartEnableDisableOtherElements\n },\n\n availability: base.availability,\n\n addToCart: base.addToCart,\n notifyBackInStock: base.notifyBackInStock,\n openBisnModal: base.openBisnModal,\n\n triggerCarouselOnLoad: function () {\n $(function () {\n let $carouselIndicator = $('.primary-images .carousel-indicators');\n\n if ($carouselIndicator && $carouselIndicator.children().length > 0) {\n $carouselIndicator.find('>:first-child').trigger('click');\n }\n });\n },\n\n updateAttributesAndDetails: function () {\n $('body').on('product:statusUpdate', function (e, data) {\n var $productContainer = $('.product-detail[data-pid=\"' + data.id + '\"]');\n\n $productContainer.find('.description-and-detail .product-attributes')\n .empty()\n .html(data.attributesHtml);\n\n if (data.shortDescription) {\n $productContainer.find('.description-and-detail .description')\n .removeClass('hidden-xl-down');\n $productContainer.find('.description-and-detail .description .content')\n .empty()\n .html(data.shortDescription);\n } else {\n $productContainer.find('.description-and-detail .description')\n .addClass('hidden-xl-down');\n }\n\n if (data.longDescription) {\n $productContainer.find('.description-and-detail .details')\n .removeClass('hidden-xl-down');\n $productContainer.find('.description-and-detail .details .content')\n .empty()\n .html(data.longDescription);\n } else {\n $productContainer.find('.description-and-detail .details')\n .addClass('hidden-xl-down');\n }\n });\n },\n\n showSpinner: function () {\n $('body').on('product:beforeAddToCart product:beforeAttributeSelect', function () {\n $.spinner().start();\n });\n },\n\n vimeoInteraction: function () {\n $(document).on('click', '.vimeo-additional-layout', function () {\n $('.vimeo-additional-layout').css('position', 'relative');\n setTimeout(function () {\n $('.vimeo-additional-layout').css('position', 'absolute');\n }, 1500);\n });\n },\n\n updateAttribute: function () {\n $('body').on('product:afterAttributeSelect', function (e, response) {\n if (response.data.product.readyToOrder) {\n var btn = $('button.add-to-cart');\n btn.attr('data-readytoorder', response.data.product.readyToOrder);\n document.querySelector('.error-msg').style.display = 'none';\n }\n if ($('.product-detail>.bundle-items').length) {\n response.container.data('pid', response.data.product.id);\n response.container.find('.product-id').text(response.data.product.id);\n } else if ($('.product-set-detail').eq(0)) {\n response.container.data('pid', response.data.product.id);\n response.container.find('.product-id').text(response.data.product.id);\n } else {\n $('.product-id').text(response.data.product.id);\n $('.product-detail:not(\".bundle-item\")').data('pid', response.data.product.id);\n }\n });\n },\n updateAddToCart: function () {\n $('body').on('product:updateAddToCart', function (e, response) {\n // update local add to cart (for sets)\n if (response.product.readyToOrder && !response.product.available) {// show Notify me btn:\n $('button.add-to-cart').addClass('d-none').removeClass('d-block');\n $('button.back-in-stock').addClass('d-block').removeClass('d-none');\n $('button.in-store-only').addClass('d-none').removeClass('d-block');\n } else if (response.product.storeOnly) {// show Store Only btn:\n $('button.add-to-cart').addClass('d-none').removeClass('d-block');\n $('button.back-in-stock').addClass('d-none').removeClass('d-block');\n $('button.in-store-only').addClass('d-block').removeClass('d-none');\n } else {// show Add to Cart/Preorder:\n $('button.back-in-stock').addClass('d-none').removeClass('d-block');\n $('button.in-store-only').addClass('d-none').removeClass('d-block');\n $('button.add-to-cart').addClass('d-block').removeClass('d-none');\n var isPreorder = response.product.preorderable ? true : false;\n if (isPreorder) {\n $('.js-add-to-cart-txt').addClass('d-none').removeClass('d-block');\n $('.js-preorder-txt').addClass('d-block').removeClass('d-none');\n $('button.add-to-cart').addClass('btn-secondary-light').removeClass('btn-primary-light');\n } else {\n $('.js-preorder-txt').addClass('d-none').removeClass('d-block');\n $('.js-add-to-cart-txt').addClass('d-block').removeClass('d-none');\n $('button.add-to-cart').addClass('btn-primary-light').removeClass('btn-secondary-light');\n }\n }\n\n var isReadyAndAvailable = response.product.readyToOrder && response.product.available;\n\n $('button.add-to-cart', response.$productContainer).attr('disabled', !isReadyAndAvailable);\n $('button.add-to-cart-finance').attr('disabled', !isReadyAndAvailable);\n\n var enable = $('.product-availability').toArray().every(function (item) {\n return $(item).data('available') && $(item).data('ready-to-order');\n });\n module.exports.methods.updateAddToCartEnableDisableOtherElements(!enable);\n });\n },\n updateAvailability: function () {\n $('body').on('product:updateAvailability', function (e, response) {\n $('div.availability', response.$productContainer)\n .data('ready-to-order', response.product.readyToOrder)\n .data('available', response.product.available);\n\n $('.availability-msg', response.$productContainer)\n .empty().html(response.message);\n\n if ($('.global-availability').length) {\n var allAvailable = $('.product-availability').toArray()\n .every(function (item) { return $(item).data('available'); });\n\n var allReady = $('.product-availability').toArray()\n .every(function (item) { return $(item).data('ready-to-order'); });\n\n $('.global-availability')\n .data('ready-to-order', allReady)\n .data('available', allAvailable);\n\n $('.global-availability .availability-msg').empty()\n .html(allReady ? response.message : response.resources.info_selectforstock);\n }\n });\n },\n sizeChart: function () {\n $('.size-chart a').on('click', function (e) {\n e.preventDefault();\n var url = $(this).attr('href');\n var $prodSizeChart = $(this).closest('.size-chart').find('.size-chart-collapsible');\n if ($prodSizeChart.is(':empty')) {\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n $prodSizeChart.append(data.content);\n }\n });\n }\n $prodSizeChart.toggleClass('active');\n });\n\n var $sizeChart = $('.size-chart-collapsible');\n $('body').on('click touchstart', function (e) {\n if ($('.size-chart').has(e.target).length <= 0) {\n $sizeChart.removeClass('active');\n }\n });\n },\n expandReviewsOnClick: function () {\n $('.review #yotpo-bottomline-top-div').on('click', function (e) {\n e.stopPropagation();\n e.preventDefault();\n\n var $reviewTab = $('#reviewHeader > a');\n if ($reviewTab.hasClass('collapsed')) {\n $reviewTab.trigger('click');\n\n $([document.documentElement, document.body]).animate({\n scrollTop: $('#yotpo-reviews-top-div').offset().top\n }, 750);\n }\n });\n },\n scrollToWriteReview: function () {\n $('.yotpo .write-review-button').on('click', function () {\n $([document.documentElement, document.body]).animate({\n scrollTop: $('.write-review-wrapper').offset().top\n }, 750);\n });\n },\n sizeGuide: function () {\n $('.js-size-guide').on('click', function () {\n $('#sizeGuideModal').modal('show');\n });\n\n $('.js-close-size-guide').on('click', function () {\n $('#sizeGuideModal').modal('hide');\n });\n },\n financeCalculator: function () {\n $(document).on('click', '.v12-row a', function () {\n $('#financeCalculatorModal').modal('show');\n });\n\n $('.js-close-finance-calculator').on('click', function () {\n $('#financeCalculatorModal').modal('hide');\n });\n },\n changeTabIcon: function () {\n $(document).on('click', '.js-expand-tab', function () {\n $('.js-expand-tab').each(function () {\n var needsChangeToClose = $(this).hasClass('collapsed') && $(this).children('.tab-plus').hasClass('d-none');\n var needsChangeToOpen = !$(this).hasClass('collapsed') && $(this).children('.tab-minus').hasClass('d-none');\n var plus = $(this).children('.tab-plus');\n var minus = $(this).children('.tab-minus');\n\n if (needsChangeToClose) {\n rotateAndSwitch(-180, minus, plus);\n } else if (needsChangeToOpen) {\n rotateAndSwitch(180, plus, minus);\n }\n });\n });\n },\n selectSizeAttribute: function () {\n $(document).on('click', '.js-size-button', function () {\n var parent = $(this).parent();\n if (!parent.hasClass('selected')) {\n $('.size-item.selected').removeClass('selected');\n parent.addClass('selected');\n var $productContainer = $(this).closest('.set-item');\n if (!$productContainer.length) {\n $productContainer = $(this).closest('.product-detail');\n }\n base.attributeSelect($(this).parent().attr('value'), $productContainer, true); \n }\n });\n },\n copyProductLink: function () {\n $('body').on('click', '#fa-link', function () {\n event.preventDefault();\n var $temp = $('');\n $('body').append($temp);\n $temp.val($('#shareUrl').val()).select();\n document.execCommand('copy');\n $temp.remove();\n $('.copy-link-message').attr('role', 'alert');\n $('.copy-link-message').removeClass('d-none');\n setTimeout(function () {\n $('.copy-link-message').addClass('d-none');\n }, 3000);\n });\n },\n setImageCarouselVertical: function () {\n if (!pageHelpers.isMobileDevice()) {\n $('.primary-images').children('.carousel.slide').addClass('vertical');\n\n $('.carousel').bind('mousewheel', function (e) {\n e.preventDefault();\n if (e.originalEvent.wheelDelta / 120 > 0) {\n $(this).carousel('prev');\n } else {\n $(this).carousel('next');\n }\n });\n } else {\n $('.primary-images').on('touchstart', function (evt) {\n handleTouchStart(evt);\n });\n\n $('.primary-images').on('touchmove', function (evt) {\n handleTouchMove(evt);\n });\n\n var xDown = null;\n var yDown = null;\n\n function getTouches(evt) { // eslint-disable-line\n return evt.touches || evt.originalEvent.touches;\n }\n\n function handleTouchStart(evt) { // eslint-disable-line\n const firstTouch = getTouches(evt)[0];\n xDown = firstTouch.clientX;\n yDown = firstTouch.clientY;\n }\n\n function handleTouchMove(evt) { // eslint-disable-line\n if (!xDown || !yDown) {\n return;\n }\n\n var xUp = evt.touches[0].clientX;\n var yUp = evt.touches[0].clientY;\n\n var xDiff = xDown - xUp;\n var yDiff = yDown - yUp;\n\n if (Math.abs(xDiff) > Math.abs(yDiff)) {\n if (xDiff > 0) {\n $('.carousel').carousel('next');\n } else {\n $('.carousel').carousel('prev');\n }\n }\n\n xDown = null;\n yDown = null;\n }\n }\n\n $(window).on('resize', function () {\n if (pageHelpers.isMobileDevice()) {\n $('.primary-images').children('.carousel.slide').removeClass('vertical');\n } else {\n $('.primary-images').children('.carousel.slide').addClass('vertical');\n }\n });\n },\n minusAndPlusButtons: function () {\n var $dataRange = $('#depRange');\n var stepValue = $dataRange.attr('step');\n var minValue = $dataRange.attr('min');\n var maxValue = $dataRange.attr('max');\n var currentval;\n\n $('.plus').on('click', function () {\n currentval = $('.deposit-range-input').val();\n if (currentval < +maxValue) {\n $('.deposit-range-input').val(+currentval + +stepValue);\n $dataRange.val(+currentval + +stepValue);\n //trigger event to calculate repayments\n $('#deposit').trigger('keyup');\n }\n });\n\n $('.minus').on('click', function () {\n currentval = $('.deposit-range-input').val();\n if (currentval > +minValue) {\n $('.deposit-range-input').val(+currentval - +stepValue);\n $dataRange.val(+currentval - +stepValue);\n //trigger event to calculate repayments\n $('#deposit').trigger('keyup');\n }\n });\n },\n checkPriceWidth: function () {\n var priceWidth = $('.sales.discounted > .value').width();\n if (priceWidth > 110) {\n $('.pdp-content .price-content').addClass('d-flex flex-column');\n }\n },\n specialOrderRegex: function () {\n var prevValue;\n $('#special-order-text').on('input', function () {\n var $this = $(this);\n var pattern = /^[\\u0020-\\u007E]*$/;\n var hasError = !$this.val().match(pattern);\n if (hasError) {\n $this.val(prevValue);\n } else {\n prevValue = $this.val();\n }\n if ($this.hasClass('is-invalid')) {\n if (hasError) {\n $this.addClass('is-invalid');\n } else {\n $this.removeClass('is-invalid');\n }\n }\n });\n },\n\n saleBadgeColor: function () {\n var saleBadgeText = '% OFF';\n var $badge = $('.product-badge');\n\n $badge.each(function () {\n if ($(this).text().indexOf(saleBadgeText) > -1) {\n $(this).addClass('saleBadge');\n }\n });\n },\n\n focusChooseBonusProductModal: base.focusChooseBonusProductModal()\n};\n","'use strict';\n\nvar storeLocator = require('base/storeLocator/storeLocator');\n\n/**\n * Restores Quantity Selector to its original state.\n * @param {HTMLElement} $quantitySelect - The Quantity Select Element\n */\nfunction restoreQuantityOptions($quantitySelect) {\n var originalHTML = $quantitySelect.data('originalHTML');\n if (originalHTML) {\n $quantitySelect.html(originalHTML);\n }\n}\n\n/**\n * Sets the data attribute of Quantity Selector to save its original state.\n * @param {HTMLElement} $quantitySelect - The Quantity Select Element\n */\nfunction setOriginalQuantitySelect($quantitySelect) {\n if (!$quantitySelect.data('originalHTML')) {\n $quantitySelect.data('originalHTML', $quantitySelect.html());\n } // If it's already there, don't re-set it\n}\n\n/**\n * Updates the Quantity Selector based on the In Store Quantity.\n * @param {string} quantitySelector - Quantity Selector\n * @param {string} quantityOptionSelector - Quantity Option Selector\n * @param {number} productAtsValue - Inventory in the selected store\n */\nfunction updateQOptions(quantitySelector, quantityOptionSelector, productAtsValue) {\n var selectedQuantity = $(quantitySelector).val();\n restoreQuantityOptions($(quantitySelector));\n for (var i = $(quantityOptionSelector).length - 1; i >= productAtsValue; i--) {\n $(quantityOptionSelector).eq(i).remove();\n }\n $(quantitySelector + ' option[value=\"' + selectedQuantity + '\"]').attr('selected', 'selected');\n}\n\n/**\n * Generates the modal window on the first call.\n */\nfunction getModalHtmlElement() {\n if ($('#inStoreInventoryModal').length !== 0) {\n $('#inStoreInventoryModal').remove();\n }\n var htmlString = ''\n + '
      '\n + '
      '\n + ''\n + '
      '\n + '
      '\n + ' '\n + '
      '\n + '
      '\n + '
      '\n + '
      '\n + '
      '\n + '
      ';\n $('body').append(htmlString);\n $('#inStoreInventoryModal').modal('show');\n}\n\n/**\n * Replaces the content in the modal window with find stores components and\n * the result store list.\n * @param {string} pid - The product ID to search for\n * @param {number} quantity - Number of products to search inventory for\n * @param {number} selectedPostalCode - The postal code to search for inventory\n * @param {number} selectedRadius - The radius to search for inventory\n */\nfunction fillModalElement(pid, quantity, selectedPostalCode, selectedRadius) {\n var requestData = {\n products: pid + ':' + quantity\n };\n\n if (selectedRadius) {\n requestData.radius = selectedRadius;\n }\n\n if (selectedPostalCode) {\n requestData.postalCode = selectedPostalCode;\n }\n\n $('#inStoreInventoryModal').spinner().start();\n $.ajax({\n url: $('.btn-get-in-store-inventory').data('action-url'),\n data: requestData,\n method: 'GET',\n success: function (response) {\n $('#inStoreInventoryModal .modal-body').empty();\n $('#inStoreInventoryModal .modal-body').html(response.storesResultsHtml);\n storeLocator.search();\n storeLocator.changeRadius();\n storeLocator.selectStore();\n storeLocator.updateSelectStoreButton();\n\n $('.btn-storelocator-search').attr('data-search-pid', pid);\n\n if (selectedRadius) {\n $('#radius').val(selectedRadius);\n }\n\n if (selectedPostalCode) {\n $('#store-postal-code').val(selectedPostalCode);\n }\n\n if (!$('.results').data('has-results')) {\n $('.store-locator-no-results').show();\n }\n\n $('#inStoreInventoryModal').modal('show');\n $('#inStoreInventoryModal').spinner().stop();\n },\n error: function () {\n $('#inStoreInventoryModal').spinner().stop();\n }\n });\n}\n\n/**\n * Remove the selected store.\n * @param {HTMLElement} $container - the target html element\n */\nfunction deselectStore($container) {\n var storeElement = $($container).find('.selected-store-with-inventory');\n $(storeElement).find('.card-body').empty();\n $(storeElement).addClass('d-none');\n $($container).find('.btn-get-in-store-inventory').show();\n $($container).find('.quantity-select').removeData('originalHTML');\n}\n\n/**\n * Update quantity options. Only display quantity options that are available for the store.\n * @param {sring} searchPID - The product ID of the selected product.\n * @param {number} storeId - The store ID selected for in store pickup.\n */\nfunction updateQuantityOptions(searchPID, storeId) {\n var selectorPrefix = '.product-detail[data-pid=\"' + searchPID + '\"]';\n var quantitySelector = selectorPrefix + ' .quantity-select';\n var quantityOptionSelector = quantitySelector + ' option';\n\n setOriginalQuantitySelect($(quantitySelector));\n\n var requestData = {\n pid: searchPID,\n quantitySelected: $(quantitySelector).val(),\n storeId: storeId\n };\n\n $.ajax({\n url: $('.btn-get-in-store-inventory').data('ats-action-url'),\n data: requestData,\n method: 'GET',\n success: function (response) {\n // Update Quantity dropdown, Remove quantity greater than inventory\n var productAtsValue = response.atsValue;\n var availabilityValue = '';\n\n var $productContainer = $('.product-detail[data-pid=\"' + searchPID + '\"]');\n\n if (!response.product.readyToOrder) {\n availabilityValue = '
      ' + response.resources.info_selectforstock + '
      ';\n } else {\n response.product.messages.forEach(function (message) {\n availabilityValue += '
      ' + message + '
      ';\n });\n }\n\n $($productContainer).trigger('product:updateAvailability', {\n product: response.product,\n $productContainer: $productContainer,\n message: availabilityValue,\n resources: response.resources\n });\n\n $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').trigger('product:updateAddToCart', {\n product: response.product, $productContainer: $productContainer\n });\n\n updateQOptions(quantitySelector, quantityOptionSelector, productAtsValue);\n }\n });\n}\n\nmodule.exports = {\n updateSelectStore: function () {\n $('body').on('product:updateAddToCart', function (e, response) {\n var disabledBtn = !response.product.readyToOrder || !response.product.available || !response.product.availableForInStorePickup;\n $('.btn-get-in-store-inventory', response.$productContainer).attr('disabled', disabledBtn);\n });\n },\n removeSelectedStoreOnAttributeChange: function () {\n $('body').on('product:afterAttributeSelect', function (e, response) {\n response.container.attr('data-pid', response.data.product.id);\n deselectStore(response.container);\n });\n },\n updateAddToCartFormData: function () {\n $('body').on('updateAddToCartFormData', function (e, form) {\n if (form.pidsObj) {\n var pidsObj = JSON.parse(form.pidsObj);\n pidsObj.forEach(function (product) {\n var storeElement = $('.product-detail[data-pid=\"' +\n product.pid\n + '\"]').find('.store-name');\n product.storeId = $(storeElement).length// eslint-disable-line no-param-reassign\n ? $(storeElement).attr('data-store-id')\n : null;\n });\n\n form.pidsObj = JSON.stringify(pidsObj);// eslint-disable-line no-param-reassign\n }\n\n var storeElement = $('.product-detail[data-pid=\"'\n + form.pid\n + '\"]');\n\n if ($(storeElement).length) {\n form.storeId = $(storeElement).find('.store-name') // eslint-disable-line\n .attr('data-store-id');\n }\n });\n },\n showInStoreInventory: function () {\n $('.btn-get-in-store-inventory').on('click', function (e) {\n var pid = $(this).closest('.product-detail').attr('data-pid');\n var quantity = $(this).closest('.product-detail').find('.quantity-select').val();\n getModalHtmlElement();\n fillModalElement(pid, quantity);\n e.stopPropagation();\n });\n },\n removeStoreSelection: function () {\n $('body').on('click', '#remove-store-selection', (function () {\n deselectStore($(this).closest('.product-detail'));\n $(document).trigger('store:afterRemoveStoreSelection', $(this).closest('.product-detail').find('.quantity-select'));\n }));\n },\n selectStoreWithInventory: function () {\n $('body').on('store:selected', function (e, data) {\n var searchPID = $('.btn-storelocator-search').attr('data-search-pid');\n var storeElement = $('.product-detail[data-pid=\"' + searchPID + '\"]');\n $(storeElement).find('.selected-store-with-inventory .card-body').empty();\n $(storeElement).find('.selected-store-with-inventory .card-body').append(data.storeDetailsHtml);\n $(storeElement).find('.store-name').attr('data-store-id', data.storeID);\n $(storeElement).find('.selected-store-with-inventory').removeClass('d-none');\n\n var $changeStoreButton = $(storeElement).find('.change-store');\n $($changeStoreButton).data('postal', data.searchPostalCode);\n $($changeStoreButton).data('radius', data.searchRadius);\n\n $(storeElement).find('.btn-get-in-store-inventory').hide();\n\n updateQuantityOptions(searchPID, data.storeID);\n\n $('#inStoreInventoryModal').modal('hide');\n $('#inStoreInventoryModal').remove();\n });\n },\n changeStore: function () {\n $('body').on('click', '.change-store', (function () {\n var pid = $(this).closest('.product-detail').attr('data-pid');\n var quantity = $(this).closest('.product-detail').find('.quantity-select').val();\n getModalHtmlElement();\n fillModalElement(pid, quantity, $(this).data('postal'), $(this).data('radius'));\n }));\n }\n};\n","'use strict';\n\n\n/**\n * appends params to a url\n * @param {string} data - data returned from the server's ajax call\n * @param {Object} button - button that was clicked to add a product to the wishlist\n */\nfunction displayMessage(data) {\n var $addBtn = $('.add-to-wish-list');\n var $removeBtn = $('.remove-from-wish-list');\n $.spinner().stop();\n if (data.success) {\n var oldWishlishlLength = $('.wishlist-quantity').html();\n oldWishlishlLength = parseInt(oldWishlishlLength, 10);\n\n if ($addBtn.hasClass('d-none')) {\n $removeBtn.addClass('d-none');\n $addBtn.removeClass('d-none');\n $('.wishlist-quantity').html(oldWishlishlLength - 1);\n } else {\n $addBtn.addClass('d-none');\n $removeBtn.removeClass('d-none');\n $('.wishlist-quantity').html(oldWishlishlLength + 1);\n }\n }\n}\n\nmodule.exports = {\n addToWishlist: function () {\n $('.add-to-wish-list, .js-add-to-wish-list-tile').on('click', function (e) {\n e.preventDefault();\n var url = $(this).data('href');\n var pid = $(this).closest('.product-detail').attr('data-pid');\n var optionId = $(this).closest('.product-detail').find('.product-option').attr('data-option-id');\n var optionVal = $(this).closest('.product-detail').find('.options-select option:selected').attr('data-value-id');\n optionId = optionId || null;\n optionVal = optionVal || null;\n if (!url || !pid) {\n return;\n }\n\n $.spinner().start();\n $.ajax({\n url: url,\n type: 'post',\n dataType: 'json',\n data: {\n pid: pid,\n optionId: optionId,\n optionVal: optionVal\n },\n success: function (data) {\n displayMessage(data);\n $('body').trigger('effect:Ripple', {\n button: $('.remove-from-wish-list'),\n event: e\n });\n },\n error: function (err) {\n displayMessage(err);\n }\n });\n });\n },\n removeFromWishlist: function () {\n $('body').on('click', '.remove-from-wish-list', function (e) {\n e.preventDefault();\n var pid = $('.product-detail').data('pid');\n var url = $(this).data('href');\n url = url + '?pid=' + pid;\n $.spinner().start();\n\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n data: {},\n success: function (data) {\n displayMessage(data);\n $('body').trigger('effect:Ripple', {\n button: $('.add-to-wish-list'),\n event: e\n });\n },\n error: function (err) {\n displayMessage(err);\n }\n });\n });\n }\n};\n","/* globals google */\n'use strict';\n\n/**\n * appends params to a url\n * @param {string} url - Original url\n * @param {Object} params - Parameters to append\n * @returns {string} result url with appended parameters\n */\nfunction appendToUrl(url, params) {\n var newUrl = url;\n newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) {\n return key + '=' + encodeURIComponent(params[key]);\n }).join('&');\n\n return newUrl;\n}\n\n/**\n * Uses google maps api to render a map\n */\nfunction maps() {\n var map;\n var infowindow = new google.maps.InfoWindow();\n\n // Init U.S. Map in the center of the viewport\n var latlng = new google.maps.LatLng(54.167582, -4.464872);\n var mapOptions = {\n scrollwheel: false,\n zoom: 5,\n center: latlng\n };\n\n map = new google.maps.Map($('.map-canvas')[0], mapOptions);\n var bounds = new google.maps.LatLngBounds();\n\n // Customized google map marker icon with svg format\n var markerImg = {\n path: 'M13.5,30.1460153 L16.8554555,25.5 L20.0024287,25.5 C23.039087,25.5 25.5,' +\n '23.0388955 25.5,20.0024287 L25.5,5.99757128 C25.5,2.96091298 23.0388955,0.5 ' +\n '20.0024287,0.5 L5.99757128,0.5 C2.96091298,0.5 0.5,2.96110446 0.5,5.99757128 ' +\n 'L0.5,20.0024287 C0.5,23.039087 2.96110446,25.5 5.99757128,25.5 L10.1445445,' +\n '25.5 L13.5,30.1460153 Z',\n fillColor: '#0070d2',\n fillOpacity: 1,\n scale: 1.1,\n strokeColor: 'white',\n strokeWeight: 1,\n anchor: new google.maps.Point(13, 30),\n labelOrigin: new google.maps.Point(12, 12)\n };\n\n var mapdiv = $('.map-canvas').attr('data-locations');\n var mapdivSingle = $('.map-canvas').attr('data-location');\n\n if (mapdiv) {\n mapdiv = JSON.parse(mapdiv);\n\n Object.keys(mapdiv).forEach(function (key) {\n var item = mapdiv[key];\n var lable = parseInt(key, 10) + 1;\n var storeLocation = new google.maps.LatLng(item.latitude, item.longitude);\n var marker = new google.maps.Marker({\n position: storeLocation,\n map: map,\n title: item.name,\n icon: markerImg,\n label: {\n text: lable.toString(),\n color: 'white',\n fontSize: '16px'\n }\n });\n\n marker.addListener('click', function () {\n infowindow.setOptions({\n content: item.infoWindowHtml\n });\n infowindow.open(map, marker);\n });\n\n // Create a minimum bound based on a set of storeLocations\n bounds.extend(marker.position);\n });\n } else if (mapdivSingle) {\n mapdiv = JSON.parse(mapdivSingle);\n var item = mapdiv;\n var storeLocation = new google.maps.LatLng(item.latitude, item.longitude);\n var marker = new google.maps.Marker({\n position: storeLocation,\n map: map,\n title: item.name,\n });\n\n marker.addListener('click', function () {\n infowindow.setOptions({\n content: item.infoWindowHtml\n });\n infowindow.open(map, marker);\n });\n\n // Create a minimum bound based on a set of storeLocations\n bounds.extend(marker.position);\n }\n\n // Fit the all the store marks in the center of a minimum bounds when any store has been found.\n if (mapdiv && mapdiv.length !== 0) {\n map.fitBounds(bounds);\n }\n}\n\n/**\n * Renders the results of the search and updates the map\n * @param {Object} data - Response from the server\n */\nfunction updateStoresResults(data) {\n var $resultsDiv = $('.results');\n var $mapDiv = $('.map-canvas');\n var hasResults = data.stores.length > 0;\n var isCheckout = $('#checkout-main').length > 0;\n var postalCodeField = $('#store-postal-code');\n\n if (!hasResults) {\n if (isCheckout && postalCodeField) {\n if (!$(postalCodeField).hasClass('is-invalid')) {\n $(postalCodeField).addClass('is-invalid');\n }\n $('.store-locator-component-result').hide();\n }\n\n $('.store-locator-no-results').show();\n } else {\n if (isCheckout && postalCodeField) {\n if ($(postalCodeField).hasClass('is-invalid')) {\n $(postalCodeField).removeClass('is-invalid');\n }\n $('.store-locator-component-result').show();\n }\n\n $('.store-locator-no-results').hide();\n }\n\n $resultsDiv.empty()\n .data('has-results', hasResults)\n .data('radius', data.radius)\n .data('search-key', data.searchKey);\n\n $mapDiv.attr('data-locations', data.locations);\n\n if ($mapDiv.data('has-google-api')) {\n maps();\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n if (data.storesResultsHtml) {\n $resultsDiv.append(data.storesResultsHtml);\n }\n}\n\n/**\n * Searches for in store availability\n * @param {Object} instoreAvailabilityInput - The input field for the search\n * @param {Object} invalidFeedback - The invalid feedback element\n * @param {Object} geocoder - The google maps geocoder\n * @param {Object} coordinates - The coordinates of the searched address\n * @param {Object} payload - The payload for the inStoreAvailabilitySearch\n */\nfunction searchInStoreAvailability() {\n var instoreAvailabilityInput = $('.instore-availability-input');\n var invalidFeedback = $('.instore-availability-stores-tab > .invalid-feedback');\n invalidFeedback.removeClass('d-block');\n\n if (instoreAvailabilityInput.val().length === 0) {\n invalidFeedback.text(instoreAvailabilityInput.data('missing-error'));\n invalidFeedback.addClass('d-block');\n } else if (checkSizeSelected()) {\n const geocoder = new google.maps.Geocoder();\n\n geocoder.geocode({\n 'address': instoreAvailabilityInput.val() // The address from the Input field. It can be a post code also\n }, function (results, status) {\n var coordinates = null;\n if (status == google.maps.GeocoderStatus.OK) {\n coordinates = results;\n }\n\n if (coordinates || instoreAvailabilityInput.val().length) {\n var payload = {};\n\n /* Check if there is a result with Location name */\n if (coordinates && coordinates.length) {\n payload.lat = coordinates[0].geometry.location.lat();\n payload.long = coordinates[0].geometry.location.lng();\n } else {\n /* If not guess the input as postalCode */\n payload.postalCode = instoreAvailabilityInput.val();\n }\n\n inStoreAvailabilitySearch(payload);\n }\n });\n }\n}\n\n/**\n * Search for stores with new zip code\n * @param {HTMLElement} element - the target html element\n * @returns {boolean} false to prevent default event\n */\nfunction search(element) {\n var dialog = element.closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n var $form = element.closest('.store-locator');\n var radius = $('.results').data('radius');\n var url = $form.attr('action');\n var urlParams = {\n radius: radius\n };\n var postalCode = $form.find('[name=\"postalCode\"]').val().toUpperCase();\n var isCheckout = $('#checkout-main').length > 0;\n var result = true;\n\n if ($('body').hasClass('fraser-hart') == true && isCheckout) {\n var postalCodeField = $('#store-postal-code');\n var pattern = /(^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$)/;\n result = pattern.test(postalCode);\n\n if (!result) {\n $(postalCodeField).addClass('is-invalid');\n } else if ($(postalCodeField).hasClass('is-invalid')) {\n $(postalCodeField).removeClass('is-invalid');\n }\n }\n\n if (result) {\n spinner.start();\n var payload = $form.is('form') ? $form.serialize() : {\n postalCode: postalCode\n };\n\n url = appendToUrl(url, urlParams);\n\n $.ajax({\n url: url,\n type: $form.attr('method'),\n data: payload,\n dataType: 'json',\n success: function (data) {\n spinner.stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n }\n return false;\n}\n\n/**\n * Checks if a size has been selected for the product\n * @returns {boolean} - true if a size has been selected, false otherwise\n */\nfunction checkSizeSelected() {\n /* Check if the product is ready to order / available */\n var buttonAddToCart = $('button.add-to-cart');\n if (!buttonAddToCart.hasClass('d-none') && buttonAddToCart.attr('data-readytoorder') === 'false') {\n var productSizeAttr = $('div.product-attribute[data-attr=\"Size\"]');\n var invalidFeedbackSelectSize = productSizeAttr.find('.error-msg');\n invalidFeedbackSelectSize.css('display', 'inline');\n\n var headerContainer = $('.header-container');\n var offsetPosition = productSizeAttr[0].getBoundingClientRect().top + window.scrollY - headerContainer.height();\n\n $('html, body').animate({\n scrollTop: offsetPosition\n }, 'slow');\n return false;\n }\n return true;\n}\n\n/**\n * Resets the in store availability tab\n */\nfunction resetInStoreAvailabilityTab() {\n $('.instore-availability-input').val('');\n $('.instore-availability-stores-result').html('');\n $('.instore-availability-stores-tab > .invalid-feedback').removeClass('d-block');\n $('.instore-availability-stores-tab > .invalid-feedback').addClass('d-none');\n}\n\n\n/**\n * Performs an AJAX call to search for stores with in-store availability\n * @param {Object} payload - the payload object containing the search parameters\n */\nfunction inStoreAvailabilitySearch(payload) {\n var instoreAvailabilityStoresResult = $('.instore-availability-stores-result');\n var InStoreAvailabilitySearchURL = $('input[name=\"InStoreAvailabilitySearchURL\"').val();\n var productId = $('.product-detail').data('pid');\n var invalidFeedback = $('.instore-availability-stores-tab > .invalid-feedback');\n\n invalidFeedback.removeClass('d-block');\n payload.products = productId;\n\n instoreAvailabilityStoresResult.fadeOut('slow', function () {\n $.ajax({\n url: InStoreAvailabilitySearchURL,\n type: 'GET',\n data: payload,\n dataType: 'json',\n success: function (data) {\n if (data.stores.length > 0) {\n instoreAvailabilityStoresResult.html(data.storesResultsHtml);\n instoreAvailabilityStoresResult.fadeIn('slow');\n } else {\n var instoreAvailabilityInput = $('.instore-availability-input');\n instoreAvailabilityStoresResult.html('');\n invalidFeedback.text(instoreAvailabilityInput.data('no-result-error'));\n invalidFeedback.addClass('d-block');\n }\n }\n });\n });\n}\n\nmodule.exports = {\n init: function () {\n if ($('.map-canvas').data('has-google-api')) {\n maps();\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n if (!$('.results').data('has-results')) {\n $('.store-locator-no-results').show();\n }\n },\n\n detectLocation: function () {\n // clicking on detect location.\n $('.detect-location').on('click', function () {\n $.spinner().start();\n if (!navigator.geolocation) {\n $.spinner().stop();\n return;\n }\n\n navigator.geolocation.getCurrentPosition(\n function (position) {\n var $detectLocationButton = $('.detect-location');\n var url = $detectLocationButton.data('action');\n var radius = $('.results').data('radius');\n var urlParams = {\n radius: radius,\n lat: position.coords.latitude,\n long: position.coords.longitude\n };\n\n url = appendToUrl(url, urlParams);\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n $.spinner().stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n },\n function () {\n // Handle geolocation error.\n $.spinner().stop();\n });\n });\n },\n\n search: function () {\n $('.store-locator-container form.store-locator').submit(function (e) {\n e.preventDefault();\n search($(this));\n });\n $('.store-locator-container .btn-storelocator-search[type=\"button\"]').click(function (e) {\n e.preventDefault();\n search($(this));\n });\n $('body').on('keypress', '.store-locator-container', (function (e) {\n if (e.which == 13) {\n e.preventDefault();\n search($(this).find('.btn-storelocator-search[type=\"button\"]'));\n }\n }));\n },\n\n changeRadius: function () {\n $('.store-locator-container .radius').change(function () {\n var radius = $(this).val();\n var searchKeys = $('.results').data('search-key');\n var url = $(this).data('action-url');\n var urlParams = {};\n\n if (searchKeys.postalCode) {\n urlParams = {\n radius: radius,\n postalCode: searchKeys.postalCode\n };\n } else if (searchKeys.lat && searchKeys.long) {\n urlParams = {\n radius: radius,\n lat: searchKeys.lat,\n long: searchKeys.long\n };\n }\n\n url = appendToUrl(url, urlParams);\n var dialog = $(this).closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n spinner.start();\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n spinner.stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n });\n },\n selectStore: function () {\n $('.store-locator-container').on('click', '.select-store', (function (e) {\n e.preventDefault();\n var selectedStore = $(':checked', '.results-card .results');\n var data = {\n storeID: selectedStore.val(),\n searchRadius: $('#radius').val(),\n searchPostalCode: $('.results').data('search-key').postalCode,\n storeDetailsHtml: selectedStore.siblings('label').find('.store-details').html(),\n event: e\n };\n\n $('body').trigger('store:selected', data);\n $('.js-error-checkout').hide();\n }));\n },\n updateSelectStoreButton: function () {\n $('body').on('change', '.select-store-input', (function () {\n $('.select-store').prop('disabled', false);\n $('.store-locator-container .select-store').trigger('click');\n }));\n },\n storeDetailLinks: function () {\n $('.store-detail-links a').on('click', function () {\n var target = $(this).data('href');\n\n $([document.documentElement, document.body]).animate({\n scrollTop: $(target).offset().top - 95\n }, 750);\n });\n },\n updateInStoreTabVisibility: function () {\n $('body').on('product:statusUpdate', function (e, data) {\n var availableForInStorePickup = data.availableForInStorePickup;\n var $inStoreAvailabilityTabs = $('.in-store-availability-tabs');\n var $instoreAvailabilityStoresTab = $('.instore-availability-stores-tab');\n var $instoreAvailabilityStoresHeader = $('.instore-availability-stores-header');\n if (availableForInStorePickup === true) {\n $instoreAvailabilityStoresTab.removeClass('d-none');\n $instoreAvailabilityStoresHeader.removeClass('d-none');\n $inStoreAvailabilityTabs.tabs({\n active: 0\n });\n } else {\n $instoreAvailabilityStoresTab.addClass('d-none');\n $instoreAvailabilityStoresHeader.addClass('d-none');\n $inStoreAvailabilityTabs.tabs({\n active: 1\n });\n }\n });\n },\n intilizePDPInStoreTabs: function () {\n $(document).ready(function () {\n var $inStoreAvailabilityTabs = $('.in-store-availability-tabs');\n var availableForInStorePickup = $('input[name=\"availableForInStorePickup\"]').val();\n $inStoreAvailabilityTabs.tabs({\n active: availableForInStorePickup === 'true' ? 0 : 1,\n disabled: [],\n select: function (event, ui) {\n $(ui.panel).fadeOut('slow');\n },\n show: function (event, ui) {\n $(ui.panel).fadeIn('slow');\n }\n });\n $inStoreAvailabilityTabs.removeClass('d-none');\n });\n },\n afterAttributeSelection: function () {\n $('body').on('product:afterAttributeSelect', function () {\n resetInStoreAvailabilityTab();\n });\n },\n seachInstoreAvailability: function () {\n $('body').on('click', '.instore-availability-search-btn', function () {\n searchInStoreAvailability();\n });\n $('body').on('keydown', '.instore-availability-input', function (e) {\n if (e.which === 13) {\n e.preventDefault();\n searchInStoreAvailability();\n }\n });\n }\n};\n","'use strict';\n\nmodule.exports = function (include) {\n if (typeof include === 'function') {\n include();\n } else if (typeof include === 'object') {\n Object.keys(include).forEach(function (key) {\n if (typeof include[key] === 'function') {\n include[key]();\n }\n });\n }\n};\n","/* globals google */\n'use strict';\n\n/**\n * appends params to a url\n * @param {string} url - Original url\n * @param {Object} params - Parameters to append\n * @returns {string} result url with appended parameters\n */\nfunction appendToUrl(url, params) {\n var newUrl = url;\n newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) {\n return key + '=' + encodeURIComponent(params[key]);\n }).join('&');\n\n return newUrl;\n}\n\n/**\n * Uses google maps api to render a map\n */\nfunction maps() {\n var map;\n var infowindow = new google.maps.InfoWindow();\n\n // Init U.S. Map in the center of the viewport\n var latlng = new google.maps.LatLng(37.09024, -95.712891);\n var mapOptions = {\n scrollwheel: false,\n zoom: 4,\n center: latlng\n };\n\n map = new google.maps.Map($('.map-canvas')[0], mapOptions);\n var mapdiv = $('.map-canvas').attr('data-locations');\n\n mapdiv = JSON.parse(mapdiv);\n\n var bounds = new google.maps.LatLngBounds();\n\n // Customized google map marker icon with svg format\n var markerImg = {\n path: 'M13.5,30.1460153 L16.8554555,25.5 L20.0024287,25.5 C23.039087,25.5 25.5,' +\n '23.0388955 25.5,20.0024287 L25.5,5.99757128 C25.5,2.96091298 23.0388955,0.5 ' +\n '20.0024287,0.5 L5.99757128,0.5 C2.96091298,0.5 0.5,2.96110446 0.5,5.99757128 ' +\n 'L0.5,20.0024287 C0.5,23.039087 2.96110446,25.5 5.99757128,25.5 L10.1445445,' +\n '25.5 L13.5,30.1460153 Z',\n fillColor: '#0070d2',\n fillOpacity: 1,\n scale: 1.1,\n strokeColor: 'white',\n strokeWeight: 1,\n anchor: new google.maps.Point(13, 30),\n labelOrigin: new google.maps.Point(12, 12)\n };\n\n Object.keys(mapdiv).forEach(function (key) {\n var item = mapdiv[key];\n var lable = parseInt(key, 10) + 1;\n var storeLocation = new google.maps.LatLng(item.latitude, item.longitude);\n var marker = new google.maps.Marker({\n position: storeLocation,\n map: map,\n title: item.name,\n icon: markerImg,\n label: { text: lable.toString(), color: 'white', fontSize: '16px' }\n });\n\n marker.addListener('click', function () {\n infowindow.setOptions({\n content: item.infoWindowHtml\n });\n infowindow.open(map, marker);\n });\n\n // Create a minimum bound based on a set of storeLocations\n bounds.extend(marker.position);\n });\n // Fit the all the store marks in the center of a minimum bounds when any store has been found.\n if (mapdiv && mapdiv.length !== 0) {\n map.fitBounds(bounds);\n }\n}\n\n/**\n * Renders the results of the search and updates the map\n * @param {Object} data - Response from the server\n */\nfunction updateStoresResults(data) {\n var $resultsDiv = $('.results');\n var $mapDiv = $('.map-canvas');\n var hasResults = data.stores.length > 0;\n\n if (!hasResults) {\n $('.store-locator-no-results').show();\n } else {\n $('.store-locator-no-results').hide();\n }\n\n $resultsDiv.empty()\n .data('has-results', hasResults)\n .data('radius', data.radius)\n .data('search-key', data.searchKey);\n\n $mapDiv.attr('data-locations', data.locations);\n\n if ($mapDiv.data('has-google-api')) {\n maps();\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n if (data.storesResultsHtml) {\n $resultsDiv.append(data.storesResultsHtml);\n }\n}\n\n/**\n * Search for stores with new zip code\n * @param {HTMLElement} element - the target html element\n * @returns {boolean} false to prevent default event\n */\nfunction search(element) {\n var dialog = element.closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n spinner.start();\n var $form = element.closest('.store-locator');\n var radius = $('.results').data('radius');\n var url = $form.attr('action');\n var urlParams = { radius: radius };\n\n var payload = $form.is('form') ? $form.serialize() : { postalCode: $form.find('[name=\"postalCode\"]').val() };\n\n url = appendToUrl(url, urlParams);\n\n $.ajax({\n url: url,\n type: $form.attr('method'),\n data: payload,\n dataType: 'json',\n success: function (data) {\n spinner.stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n return false;\n}\n\nmodule.exports = {\n init: function () {\n if ($('.map-canvas').data('has-google-api')) {\n maps();\n } else {\n $('.store-locator-no-apiKey').show();\n }\n\n if (!$('.results').data('has-results')) {\n $('.store-locator-no-results').show();\n }\n },\n\n detectLocation: function () {\n // clicking on detect location.\n $('.detect-location').on('click', function () {\n $.spinner().start();\n if (!navigator.geolocation) {\n $.spinner().stop();\n return;\n }\n\n navigator.geolocation.getCurrentPosition(function (position) {\n var $detectLocationButton = $('.detect-location');\n var url = $detectLocationButton.data('action');\n var radius = $('.results').data('radius');\n var urlParams = {\n radius: radius,\n lat: position.coords.latitude,\n long: position.coords.longitude\n };\n\n url = appendToUrl(url, urlParams);\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n $.spinner().stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n });\n });\n },\n\n search: function () {\n $('.store-locator-container form.store-locator').submit(function (e) {\n e.preventDefault();\n search($(this));\n });\n $('.store-locator-container .btn-storelocator-search[type=\"button\"]').click(function (e) {\n e.preventDefault();\n search($(this));\n });\n },\n\n changeRadius: function () {\n $('.store-locator-container .radius').change(function () {\n var radius = $(this).val();\n var searchKeys = $('.results').data('search-key');\n var url = $(this).data('action-url');\n var urlParams = {};\n\n if (searchKeys.postalCode) {\n urlParams = {\n radius: radius,\n postalCode: searchKeys.postalCode\n };\n } else if (searchKeys.lat && searchKeys.long) {\n urlParams = {\n radius: radius,\n lat: searchKeys.lat,\n long: searchKeys.long\n };\n }\n\n url = appendToUrl(url, urlParams);\n var dialog = $(this).closest('.in-store-inventory-dialog');\n var spinner = dialog.length ? dialog.spinner() : $.spinner();\n spinner.start();\n $.ajax({\n url: url,\n type: 'get',\n dataType: 'json',\n success: function (data) {\n spinner.stop();\n updateStoresResults(data);\n $('.select-store').prop('disabled', true);\n }\n });\n });\n },\n selectStore: function () {\n $('.store-locator-container').on('click', '.select-store', (function (e) {\n e.preventDefault();\n var selectedStore = $(':checked', '.results-card .results');\n var data = {\n storeID: selectedStore.val(),\n searchRadius: $('#radius').val(),\n searchPostalCode: $('.results').data('search-key').postalCode,\n storeDetailsHtml: selectedStore.siblings('label').find('.store-details').html(),\n event: e\n };\n\n $('body').trigger('store:selected', data);\n }));\n },\n updateSelectStoreButton: function () {\n $('body').on('change', '.select-store-input', (function () {\n $('.select-store').prop('disabled', false);\n }));\n }\n};\n","!function(root, factory) {\n \"function\" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set\n define([], function() {\n return root.svg4everybody = factory();\n }) : \"object\" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory() : root.svg4everybody = factory();\n}(this, function() {\n /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */\n function embed(parent, svg, target) {\n // if the target exists\n if (target) {\n // create a document fragment to hold the contents of the target\n var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute(\"viewBox\") && target.getAttribute(\"viewBox\");\n // conditionally set the viewBox on the svg\n viewBox && svg.setAttribute(\"viewBox\", viewBox);\n // copy the contents of the clone into the fragment\n for (// clone the target\n var clone = target.cloneNode(!0); clone.childNodes.length; ) {\n fragment.appendChild(clone.firstChild);\n }\n // append the fragment into the svg\n parent.appendChild(fragment);\n }\n }\n function loadreadystatechange(xhr) {\n // listen to changes in the request\n xhr.onreadystatechange = function() {\n // if the request is ready\n if (4 === xhr.readyState) {\n // get the cached html document\n var cachedDocument = xhr._cachedDocument;\n // ensure the cached html document based on the xhr response\n cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(\"\"), \n cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item\n xhr._embeds.splice(0).map(function(item) {\n // get the cached target\n var target = xhr._cachedTarget[item.id];\n // ensure the cached target\n target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), \n // embed the target into the svg\n embed(item.parent, item.svg, target);\n });\n }\n }, // test the ready state change immediately\n xhr.onreadystatechange();\n }\n function svg4everybody(rawopts) {\n function oninterval() {\n // while the index exists in the live collection\n for (// get the cached index\n var index = 0; index < uses.length; ) {\n // get the current \n var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute(\"xlink:href\") || use.getAttribute(\"href\");\n if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), \n svg && src) {\n if (polyfill) {\n if (!opts.validate || opts.validate(src, svg, use)) {\n // remove the element\n parent.removeChild(use);\n // parse the src and get the url and id\n var srcSplit = src.split(\"#\"), url = srcSplit.shift(), id = srcSplit.join(\"#\");\n // if the link is external\n if (url.length) {\n // get the cached xhr request\n var xhr = requests[url];\n // ensure the xhr request exists\n xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open(\"GET\", url), xhr.send(), \n xhr._embeds = []), // add the svg and id as an item to the xhr embeds list\n xhr._embeds.push({\n parent: parent,\n svg: svg,\n id: id\n }), // prepare the xhr ready state change event\n loadreadystatechange(xhr);\n } else {\n // embed the local id into the svg\n embed(parent, svg, document.getElementById(id));\n }\n } else {\n // increase the index when the previous value was not \"valid\"\n ++index, ++numberOfSvgUseElementsToBypass;\n }\n }\n } else {\n // increase the index when the previous value was not \"valid\"\n ++index;\n }\n }\n // continue the interval\n (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67);\n }\n var polyfill, opts = Object(rawopts), newerIEUA = /\\bTrident\\/[567]\\b|\\bMSIE (?:9|10)\\.0\\b/, webkitUA = /\\bAppleWebKit\\/(\\d+)\\b/, olderEdgeUA = /\\bEdge\\/12\\.(\\d+)\\b/, edgeUA = /\\bEdge\\/.(\\d+)\\b/, inIframe = window.top !== window.self;\n polyfill = \"polyfill\" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe;\n // create xhr requests object\n var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName(\"use\"), numberOfSvgUseElementsToBypass = 0;\n // conditionally start the interval if the polyfill is active\n polyfill && oninterval();\n }\n function getSVGAncestor(node) {\n for (var svg = node; \"svg\" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {}\n return svg;\n }\n return svg4everybody;\n});","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","'use strict';\n\nvar processInclude = require('./util');\n\n$(document).ready(function () {\n processInclude(require('./product/detail'));\n processInclude(require('./product/wishlist'));\n processInclude(require('./product/pdpInstoreInventory'));\n processInclude(require('./storeLocator/storeLocator'));\n});\n","require('svg4everybody')({});\n"],"names":[],"sourceRoot":""}