"use strict";angular.module("CCG.Shared",["MxGroup.Shared"]);angular.module("CCG.Shared").controller("faqSearchController",["urlService","faqSearchService",function(n,t){var i=this;i.searchQuestions=function(n){if(n.length)return i.loading=!0,t.search(n).finally(function(){i.loading=!1})};i.questionSelected=function(t){var i,r;t&&t.originalObject&&((i=t.originalObject,!i||parseInt(i.QuestionID)<=0)||(r=i.AnchorName?i.AnchorName:"question-"+i.QuestionID,window.location=n.baseUrl+i.CategorySEOName+"/"+i.SubCategorySEOName+"/#"+r))}}]);angular.module("CCG.Shared").provider("faqSearchService",[function(){var n={previousSearches:{},noResultsText:"No results found",$get:["$q","webServiceFactory",function(t,i){return i.create({search:function(i){var r,u,f;return i.length?(i=i.replace("/","-"),r=i,u=n.previousSearches[r],u)?t.when(u):(f="~/about/help-center-faqs/search/?keywords="+URI.encode(i),this.get(f).then(function(t){return t&&t.length!=0||(t=[{QuestionName:n.noResultsText,QuestionID:0,SubCategorySEOName:"",CategorySEOName:"",AnchorName:""}]),n.previousSearches[r]=t,t})):t.when([])}})}]};return n}]);angular.module("CCG.Shared").controller("acceptTermsController",["$window","accountService",function(n,t){var i=this;i.isSubmitting=!1;i.submitForm=function(){i.isSubmitting=!0;t.acceptTerms().then(function(t){t.Success?n.location.reload():i.isSubmitting=!1})}}]);angular.module("CCG.Shared").factory("accountService",["webServiceFactory",function(n){return n.create({refreshUser:function(){return this.get("resources/services/user/")},changePassword:function(n,t){return this.post("account/edit/change-password/",{oldPassword:n,password:t})},saveCommunicationPreferences:function(n){return this.post("account/communication-preferences/",n)},saveANADate:function(n){return this.post("/account/membership/ana/",{date:n.toDateString()})},getVATInfo:function(){return this.get("/account/edit/data/vat/")},saveVATInfo:function(n,t,i,r){return this.post("/account/edit/data/vat/",{countryID:n,vatNumber:t,accountName:i,requestSource:r})},getShippingAddress:function(){return this.get("/account/shipping-address")},submitCSGSweepstakes:function(n,t,i,r){return this.post("submit/csg-sweepstakes",{firstName:n,lastName:t,email:i,isAltPage:r})},acceptTerms:function(){return this.post("/account/terms/accept/")},saveAccount:function(n){return this.post("/account/edit/",n)},saveShippingAddress:function(n){return this.post("/account/edit/shipping/",n)}})}]);angular.module("CCG.Shared").controller("anaMembershipController",["accountService","anaMembershipDateLimits",function(n,t){var i=this;i.submitting=!1;i.minDate=t.min;i.maxDate=t.max;i.dateIsInvalid=!1;i.submitForm=function(){i.submitting=!0;n.saveANADate(i.date).then(function(n){n?window.location="/account/membership/":(i.dateIsInvalid=!0,i.submitting=!1)})}}]);angular.module("CCG.Shared").controller("changePasswordController",["$scope","$window","accountService","urlService",function(n,t,i,r){var u=this;u.HasInvalidPassword=!1;u.HasUnknownError=!1;u.changePassword=function(){n.form.$submitting=!0;var t=i.changePassword(u.OldPassword,u.Password).then(function(n){n.Success?u.ShowPasswordSuccess=n.Success:(u.HasInvalidPassword=n.HasInvalidPassword,u.HasUnknownError=n.HasUnknownError)});t["finally"](function(){n.form.$submitting=!1})};u.goToAccount=function(){t.location=r.root+"account/"}}]);angular.module("CCG.Shared").controller("communicationPreferencesController",["$scope","$element","$window","accountService",function(n,t,i,r){var u=this;u.save=function(f){if(!n.form.$invalid){n.form.$submitting=!0;u.hasError=!1;var e=_.map(t.find(":checkbox:checked[name=SelectedEmail]").not("[disabled]"),function(n){return parseInt($(n).val())});r.saveCommunicationPreferences({SelectedNewsletters:e,LanguageID:t.find("[name=Language]").val(),AcceptDataConsent:!u.unsubscribed&&(e.length>0||u.acceptPrivateMessages||u.acceptTextMessages),AcceptPrivateMessages:u.acceptPrivateMessages,AcceptTextMessages:u.acceptTextMessages,TextMessagePhone:u.textMessagePhone,MasterOptOut:u.unsubscribed===!0}).then(function(n){n.Success?f?i.location.href=f:(u.showSaveSuccess=!0,u.unsubscribed&&t.find(":checkbox:checked").not(".unsubscribe").prop("checked",!1)):u.hasError=!0}).finally(function(){n.form.$submitting=!1})}};u.closeModal=function(){u.showSaveSuccess=!1}}]);angular.module("CCG.Shared").controller("confirmResetPasswordController",["$window","urlService",function(n,t){var i=this;i.confirmResetPassword=function(r){i.submitting=!0;n.location="/token-service.axd/validate/?token="+r+"&redirect="+t.root+"link-expired/"}}]);angular.module("CCG.Shared").controller("editAccountController",["$scope","$window","accountService",function(n,t,i){var r=this;r.save=function(){n.form.$invalid||(n.form.$submitting=!0,i.saveAccount({FirstName:r.FirstName,LastName:r.LastName,PublicName:r.PublicName,CollectingInterest:r.CollectingInterest}).then(function(n){n.Success&&(t.location.href="/account/")}).finally(function(){n.form.$submitting=!1}))}}]);angular.module("CCG.Shared").controller("editShippingController",["$scope","$window","$timeout","accountService",function(n,t,i,r){angular.extend(n,t.bootstrap);var u=this;u.AcceptTerms=!0;i(function(){u.AcceptTerms=!1},150);u.save=function(){n.form.$invalid||(n.form.$submitting=!0,r.saveShippingAddress({CountryID:n.form.CountryID.$modelValue,Address1:n.form.Address1.$modelValue,Address2:n.form.Address2.$modelValue,City:n.form.City.$modelValue,StateID:n.form.StateID.$modelValue,ZipCode:n.form.ZipCode.$modelValue,PhoneNumber:n.form.PhoneNumber.$modelValue}).then(function(n){n.Success&&(t.location.href="/account/")}).finally(function(){n.form.$submitting=!1}))}}]);angular.module("CCG.Shared").controller("packageTrackingController",["submissionTrackingService",function(n){var t=this;t.showResult=!1;t.notes="";n.getPackageDeliveryNotes().then(function(n){t.notes=n});t.trackPackage=function(){n.trackPackage(t.trackingNumber.replace("+"," ")).then(function(n){t.packageReceived=n;t.showResult=!0})}}]);angular.module("CCG.Shared").controller("submissionDetail",["$attrs","$element","$rootScope","$scope","submissionDetailColumns","submissionTrackingService","uiGridConstants","$window",function(n,t,i,r,u,f,e,o){function l(){return function(n,t){return s.gradeSorting.indexOf(t)-s.gradeSorting.indexOf(n)}}var s=this,c=new URI,h=c.segment(-2);n.gradingCompany=="CRD"&&(u.find(function(n){return n.field=="DisplayGrade"}).sortingAlgorithm=l());s.showError=!1;s.showGraderNotesModal=!1;s.isDesktop=$(window).width()>=900;s.gradingCompany=n.gradingCompany;s.gridOptions={minRowsToShow:10,excessRows:50,enablePagination:!1,enablePaginationControls:!1,enableColumnMenus:!1,enableGridMenu:!1,enableHorizontalScrollbar:e.scrollbars.NEVER,enableVerticalScrollbar:e.scrollbars.NEVER,columnDefs:u};t.on("click",".js-grader-notes",function(n){var t=$(n.target).attr("line-number");r.$apply(function(){s.selectedComic=_.find(s.gridOptions.data,["LineNumber",t]);s.showGraderNotesModal=!0})});t.on("click",".js-add-coin, .js-add-collectible",function(n){var r=$(n.target).attr("line-number"),t;s.selectedItem=_.find(s.gridOptions.data,["LineNumber",r]);t=s.gradingCompany==="NGC"?"addCoin.openLookup":"addCollectible.openLookup";i.$broadcast(t,{grader:s.gradingCompany,certNumber:s.selectedItem.CertNumber})});s.isLoading=!0;f.getInvoice(h).then(function(n){if(["Received","Received at CCS"].includes(n.Status)){s.showError=!0;s.errorMessage="ReceivedInvoice";return}s.invoice=n;s.gridOptions.data=n.Items;s.gradingCompany==="NGC"&&s.invoice.AllowGradeView&&f.invoiceHasImages(h).then(function(n){s.hasImages=n})}).catch(function(n){s.showError=!0;switch(n.status){case 404:s.errorMessage="InvalidInvoice";break;case 400:s.errorMessage="ProIVDown";break;default:s.errorMessage="UnknownError"}}).finally(function(){s.isLoading=!1});s.downloadInvoiceDetail=function(n){o.location.href="/account/my-submissions/download/invoice/"+n+"/"};s.$onInit=function(){$(window).on("resize",function(){s.isDesktop=$(window).width()>=900})};s.gradeSorting=["Perfect 10","Pristine 10","Gem Mint 10","Mint+ 9.5","9.5","9","8.5","8","7.5","7","6.5","6","5.5","5","4.5","4","3.5","3","2.5","2","1.5","1",""]}]);angular.module("CCG.Shared").controller("submissionTracking",["$scope","$timeout","$window","submissionTrackingService","submissionTrackingColumns","uiGridConstants","urlService",function(n,t,i,r,u,f,e){var o=this,s,h;o.isDesktop=$(window).width()>=1e3;o.gridOptions={minRowsToShow:10,excessRows:500,paginationPageSize:50,enableColumnMenus:!1,enableGridMenu:!1,enableHorizontalScrollbar:f.scrollbars.NEVER,enableVerticalScrollbar:f.scrollbars.NEVER,useExternalPagination:!0,columnDefs:u,onRegisterApi:function(t){o.gridApi=t;t.pagination.on.paginationChanged(n,function(n){o.loadInvoices(n)})}};o.totalCount=0;s=(new URI).search(!0);h=parseInt(s.page)||1;o.$onInit=function(){s.orderNumber?(o.searchSubmissionNumber=s.orderNumber,o.loadInvoices(h,s.orderNumber)):o.loadInvoices(h);$(window).on("resize",function(){o.isDesktop=$(window).width()>=1e3;o.refreshPage(h)})};o.refreshPage=function(n){var i=o.gridOptions.paginationPageSize,t=Math.ceil(o.totalCount/i);o.currentPageData={Items:o.gridOptions.data,TotalCount:o.totalCount,Page:n,PageCount:t,PageSize:i,ShowPreviousPage:n>1,ShowNextPage:n<t,OutOfRange:n<1||n>t};e.replaceUrl(e.baseUrl+"?page="+n)};o.search=function(){var t=["cgccomics","cgccards","csgcards"].filter(function(n){return e.sharedCookieDomain.indexOf(n)>-1}).length>0,n;!o.searchSubmissionNumber||/^[A-Za-z]/.test(o.searchSubmissionNumber)&&t?o.loadInvoices(1,o.searchSubmissionNumber):(n="/account/my-submissions/tracking/",i.location.href=n+o.searchSubmissionNumber+"/")};o.resetSearch=function(){o.searchSubmissionNumber="";o.search()};o.downloadInvoices=function(){o.showDownloadForm=!1;i.location.href="/account/my-submissions/download/invoice/"};o.disablePagination=function(){o.showAllLoading=!0;t(function(){o.gridOptions.enablePagination=!1;o.gridOptions.enablePaginationControls=!1;o.gridApi.grid.refresh()},50)};o.loadInvoices=function(n,t){o.isLoading=!0;r.fetchInvoices(n,t).then(function(i){o.isFromSearch=!!t;var r=i!==null?i.Invoices:[];r.forEach(function(n){n.ReceivedDate=new Date(n.ReceivedDate);n.ShippedDate&&(n.ShippedDate=new Date(n.ShippedDate))});o.gridOptions.enablePagination=i.Pagination.TotalPages>1;o.gridOptions.enablePaginationControls=o.gridOptions.enablePagination;o.gridOptions.data=r;o.gridOptions.totalItems=i.Pagination.TotalResults;o.totalCount=i.Pagination.TotalResults;o.hasInvoices=o.totalCount>0;o.isDesktop||o.refreshPage(n)}).catch(function(n){o.hasInvoices=!1;n.status===400&&(o.isERPDown=!0)}).finally(function(){o.isLoading=!1})}}]);angular.module("CCG.Shared").factory("submissionTrackingService",["webServiceFactory",function(n){return n.create({fetchInvoices:function(n,t){var i=!t?"/account/my-submissions/api/invoice/":"/account/my-submissions/api/submission/"+t+"/";return this.get(i,{page:n,submissionNumber:t})},getInvoice:function(n){return this.get("/account/my-submissions/api/invoice/"+n+"/")},invoiceHasImages:function(n){return this.get("/account/my-submissions/api/invoice/"+n+"/images/")},trackPackage:function(n){return this.get("/account/my-submissions/api/package-tracking/"+n+"/")},getPackageDeliveryNotes:function(){return this.get("/account/my-submissions/api/package-delivery-notes/")}})}]);angular.module("CCG.Shared").controller("vatController",["$scope","accountService","countryStateService","$timeout",function(n,t,i,r){var u=this;u.vatInfoRequired=!1;u.saveFailed=!1;u.toggleNoVATNumber=function(){r(function(){u.noVATNumber&&(u.accountName="",u.countryID="",u.vatNumber="")},100)};u.save=function(){n.form.$submitting=!0;u.saveFailed=!1;var i=(new URI).search(!0),r=i.src||"";t.saveVATInfo(u.countryID,u.vatNumber,u.accountName,r).then(function(t){t.success?window.location=t.destinationUrl:u.saveFailed=!0;n.form.$submitting=!1})};i.fetchCountries().then(function(n){u.countries=n});t.getVATInfo().then(function(n){n?(u.vatInfoRequired=!1,u.accountName=n.AccountName,u.countryID=n.VATCountryID,u.vatNumber=n.VATNumber,u.noVATNumber=!n.VATNumber):u.vatInfoRequired=!0})}]);angular.module("CCG.Shared").controller("updateCreditCardController",["$filter","$q","$window","updateCreditCardService","countryStateService","accountService",function(n,t,i,r,u,f){function s(){return _(e.openInvoices).filter("selected").map("OrderNumber").value()}function o(){return _(e.openInvoices).filter("selected").map("InvoiceNumber").value()}function h(){return{Name:e.name,Address1:e.address1,Address2:e.address2,City:e.city,State:e.state,PostalCode:e.postalCode,CountryID:e.countryID,Email:e.email,Phone:e.phone}}function c(n,t){e.country=_.find(e.countries,{CountryID:e.countryID});return _.map(o(),function(i){return{InvoiceNumber:i,CardType:t,CardholderName:e.cardholderName,CardToken:n,CardExpiration:e.cardExpirationMonth+"/"+e.cardExpirationYear,Address1:e.address1,Address2:e.address2,City:e.city,State:e.state,PostalCode:e.postalCode,CountryName:e.country.Name,FirstName:e.firstName,LastName:e.lastName}})}var e=this;e.isLoading=!0;e.sameShippingAddress=!0;e.headers=[{display:"Date",column:"InvoiceDate",sortOrder:1,className:"date",customSort:function(n){return Date.parse(n.InvoiceDate)||0}},{display:"Submission #",column:"OrderNumber",sortOrder:2,className:"order-number"},{display:"Invoice #",column:"InvoiceNumber",sortOrder:3,className:"invoice-number"},{display:"Service",column:"Service",sortOrder:4,className:"service"},{display:"# Items",column:"TotalItems",sortOrder:5,className:"total-items",customSort:function(n){return parseInt(n.TotalItems)||0}},{display:"Total Due",column:"UnpaidTotal",sortOrder:6,className:"invoice-total",customSort:function(n){return parseFloat((n.UnpaidTotal||"").toString().replace("$","")||0)}},{display:"Credit Card",column:"PaymentMethod",sortOrder:7,className:"credit-card",showWarning:function(n){return n.PaymentMethod==="NO CARD ON FILE"||n.ChargeAttempted==="YES"}},];e.invoiceNumber=(new URI).query(!0).invoice;t.all([r.fetchOpenInvoices(),f.getShippingAddress(),u.fetchCountries()]).then(function(t){e.openInvoices=t[0];e.shippingAddress=t[1];e.countries=t[2];e.name=t[1].Name;e.firstName=t[1].FirstName;e.lastName=t[1].LastName;e.address1=t[1].Address1;e.address2=t[1].Address2;e.city=t[1].City;e.state=t[1].State;e.postalCode=t[1].PostalCode;e.email=t[1].Email;e.phone=t[1].Phone;e.countryID=t[1].CountryID;e.openInvoices.forEach(function(t){t.UnpaidTotal=n("currency")(t.UnpaidTotal)});var i=_.filter(e.openInvoices,function(n){return n.InvoiceNumber===e.invoiceNumber});return!!e.invoiceNumber&&_.isEmpty(i)&&(e.showMissingInvoiceModal=!0),e.countryID?u.fetchStatesForCountryByID(e.countryID):null}).then(function(n){if(n)if(e.states=n,e.state){var t=_.find(e.states,{Abbreviation:e.state});e.state=t&&t.Abbreviation}else e.state=null}).catch(function(n){console.log(n)}).finally(function(){e.isLoading=!1});e.startSelected=function(n){return n.InvoiceNumber===e.invoiceNumber};e.additionalSorting=function(){return[{sortMethod:function(n){return!!n.selected},sortOrder:"desc"}]};e.countryChanged=function(){e.country=_.find(e.countries,{CountryID:e.countryID});u.fetchStatesForCountryByID(e.countryID).then(function(n){if(e.states=n,e.state){var t=_.find(e.states,{Abbreviation:e.state});e.state=t&&t.Abbreviation}else e.state=null}).catch(function(){console.log("There was an error fetching states.")})};e.areOrdersSelected=function(){return _.some(e.openInvoices,function(n){return n.selected})};e.preventCheckout=function(){return!e.areOrdersSelected()};e.submit=function(){e.isLoading=!0;e.declined=!1;var n=_.first(s()),t=e.cardNumber.slice(e.cardNumber.length-4),u={cardholder_name:e.cardholderName,cc_number:e.cardNumber.replace(/\s+/g,""),cc_expiry:e.cardExpirationMonth+e.cardExpirationYear,cc_verification_str2:e.cardCVV},f=c(),l=h();r.updatePaymentToken(n,u,f,l).then(function(n){n.Success?(r.setUpdatedInvoices({creditCard:t,invoices:o()}),i.location="/account/my-submissions/update-payment/success/"):(e.orderErrorMessage=n.ErrorMessage||"Your order cannot be submitted at this time. Please try again later.",e.isLoading=!1)}).catch(function(n){console.log(n);e.orderErrorMessage="There was an issue processing your credit card. Please try again later.";e.isLoading=!1})}}]);angular.module("CCG.Shared").controller("updateCreditCardSuccessController",["updateCreditCardService",function(n){var t=this;t.updatedInvoices=n.getUpdatedInvoices();t.hasInvoices=!_.isEmpty(t.updatedInvoices.invoices)}]);angular.module("CCG.Shared").controller("certLookupOverrideAdminController",["certLookupOverrideAdminService",function(n){var t=this;t.overrideGrade="";t.connectionError=!1;t.invalidCert=!1;t.lookupSuccess=!1;t.loading=!1;t.searchCertNumber=function(){t.connectionError=!1;t.invalidCert=!1;t.lookupSuccess=!1;t.loading=!0;n.lookupCollectibleByCertNum(t.certNumber).then(function(n){var i=n.LookupStatus;i=="ConnectionError"?t.connectionError=!0:i=="InvalidID"||i=="InvalidLookup"?t.invalidCert=!0:i=="Success"&&(t.collectible=n.Collectible,t.overrideGrade=t.collectible.IsGradeOverridden?t.collectible.NoGradeCode:"",t.lookupSuccess=!0)}).finally(function(){t.loading=!1})};t.save=function(){t.loading=!0;n.saveGradeOverride(t.collectible.CertNumber,t.collectible.CollectibleType,t.overrideGrade).then(function(n){n.Success?t.successMessage="The grade override has been saved successfully.":t.errorMessage="Error saving the grade override"}).finally(function(){t.loading=!1})};t.downloadFile=function(){n.downloadFile()}}]);angular.module("CCG.Shared").factory("certLookupOverrideAdminService",["webServiceFactory","$window",function(n,t){return n.create({certLookupOverrideApiBase:function(){return"/admin/cert-lookup-override/api"},lookupCollectibleByCertNum:function(n){return this.get(this.certLookupOverrideApiBase()+"/collectible/"+n+"/")},saveGradeOverride:function(n,t,i){return this.post(this.certLookupOverrideApiBase()+"/collectible/"+n+"/update/",{CollectibleTypeCode:t,OverrideGrade:i})},downloadFile:function(){t.location.href=this.certLookupOverrideApiBase()+"/download/"}})}]);angular.module("CCG.Shared").controller("dealerPortalArticlesController",["$scope","dealerPortalArticlesService",function(n,t){var i=this,r=(new URI).domain(),u=r.indexOf("ngccoin")>=0,f=r.indexOf("pmgnotes")>=0,e=r.indexOf("cgccomics")>=0,o=r.indexOf("csgcards")>=0,s=r.indexOf("cgccards")>=0;i.dataLoaded=!1;t.getPageData().then(function(t){var r=t.Form;u?r=_.pick(r,["NGCArticle1","NGCArticle2","NGCArticle3"]):e?r=_.pick(r,["CGCArticle1","CGCArticle2","CGCArticle3"]):o?r=_.pick(r,["CSGArticle1","CSGArticle2","CSGArticle3"]):f?r=_.pick(r,["PMGArticle1","PMGArticle2","PMGArticle3"]):s&&(r=_.pick(r,["CRDArticle1","CRDArticle2","CRDArticle3"]));i.dataLoaded=!0;i.articles=t.Articles;n.form=r});i.submitForm=function(){i.saveFormSuccessMessage=null;i.saveFormErrorMessage=null;i.showDuplicateArticlesError=!1;var r=_.chain(n.form).toPairs().map(function(n){return{key:n[0],articleID:n[1]}}).groupBy(function(n){return i.collectionName(n.key)}).mapValues(function(n){return _.chain(n).map("articleID").compact().value()}).value(),u=_.chain(r).values().some(function(n){return _.uniq(n).length!==n.length}).value();if(u){i.showDuplicateArticlesError=!0;return}t.saveArticleForm(n.form).then(function(n){n.Success?i.saveFormSuccessMessage="Articles Saved":n.DuplicateArticles?i.showDuplicateArticlesError=!0:i.saveFormErrorMessage="Error saving articles."})};i.displayProperty=function(n){var t=n.replace("Article"," ").split(" ");return"Article "+t[1]};i.collectionName=function(n){return n.replace(/[0-9]/g,"")+"s"}}]);angular.module("CCG.Shared").factory("dealerPortalArticlesService",["webServiceFactory",function(n){return n.create({getPageData:function(){return this.get("/admin/dealer-portal-articles/data/")},saveArticleForm:function(n){return this.post("/admin/dealer-portal-articles/data/save-form/",n)}})}]);angular.module("CCG.Shared").controller("createDealerAdminController",["$scope","dealerAdminService","$window",function(n,t){var i=this;i.errorMessage=null;i.createDealer=function(){if(!n.form.$invalid){if(!i.selectNGC&&!i.selectPMG&&!i.selectCGC){i.errorMessage="Please select at least one company.";return}i.companies=[];i.selectNGC&&i.companies.push("NGC");i.selectPMG&&i.companies.push("PMG");i.selectCGC&&i.companies.push("CGC");n.form.$submitting=!0;t.createDealer(i.dealerNumber,i.companies).then(function(t){t.Success&&(i.successMessage="Dealer created/updated successfully.");i.errorMessage=t.ErrorMessage;n.form.$submitting=!1})}}}]);angular.module("CCG.Shared").factory("dealerAdminService",["webServiceFactory",function(n){return n.create({createDealer:function(n,t){return this.post("/admin/dealers/create/",{dealerNumber:n,companies:t})}})}]);angular.module("CCG.Shared").controller("employeeSubmissionsController",["$filter",function(n){var t=this;t.StartDate=new Date(moment(moment().year()+"-01-01"));t.EndDate=new Date(moment());t.changeDate=function(){(!t.EndDate||t.EndDate<t.StartDate)&&(t.EndDate=new Date(t.StartDate.getTime()))};t.disableSubmit=function(){return!t.StartDate||!t.EndDate||t.EndDate<t.StartDate};t.downloadEmployeeSubmissions=function(){var i=n("date")(t.StartDate,"yyyy-MM-dd"),r=n("date")(t.EndDate,"yyyy-MM-dd");return"/admin/employee/submissions/download/?startDate="+i+"&endDate="+r}}]);angular.module("CCG.Shared").controller("eventsAdminController",["$filter","eventsAdminService","sessionService","urlService",function(n,t,i,r){var u=this,f;u.FILTER_KEY="events-filter";f=i.get(u.FILTER_KEY);u.search={SiteCompanyID:f?f.SiteCompanyID:null,Domain:f?f.Domain:null,Visibility:null,ShowPastEvents:!1,Month:null};u.newEvent={};u.addNewEvent=function(){u.newEvent.StartDateStr=n("date")(u.newEvent.StartDate,"yyyy-MM-dd");u.newEvent.EndDateStr=n("date")(u.newEvent.EndDate,"yyyy-MM-dd");t.addEvent(u.newEvent).then(function(n){n&&(window.location="/admin/events/edit/"+n)})};u.changeStartDate=function(){(!u.newEvent.EndDate||u.newEvent.EndDate<u.newEvent.StartDate)&&(u.newEvent.EndDate=new Date(u.newEvent.StartDate.getTime()))};u.getEvents=function(n,f){i.set(u.FILTER_KEY,u.search);u.search.Page=n;t.getEvents(u.search).then(function(t){u.search=t.Form;u.events=t.Events;u.allEventSites=t.AllEventSites;r.replaceUrl(r.baseUrl+"?page="+n);f&&(u.months=t.Months)})};u.getEvents(1,!0)}]);angular.module("CCG.Shared").controller("eventsAdminEditController",["$filter","eventsAdminService","countryStateService",function(n,t,i){var r=this;r.editEvent={};r.selectedSiteStr="";r.deleteImage=!1;i.fetchCountries().then(function(n){_.remove(n,{CountryCode:"HK"});r.countries=n});r.getEventDetails=function(n){r.editEvent.EventID=n;t.getEventDetails(n).then(function(n){r.editEvent=n.event;r.editEvent.StartDate=new Date(r.editEvent.StartDate);r.editEvent.EndDate=new Date(r.editEvent.EndDate);r.changeCountry(!0);var t={};n.siteIDs.forEach(function(n){t[n]=!0});Object.keys(r.selectedSites).forEach(function(n){var i=r.selectedSites[n];Object.keys(i).forEach(function(n){t[n]&&(i[n]=!0,r.selectedSiteStr+=n+",")})});n.tagIDs.forEach(function(n){r.tags[n]=!0})})};r.changeCountry=function(n){n||(r.editEvent.StateID=null);i.fetchStatesForCountryByID(r.editEvent.CountryID).then(function(n){r.states=n})};r.siteSelected=function(n,t){var i=t+",";r.selectedSites[n][t]?r.selectedSiteStr+=i:r.selectedSiteStr=r.selectedSiteStr.replace(i,"")};r.changeAllCompanySites=function(n){if(r.selectedSites[n]){var t=r.selectedSites[n];Object.keys(t).forEach(function(i){t[i]=r["selectAll"+n];r.selectedSiteStr+=i+","})}};r.changeStartDate=function(){r.editEvent.StartDate&&(!r.editEvent.EndDate||r.editEvent.EndDate<r.editEvent.StartDate)&&(r.editEvent.EndDate=new Date(r.editEvent.StartDate.getTime()))};r.saveEvent=function(){var i=r.editEvent;i.SiteIDs=[];i.TagIDs=[];Object.keys(r.selectedSites).forEach(function(n){var t=r.selectedSites[n];Object.keys(t).forEach(function(n){t[n]&&i.SiteIDs.push(n)})});Object.keys(r.tags).forEach(function(n){r.tags[n]&&i.TagIDs.push(n)});i.StartDateStr=n("date")(i.StartDate,"yyyy-MM-dd");i.EndDateStr=n("date")(i.EndDate,"yyyy-MM-dd");t.saveEvent(i,r.newImage,r.deleteImage).then(function(n){n?r.successMessage="All changes saved.":r.errorMessage="Error saving event."})};r.clearImage=function(){r.deleteImage=!0};r.deleteEvent=function(){t.deleteEvent(r.editEvent.EventID).then(function(){window.location="/admin/events/"})}}]);angular.module("CCG.Shared").factory("eventsAdminService",["webServiceFactory","Upload",function(n,t){return n.create({getEvents:function(n){var t="/admin/events/data/events/sites/"+n.SiteCompanyID+"/";return t+="?"+URI.buildQuery({domain:n.Domain,month:n.Month,visibility:n.Visibility,showPastEvents:n.ShowPastEvents,page:n.Page}),this.get(t)},addEvent:function(n){return this.post("/admin/events/data/events/",n)},getEventDetails:function(n){return this.get("/admin/events/data/events/"+n+"/")},saveEvent:function(n,i,r){var u="/admin/events/data/events/"+n.EventID+"/",f=_.merge({newImage:i,deleteImage:r},n);return t.upload({method:"PUT",url:u,data:_.omitBy(f,_.isNull)})},deleteEvent:function(n){return this.post("/admin/events/data/events/"+n+"/delete/")}})}]);angular.module("CCG.Shared").controller("helpCenterAdminCategoryDetailController",["$scope","helpCenterAdminService","dndBulkMoveService",function(n,t,i){function f(n){r.subcategories.splice(n,1);for(var t=0;t<r.subcategories.length;t++)r.currentIndexes[t]=t;r.save()}var r=this,u=new URI;r.siteID=parseInt(u.segment(-4));r.categoryID=parseInt(u.segment(-2));r.currentIndexes={};t.fetchSubcategoriesForCategory(r.categoryID).then(function(n){r.subcategories=n;for(var t=0;t<r.subcategories.length;t++)r.currentIndexes[t]=t});r.save=function(){var n=_.map(r.subcategories,"Id");t.saveSubcategoryList(r.categoryID,n).then(r.deselectAll)};r.changeSortOrder=function(n){var t=r.currentIndexes[n],u=r.subcategories[n],i=n;i!==t&&(i>t?i++:i<t&&t++,r.subcategories.splice(t,0,u),f(i))};r.createSubcategory=function(){var i={name:r.subcategoryName};t.createSubcategory(r.categoryID,i).then(function(t){r.subcategories.push(t);r.currentIndexes[r.subcategories.length-1]=r.subcategories.length-1;r.subcategoryName="";n.form.$setPristine();n.form.$setUntouched()})};r.deselectAll=function(){i.deselectAll(r.subcategories)};r.onDrop=function(n,u){i.onDrop(r,r.subcategories,n,u);var f=_.map(r.subcategories,"Id");return t.saveSubcategoryList(r.categoryID,f),!0};r.getSelectedItemsIncluding=function(n){return i.getSelectedItemsIncluding(r.subcategories,n)};r.onDragStart=function(n){return i.onDragStart(r,n)};r.onSelected=function(n,t){return i.onSelected(n,t)};r.onDragEnd=function(){return i.onDragEnd(r)};r.onCanceled=function(){return i.onCanceled(r.subcategories)}}]);angular.module("CCG.Shared").controller("helpCenterAdminCategoryListController",["helpCenterAdminService",function(n){var t=this,i=new URI;t.siteID=parseInt(i.segment(-2));n.fetchCategoriesForSite(t.siteID).then(function(n){t.categories=n.Categories;t.siteName=n.SiteName})}]);angular.module("CCG.Shared").controller("helpCenterAdminQuestionDetailController",["$scope","$window","helpCenterAdminService",function(n,t,i){var r=this,u=new URI;r.siteID=parseInt(u.segment(-8));r.categoryID=parseInt(u.segment(-6));r.subcategoryID=parseInt(u.segment(-4));r.questionID=parseInt(u.segment(-2));i.getQuestion(r.questionID).then(function(n){r.question=n;r.questionTitleName=r.question.Name;r.showAnchorLink=r.question.AnchorName&&r.question.IsPublished?!0:!1});r.deleteQuestion=function(){r.deleteQuestion.isSubmitting=!0;i.deleteQuestion(r.questionID).then(function(n){r.deleteQuestion.isSubmitting=!1;r.showDeleteQuestionModal=!1;n.Success?t.location.href="/admin/help-center/"+r.siteID+"/category/"+r.categoryID+"/subcategory/"+r.subcategoryID+"/":r.deleteQuestion.errorMessage="Failed to delete"}).catch(function(){r.deleteQuestion.errorMessage="Failed to delete"}).finally(function(){r.deleteQuestion.isSubmitting=!1})};r.saveQuestion=function(){r.isSubmitting=!0;i.saveQuestion(r.questionID,r.question).then(function(){r.isSubmitting=!1;r.successMessage="All changes saved";r.questionTitleName=r.question.Name;r.showAnchorLink=r.question.AnchorName&&r.question.IsPublished?!0:!1})}}]);angular.module("CCG.Shared").factory("helpCenterAdminService",["webServiceFactory",function(n){return n.create({fetchSites:function(){return this.get("/admin/help-center/data/sites/")},fetchCategoriesForSite:function(n){return this.get("/admin/help-center/data/sites/"+n+"/categories/")},fetchSubcategoriesForCategory:function(n){return this.get("/admin/help-center/data/categories/"+n+"/subcategories/")},saveSubcategoryList:function(n,t){return this.put("/admin/help-center/data/categories/"+n+"/subcategories/",t)},createSubcategory:function(n,t){return this.post("/admin/help-center/data/categories/"+n+"/subcategories/",t)},getSubcategory:function(n){return this.get("/admin/help-center/data/subcategories/"+n)},fetchQuestionsForSubcategory:function(n){return this.get("/admin/help-center/data/subcategories/"+n+"/questions/")},saveSubcategory:function(n,t){return this.put("/admin/help-center/data/subcategories/"+n+"/",t)},removeSubcategory:function(n){return this.post("/admin/help-center/data/subcategories/"+n+"/delete/")},saveQuestionList:function(n,t){return this.put("/admin/help-center/data/subcategories/"+n+"/questions/",t)},createQuestion:function(n,t){return this.post("/admin/help-center/data/subcategories/"+n+"/questions/",t)},getQuestion:function(n){return this.get("/admin/help-center/data/questions/"+n)},deleteQuestion:function(n){return this.post("/admin/help-center/data/questions/"+n+"/delete/")},saveQuestion:function(n,t){return this.put("/admin/help-center/data/questions/"+n+"/",t)}})}]);angular.module("CCG.Shared").controller("helpCenterAdminSitesController",["helpCenterAdminService",function(n){var t=this;n.fetchSites().then(function(n){t.sites=n})}]);angular.module("CCG.Shared").controller("helpCenterAdminSubcategoryDetailController",["$scope","$window","$q","helpCenterAdminService","dndBulkMoveService",function(n,t,i,r,u){function o(n){f.questions.splice(n,1);for(var t=0;t<f.questions.length;t++)f.currentIndexes[t]=t;f.save()}var f=this,e=new URI;f.siteID=parseInt(e.segment(-6));f.categoryID=parseInt(e.segment(-4));f.subcategoryID=parseInt(e.segment(-2));f.currentIndexes={};i.all([r.getSubcategory(f.subcategoryID),r.fetchQuestionsForSubcategory(f.subcategoryID),]).then(function(n){f.subcategory=n[0];f.subcategoryTitleName=f.subcategory.Name;f.questions=n[1];for(var t=0;t<f.questions.length;t++)f.currentIndexes[t]=t});f.saveSubcategory=function(){f.saveSubcategory.isSubmitting=!0;r.saveSubcategory(f.subcategoryID,f.subcategory).then(function(){f.successMessage="All changes saved";f.subcategoryTitleName=f.subcategory.Name;f.saveSubcategory.isSubmitting=!1})};f.remove=function(){f.questions.length>0?f.showRemoveErrorModal=!0:f.showRemoveConfirmationModal=!0};f.removeSubcategory=function(){f.removeSubcategory.isSubmitting=!0;r.removeSubcategory(f.subcategoryID).then(function(n){f.removeSubcategory.isSubmitting=!1;f.showRemoveConfirmationModal=!1;n.Success?t.location.href="/admin/help-center/"+f.siteID+"/category/"+f.categoryID+"/":f.removeSubcategory.errorMessage="Failed to remove"}).catch(function(){f.removeSubcategory.errorMessage="Failed to remove"}).finally(function(){f.removeSubcategory.isSubmitting=!1})};f.createQuestion=function(){f.addQuestion.isSubmitting=!0;var t={name:f.addQuestion.question,text:f.addQuestion.answer};r.createQuestion(f.subcategoryID,t).then(function(t){f.addQuestion.isSubmitting=!1;f.showAddQuestionModal=!1;f.questions.push(t);f.currentIndexes[f.questions.length-1]=f.questions.length-1;f.addQuestion.question="";f.addQuestion.answer="";n.addQuestionForm.$setPristine();n.addQuestionForm.$setUntouched()})};f.save=function(){var n=_.map(f.questions,"Id");r.saveQuestionList(f.subcategoryID,n).then(f.deselectAll)};f.changeSortOrder=function(n){var t=f.currentIndexes[n],r=f.questions[n],i=n;i!==t&&(i>t?i++:i<t&&t++,f.questions.splice(t,0,r),o(i))};f.deselectAll=function(){u.deselectAll(f.questions)};f.onDrop=function(n,t){u.onDrop(f,f.questions,n,t);var i=_.map(f.questions,"Id");return r.saveQuestionList(f.subcategoryID,i),!0};f.getSelectedItemsIncluding=function(n){return u.getSelectedItemsIncluding(f.questions,n)};f.onDragStart=function(n){return u.onDragStart(f,n)};f.onSelected=function(n,t){return u.onSelected(n,t)};f.onDragEnd=function(){return u.onDragEnd(f)};f.onCanceled=function(){return u.onCanceled(f.questions)}}]);angular.module("CCG.Shared").controller("adminImagesController",["adminImagesService",function(n){function i(){switch(t.resolution){case"HighRes":return"High Resolution";case"LowRes":return"Low Resolution";case"AllResolutions":return"All Resolutions";default:return""}}var t=this;t.invoiceNumber=null;t.getImages=function(){t.invoiceNumber&&t.invoiceNumber.length===7?(t.loading=!0,t.allowGetAllImages=!1,t.error="",n.fetchImageInfo(t.siteCompanyCode,t.invoiceNumber).then(function(n){t.loading=!1;t.results=n;t.allowGetAllImages=!!n.length;t.results.length||(t.error="Your query for "+i(t.resolution)+" images for invoice "+t.invoiceNumber+" yielded no results.")}).catch(function(){t.loading=!1;t.error="An error occured"})):t.error="Please enter a 7-digit invoice number."}}]);angular.module("CCG.Shared").factory("adminImagesService",["webServiceFactory",function(n){return n.create({fetchImageInfo:function(n,t){return this.get("/admin/images/api/info/"+n+"/"+t)}})}]);angular.module("CCG.Shared").controller("articleApprovalHistoryController",["articleApprovalHistoryList","uiGridConstants",function(n,t){var u=this,i=50,r=n.length>i;u.gridOptions={minRowsToShow:10,excessRows:500,paginationPageSize:i,enableColumnMenus:!1,enableGridMenu:!1,enableHorizontalScrollbar:t.scrollbars.NEVER,enableVerticalScrollbar:t.scrollbars.NEVER,columnDefs:[{name:"Public Name",field:"PublicName"},{name:"Email",field:"Email"},{name:"Date (UTC)",field:"DateUTC",displayName:"Date (UTC)",type:"date",cellFilter:"date: 'M/d/yy h:mm:ss a' : 'UTC'"},{name:"Status",field:"Status"},],enablePagination:r,enablePaginationControls:r,data:n}}]);angular.module("CCG.Shared").factory("popReportAdminService",["webServiceFactory","Upload",function(n,t){return n.create({popReportAdminApiBase:function(n){var t=n=="comics"||n=="magazines"||n=="pulps"||n=="lobby-cards"||n=="posters",i=n=="coins";return t?"/admin/pop-report/comics/api":i?"/admin/pop-report/coins/api":"/admin/pop-report/api"},updateCollectibleImage:function(n,i){return t.upload({method:"PUT",url:this.popReportAdminApiBase(n)+"/collectible/image/",data:{collectibleTypePrefix:n,image:i}})},updateCategoryImage:function(n,i,r){var u=this.popReportAdminApiBase(n)+"/category/image/";return t.upload({method:"PUT",url:u,data:{collectibleTypePrefix:n,categoryID:i,image:r}})},updateSubcategoryImage:function(n,i,r){return t.upload({method:"PUT",url:this.popReportAdminApiBase(n)+"/subcategory/image/",data:{collectibleTypePrefix:n,subcategoryID:i,image:r}})},deleteCollectibleImage:function(n){return this.post(this.popReportAdminApiBase(n)+"/collectible/image/delete/",{collectibleTypePrefix:n})},deleteCategoryImage:function(n,t){return console.log("collectibleTypePrefix: ",n),this.post(this.popReportAdminApiBase(n)+"/category/image/delete/",{collectibleTypePrefix:n,categoryID:t})},deleteSubcategoryImage:function(n,t){return this.post(this.popReportAdminApiBase(n)+"/subcategory/image/delete/",{collectibleTypePrefix:n,subcategoryID:t})}})}]);angular.module("CCG.Shared").controller("popReportEditCategoryController",["$q","$scope","populationReportService","popReportAdminService","seoService",function(n,t,i,r,u){var f=this,e="";f.init=function(r,o){e=r;f.categoryID=o;n.all([i.getCategory(e,f.categoryID),i.fetchSubcategories(e,f.categoryID),]).then(function(n){f.category=n[0];f.subcategories=n[1];t.imagePath=f.category.imagePath;u.setTitle(f.category.name)})};t.updateImage=function(n){return r.updateCategoryImage(e,f.categoryID,n)};t.deleteImage=function(){return r.deleteCategoryImage(e,f.categoryID)}}]);angular.module("CCG.Shared").controller("popReportEditCollectibleController",["$q","$scope","populationReportService","popReportAdminService",function(n,t,i,r){var f=this,u="";f.init=function(n,r){i.fetchAllCategories(n).then(function(i){f.categories=_.orderBy(i,"name");u=n;t.imagePath=r})};t.updateImage=function(n){return r.updateCollectibleImage(u,n)};t.deleteImage=function(){return r.deleteCollectibleImage(u)}}]);angular.module("CCG.Shared").controller("popReportEditImageController",["$scope","popReportAdminService",function(n){var t=this;t.hasImage=!0;t.save=function(){if(t.newImage.size>1e7){t.errorMessage="File size is too large.";return}n.$parent.updateImage(t.newImage).then(function(i){t.successMessage="All changes saved.";n.$parent.imagePath=i.data;t.showImageSizeWarning=!1;t.hasImage=!0;t.hasExistingImage=!0;t.newImage=null}).catch(function(){t.errorMessage="An error ocurred while saving."})};t.deleteImage=function(){n.$parent.deleteImage().then(function(){t.successMessage="Delete image processed.";t.showImageDeleteModal=!1;t.showImageSizeWarning=!1;t.hasImage=!1;t.hasExistingImage=!1;n.$parent.imagePath=null;n.apply()}).catch(function(){t.errorMessage="An error ocurred while deleting the image.";t.showImageDeleteModal=!1})};t.getImagePath=function(){return t.hasExistingImage=n.$parent.imagePath&&n.$parent.imagePath.length>0,n.$parent.imagePath};n.$on("image.errorLoading",function(){t.hasImage=!1;t.hasExistingImage=!1;n.$apply()});n.$watch("$ctrlImage.newImage",function(){t.showImageSizeWarning=t.newImage!=null&&t.newImage.size>51200;t.newImage&&(t.hasImage=!0)});t.getImagePath()}]);angular.module("CCG.Shared").controller("popReportEditSubcategoryController",["$scope","populationReportService","popReportAdminService","seoService",function(n,t,i,r){var u=this,f="";u.init=function(i,e){f=i;u.subcategoryID=e;t.getSubcategory(f,u.subcategoryID).then(function(t){u.subcategory=t;n.imagePath=u.subcategory.imagePath;r.setTitle(u.subcategory.name)})};n.updateImage=function(n){return i.updateSubcategoryImage(f,u.subcategoryID,n)};n.deleteImage=function(){return i.deleteSubcategoryImage(f,u.subcategoryID)}}]);angular.module("CCG.Shared").controller("popReportSettingsController",["popReportSettingsService",function(n){var t=this;t.working=!0;t.sitesSettings=[];n.fetchSettings().then(function(n){t.sitesSettings=n}).catch(function(){t.submitErrorMessage="An unexpected error has occurred."}).finally(function(){t.working=!1});t.toggleAll=function(){_.forEach(t.sitesSettings,function(n){_.set(n,"Disabled",!t.selectAll)})};t.save=function(){t.working=!0;n.saveSettings(t.sitesSettings).catch(function(){t.submitErrorMessage="An unexpected error has occurred."}).finally(function(){t.working=!1;t.showConfirmationModal=!1})}}]);angular.module("CCG.Shared").factory("popReportSettingsService",["webServiceFactory",function(n){return n.create({fetchSettings:function(){return this.get("/admin/pop-report/settings/data/")},saveSettings:function(n){return this.post("/admin/pop-report/settings/data/save/",n)}})}]);angular.module("CCG.Shared").service("registryAdminSorter",[function(){function i(i){return n.previousSortableItems.forEach(function(t){var r=i.find(function(i){return i[n.itemKeyID]==t[n.itemKeyID]});r!=null&&(r.name=t.name,r.subcatSubtitle=t.subcatSubtitle)}),t.setPreviousSortableItems(i),_.orderBy(i,["dirtySortOrder","SortOrder"],["asc","desc"])}var n=this,t;return n.itemKeyID=null,n.itemNameProperty="",n.previousSortableItems=[],t={setItemKeyID:function(t){n.itemKeyID=t},setItemNameProperty:function(t){n.itemNameProperty=t},setPreviousSortableItems:function(t){n.previousSortableItems=t},getNextSortOrder:function(n,t){var i=_.last(n),r=i?i.dirtySortOrder+1:0;return Math.min(r,t)},getSortedItemIDs:function(n,i){var r=t.getSortedItems(n);return _.map(r,i)},getSortedItemIDandNames:function(n,i){var r=t.getSortedItems(n);return _.map(r,function(n){return{id:n[i],name:n.name,newSortOrder:n.dirtySortOrder,originalOrder:n.SortOrder,isOrderModified:parseInt(n.dirtySortOrder)!==parseInt(n.SortOrder)}})},getSortedItemIDandNameSubtitles:function(n,i){var r=t.getSortedItems(n);return _.map(r,function(n){return{id:n[i],name:n.name,newSortOrder:n.dirtySortOrder,subtitle:n.subcatSubtitle,originalOrder:n.SortOrder,isOrderModified:parseInt(n.dirtySortOrder)!==parseInt(n.SortOrder)}})},getSortedItems:function(r){var u=t.normalizeSortableItems(r);return n.previousSortableItems.length>0?i(u):(t.setPreviousSortableItems(u),_.orderBy(u,["dirtySortOrder","SortOrder"],["asc","desc"]))},normalizeSortableItems:function(n){return _.forEach(n,t.normalizeSortableItem)},normalizeSortableItem:function(t){return t.dirtySortOrder===undefined&&(t.dirtySortOrder=t.SortOrder),t.name===undefined&&n.itemNameProperty!==undefined&&n.itemNameProperty!==""&&(t.name=t[n.itemNameProperty]),t.subcatSubtitle===undefined&&(t.subcatSubtitle=t.Subtitle),t},updateSortableItemsByIndex:function(n,i){return t.getSortedItems(_.forEach(n,function(r){return t.updateSortableItemByIndex(r,i,n)}))},updateSortableItemByIndex:function(n,t,i){return n.dirtySortOrder=_.findIndex(i,[t,n[t]]),n}}}]);angular.module("CCG.Shared").controller("registryAwardLandingAdminController",["registryAwardLandingAdminService",function(n){var t=this;t.awardsLandingInfo={};n.fetchAwardsLandingInfo().then(function(n){t.awardsLandingInfo=n});t.save=function(){n.saveAwardsLandingInfo(t.awardsLandingInfo).then(function(n){n.Success?(t.successMessage="All changes saved.",t.awardsLandingInfo.CompetitiveAwardLandingInfoID||location.reload()):t.errorMessage=n.ErrorMessage})}}]);angular.module("CCG.Shared").factory("registryAwardLandingAdminService",["webServiceFactory","urlService",function(n,t){return n.create({fetchAwardsLandingInfo:function(){return this.get("admin/registry/"+t.collectibleTypeSeo()+"/awards/landing/data/info")},saveAwardsLandingInfo:function(n){return this.post("admin/registry/"+t.collectibleTypeSeo()+"/awards/landing/data/info",n)}})}]);angular.module("CCG.Shared").controller("transferSetsAdminController",["$scope","transferSetsAdminService",function(n,t){var i=this;i.transferSets=function(){n.form.$submitting=!0;t.transferSets(i.from,i.to).then(function(t){t.Data?i.errorMessage=t.Data.ErrorMessage:i.successMessage="The registry sets were transferred successfully.";n.form.$submitting=!1})}}]);angular.module("CCG.Shared").factory("transferSetsAdminService",["webServiceFactory","urlService",function(n,t){return n.create({transferSets:function(n,i){var r="/admin/registry/",u=t.collectibleTypeSeo();return u!=""&&u!="coins"&&(r+=u+"/"),r+="api/transfer-sets/",this.post(r,{from:n,to:i})}})}]);angular.module("CCG.Shared").controller("membershipStatsController",["$window",function(n){var t=this;t.startDate=new Date(moment().utc().add(-7,"days").format(moment.HTML5_FMT.DATE));t.endDate=new Date(moment().utc().format(moment.HTML5_FMT.DATE));t.getMembershipReport=function(){var i=moment(t.startDate).format(moment.HTML5_FMT.DATE),r=moment(t.endDate).format(moment.HTML5_FMT.DATE);n.location.href="/admin/reports/api/report/membership-stats/?startDate="+i+"&endDate="+r};t.forceValidDates=function(){(!t.endDate||moment(t.endDate).isBefore(moment(t.startDate)))&&(t.endDate=new Date(moment(t.startDate).add(2,"days").format(moment.HTML5_FMT.DATE)))}}]);angular.module("CCG.Shared").controller("scoreCorrectionRequestsAdminController",["$attrs","scoreCorrectionRequestsAdminService",function(n,t){var i=this;i.collectibleTypeSeo=n.collectibleTypeSeo;i.isLoading=!0;i.showMarkAsProcessedModal=!1;i.markedRequestID=0;i.adminNotesSaved={};t.fetchRequests(i.collectibleTypeSeo).then(function(n){var t,r;if(n!=null&&n.Requests!=null&&n.Requests.length>0)for(t=0;t<n.Requests.length;t++)r=n.Requests[t].Request,r.collectibleTypeString=n.CollectibleTypeStrings[t];i.requests=n.Requests;_.each(i.requests,function(n){n.coinStr="";_.each(n.Details,function(t){t.RequestCollectibleName&&(n.coinStr+=n.coinStr?","+t.RequestCollectibleName:t.RequestCollectibleName)});n.coinStr||(n.coinStr="No Coin")});i.isLoading=!1});i.showMarkAsProcessedConfirmation=function(n){i.markedRequestID=n;i.showMarkAsProcessedModal=!0};i.markAsProcessed=function(){t.markAsProcessed(i.collectibleTypeSeo,i.markedRequestID).then(function(){_.remove(i.requests,function(n){return n.Request.ScoreCorrectionRequestID==i.markedRequestID});i.markedRequestID=0;i.showMarkAsProcessedModal=!1})};i.saveAdminNotes=function(n,r){t.saveAdminNotes(i.collectibleTypeSeo,n,r).then(function(t){_.each(i.requests,function(n){i.adminNotesSaved[n.Request.ScoreCorrectionRequestID]=!1});i.adminNotesSaved[n]=!0;t.Success?i.adminNotesSuccessMessage="Admin notes saved successfully":i.adminNotesErrorMessage="Admin notes save failed"})}}]);angular.module("CCG.Shared").factory("scoreCorrectionRequestsAdminService",["webServiceFactory",function(n){return n.create({scoreCorrectionAdminBase:function(n){return"/admin/registry/"+n+"/score-correction-requests"},fetchRequests:function(n){return this.get(this.scoreCorrectionAdminBase(n)+"/data/requests/")},markAsProcessed:function(n,t){return this.post(this.scoreCorrectionAdminBase(n)+"/mark-as-processed/",{requestID:t})},saveAdminNotes:function(n,t,i){return this.post(this.scoreCorrectionAdminBase(n)+"/admin-notes/",{requestID:t,adminNotes:i})}})}]);angular.module("CCG.Shared").controller("servicesAndFeesAdminController",["servicesAndFeesAdminService",function(n){var t=this;n.fetchSites().then(function(n){t.sites=n})}]);angular.module("CCG.Shared").factory("servicesAndFeesAdminService",["webServiceFactory","Upload",function(n,t){return n.create({fetchSites:function(){return this.get("/admin/services-and-fees/data/sites/")},fetchCategoriesForSite:function(n){return this.get("/admin/services-and-fees/data/sites/"+n+"/categories/")},getCategory:function(n){return this.get("/admin/services-and-fees/data/categories/"+n+"/")},saveCategory:function(n){return this.put("/admin/services-and-fees/data/categories/"+n.GradingServiceCategoryID+"/",n)},saveCategoryPDF:function(n,i,r){return t.upload({method:"PUT",url:"/admin/services-and-fees/data/categories/"+n+"/pdf/",data:{languageCode:i,PDF:r}}).then(function(n){return n.data})},deleteCategoryPDF:function(n,t){return this.post("/admin/services-and-fees/data/categories/"+n+"/pdf/delete/",{languageCode:t})},fetchSubcategoriesForCategory:function(n){return this.get("/admin/services-and-fees/data/categories/"+n+"/subcategories/")},saveSubcategories:function(n,t){return this.put("/admin/services-and-fees/data/categories/"+n+"/subcategories/",t)},createSubcategory:function(n,t){return this.post("/admin/services-and-fees/data/categories/"+n+"/subcategories/",{name:t})},getSubcategory:function(n){return this.get("/admin/services-and-fees/data/subcategories/"+n+"/")},saveSubcategory:function(n){return this.put("/admin/services-and-fees/data/subcategories/"+n.GradingServiceSubcategoryID+"/",n)},deleteSubcategory:function(n){return this.post("/admin/services-and-fees/data/subcategories/"+n+"/delete/")},fetchEntriesForSubcategory:function(n){return this.get("/admin/services-and-fees/data/subcategories/"+n+"/entries/")},saveEntriesForSubcategory:function(n,t){return this.put("/admin/services-and-fees/data/subcategories/"+n+"/entries/",t)},createEntryForSubcategory:function(n){return this.post("/admin/services-and-fees/data/subcategories/"+n+"/entries/")},deleteEntry:function(n){return this.post("/admin/services-and-fees/data/entries/"+n+"/delete/")}})}]);angular.module("CCG.Shared").controller("servicesAndFeesCategoryAdminController",["$window","$q","$scope","servicesAndFeesAdminService",function(n,t,i,r){var u=this,f=new URI,e=f.segment(-4);u.categoryID=parseInt(f.segment(-2));t.all([r.fetchCategoriesForSite(e),r.getCategory(u.categoryID),r.fetchSubcategoriesForCategory(u.categoryID),]).then(function(n){u.categories=n[0];u.currentCategory=n[1];u.subcategories=n[2]});u.changeCategory=function(){n.location.href="/admin/services-and-fees/"+e+"/category/"+u.categoryID+"/"};u.save=function(){r.saveCategory(u.currentCategory).then(function(n){u.successMessage="Saved";u.currentCategory=n})};u.uploadPDF=function(n,t){(n.preventDefault(),u.newPDF)&&r.saveCategoryPDF(u.categoryID,t,u.newPDF).then(function(n){n?(t==="en-US"?u.currentCategory.PDFPath=n:i.translationCtrl.updateTranslation("PDFPath",t,n),u.uploadSuccessMessage="Upload successful.",u.newPDF=null):u.uploadFailureMessage="Upload failed."}).catch(function(){u.uploadFailureMessage="An error occurred."})};u.deletePDF=function(n,t){n.preventDefault();r.deleteCategoryPDF(u.categoryID,t,u.newPDF).then(function(){t==="en-US"?u.currentCategory.PDFPath=null:i.translationCtrl.updateTranslation("PDFPath",t,null)})};u.subcatMoved=function(n){u.subcategories.splice(n,1);u.subcategories.forEach(function(n,t){n.SortOrder=t});r.saveSubcategories(u.categoryID,u.subcategories).then(function(n){u.subcategories=n})};u.createSubcategory=function(){r.createSubcategory(u.categoryID,u.newSubcategoryName).then(function(n){u.subcategories=n;u.newSubcategoryName=null;i.newSubcategoryForm.$setPristine(!0);i.newSubcategoryForm.$setUntouched(!0)})}}]);angular.module("CCG.Shared").controller("servicesAndFeesSubcategoryAdminController",["$window","$q","servicesAndFeesAdminService","translationAdminService",function(n,t,i,r){function o(n,t,i){return _.map(n,function(n){var r=_.clone(n);return _.forEach(r,function(n,f){if(_.includes(i,f)){var e={};_.forEach(u.languages,function(i){if(e[i.code]={},i.code=="en-US"){e[i.code].Value=n;return}var u=_.find(t,{EntityKey:r.LocalizationKey,Field:f,LanguageCode:i.code});u?(u.Saved=!0,e[i.code]=u):e[i.code]={LanguageCode:i.code,EntityKey:r.LocalizationKey,Field:f,Value:null}});r[f]=e}}),r})}function c(n,t){var i=_.map(n,function(n){var i=_.clone(n);return _.forEach(i,function(n,r){t.includes(r)&&(i[r]=n["en-US"].Value)}),i}),r=_.flatMap(n,function(n){var i=[];return _.forEach(n,function(n,r){t.includes(r)&&_.forEach(n,function(n,t){t!="en-US"&&(n.Saved||n.Value)&&(_.unset(n,"Saved"),i.push(n))})}),i});return{entities:i,translations:r}}var u=this,e=new URI,s=e.segment(-6),h=e.segment(-4),f;u.subcategoryID=parseInt(e.segment(-2));f=["Name","Note","Description","MaxValue","FeePerCollectible","VatExcludedFeePerCollectible","CurrentTurnaround"];t.all([i.getSubcategory(u.subcategoryID),r.fetchLanguagesForSite(s),i.fetchEntriesForSubcategory(u.subcategoryID),]).then(function(n){var t,i;u.subcategory=n[0];u.languages=n[1];u.entryLanguageCode=u.languages[0].code;t=n[2];t.length>0?(i=_.map(t,"GradingServiceEntryID"),r.fetchTranslations("CCG.Entities.Corporate.GradingServices.GradingServiceEntry",i).then(function(n){u.entries=o(t,n,f)})):u.entries=t});u.save=function(){var n=c(u.entries,f);t.all([i.saveSubcategory(u.subcategory),i.saveEntriesForSubcategory(u.subcategoryID,n.entities),r.saveTranslations("CCG.Entities.Corporate.GradingServices.GradingServiceEntry",n.translations)]).then(function(n){u.successMessage="Saved";u.subcategory=n[0];u.entries=o(n[1],n[2],f)}).catch(function(){u.errorMessage="Error"})};u.deleteSubcategory=function(){i.deleteSubcategory(u.subcategoryID).then(function(){n.location.href="/admin/services-and-fees/"+s+"/category/"+h+"/"})};u.entryMoved=function(n){u.entries.splice(n,1);u.entries.forEach(function(n,t){n.SortOrder=t})};u.showSubcategoryDeleteModal=function(){u.deleteModalType="subcategory";u.showDeleteModal=!0};u.showEntryDeleteModalFor=function(n){u.showEntryDeleteIndex=n;u.deleteModalType="entry";u.showDeleteModal=!0};u.deleteEntry=function(){var n=u.entries[u.showEntryDeleteIndex];i.deleteEntry(n.GradingServiceEntryID).then(function(){u.entries.splice(u.showEntryDeleteIndex,1);u.showDeleteModal=!1})};u.addEntry=function(){i.createEntryForSubcategory(u.subcategoryID).then(function(n){var t=_.head(o([n],[],f));u.entries.push(t)})}}]);angular.module("CCG.Shared").controller("slideEditAdminController",["$window","sliderAdminService",function(n,t){var i=this,u=new URI,r=u.segment(-4),f=u.segment(-2);i.showImageErrorMessage=!1;t.getSlide(r,f).then(function(n){i.slide=n||[]});i.save=function(n){var e,o,u,f;if(i.showImageErrorMessage=!1,(n.toLowerCase()=="podcast"||n.toLowerCase()=="mini")&&(e=(!i.newSlideImages||i.newSlideImages.length===0)&&!i.slide.ImageFileName,o=(!i.newMobileSlideImages||i.newMobileSlideImages.length===0)&&!i.slide.MobileImageFileName,e||o)){i.showImageErrorMessage=!0;return}u=[];f=[];i.newSlideImages&&Object.keys(i.newSlideImages).forEach(function(n){u.push({Language:n,Image:i.newSlideImages[n],IsMobile:!1});f.push(i.newSlideImages[n])});i.newMobileSlideImages&&Object.keys(i.newMobileSlideImages).forEach(function(n){u.push({Language:n,Image:i.newMobileSlideImages[n],IsMobile:!0});f.push(i.newMobileSlideImages[n])});t.saveSlide(r,i.slide,u,f).then(function(){i.successMessage="All changes saved."}).catch(function(){i.errorMessage="An error occurred."})};i.delete=function(){t.deleteSlide(r,i.slide.id).then(function(){n.location.href="/admin/sliders/"+r+"/"})}}]);angular.module("CCG.Shared").factory("sliderAdminService",["Upload","webServiceFactory",function(n,t){return t.create({fetchSliders:function(n){return this.get("~/admin/sliders/data/sliders/",n)},fetchVideoSliders:function(){return this.get("~/admin/videos/data/sliders/")},fetchAlternateVideoSliders:function(n){return this.get("~/admin/videos/data/"+n+"/alternate-sliders/")},getSlider:function(n){return this.get("~/admin/sliders/data/"+n+"/")},fetchSlides:function(n){return this.get("~/admin/sliders/data/"+n+"/slides/")},createSlide:function(n,t){return this.post("~/admin/sliders/data/"+n+"/slides/",t)},saveSlides:function(n,t){return this.put("~/admin/sliders/data/"+n+"/slides/",t)},getSlide:function(n,t){return this.get("~/admin/sliders/data/"+n+"/slides/"+t+"/")},saveSlide:function(t,i,r,u){var f=_.merge({slideImages:r,files:u},i);return n.upload({method:"PUT",url:"/admin/sliders/data/"+t+"/slides/"+i.id+"/",data:_.omitBy(f,_.isNull)})},deleteSlide:function(n,t){return this.post("~/admin/sliders/data/"+n+"/slides/"+t+"/delete/")}})}]);angular.module("CCG.Shared").controller("sliderEditAdminController",["$window","sliderAdminService",function(n,t){function u(){i.oldSortOrder=_.map(i.slides,function(n){return{id:n.id,oldIndex:n.SortOrder}})}var i=this,f=new URI,r=f.segment(-2);i.publishedFilter="all";t.fetchSlides(r).then(function(n){i.allSlides=n||[];i.allSlides.forEach(function(n,t){n.SortOrder=t});i.slides=i.allSlides;u()});i.slideMoved=function(n){i.slides.splice(n,1);i.slides.forEach(function(n,t){n.SortOrder=i.oldSortOrder[t].oldIndex;i.allSlides.splice(n.SortOrder,1,n)});t.saveSlides(r,i.allSlides)};i.createSlide=function(u){var f;f=i.allSlides.length>0?_.minBy(i.allSlides,"SortOrder").SortOrder-1:0;t.createSlide(r,{Title:u,SortOrder:f}).then(function(t){n.location.href="/admin/sliders/"+r+"/slide/"+t.id+"/"})};i.filterSlides=function(){i.slides=i.publishedFilter==="all"?i.allSlides:_.filter(i.allSlides,function(n){return n.Published&&i.publishedFilter==="published"||!n.Published&&i.publishedFilter==="unpublished"});u()}}]);angular.module("CCG.Shared").controller("sliderListAdminController",["$attrs","sliderAdminService",function(n,t){var i=this;t.fetchSliders({sliderType:n.sliderType||"Slider"}).then(function(n){i.sliders=n||[]})}]);angular.module("CCG.Shared").controller("videoSlideEditAdminController",["$timeout","$q","$window","$sce","sliderAdminService",function(n,t,i,r,u){var f=this,o=new URI,e=o.segment(-4),s=o.segment(-2);t.all([u.getSlide(e,s),u.fetchAlternateVideoSliders(e),u.getSlider(e)]).then(function(n){f.slide=n[0]||[];f.slide.YouTubeEmbedLink=r.trustAsResourceUrl(f.slide.YouTubeEmbedLink);f.sliderOptions=n[1];f.embedded=n[2].TLD!="cn"});f.updatePreview=function(){f.slide.YouTubeEmbedLink=f.slide.LinkUrl?r.trustAsResourceUrl("https://www.youtube.com/embed/"+f.slide.LinkUrl):null};f.save=function(){u.saveSlide(e,f.slide,f.newSlideImage).then(function(){e!=f.slide.SliderID?window.location.href="../../../"+f.slide.SliderID+"/slide/"+f.slide.id+"/":f.successMessage="All changes saved."})};f.delete=function(){u.deleteSlide(e,f.slide.id).then(function(){i.location.href="/admin/sliders/"+e+"/"})};f.deleteImage=function(){f.slide.ImageFileName=null}}]);angular.module("CCG.Shared").controller("videoSliderListAdminController",["sliderAdminService",function(n){var t=this;n.fetchVideoSliders().then(function(n){t.sliderGroups=n||[]})}]);angular.module("CCG.Shared").directive("ccgTranslationAdminForm",[function(){return{controllerAs:"translationCtrl",controller:["$attrs","translationAdminService","$q",function(n,t,i){var r=this,u;r.entityKey=parseInt(n.entityKey);r.entityType=n.entityType;u={};u=n.isRegistry?t.fetchRegistryLanguages():n.siteId?t.fetchLanguagesForSite(n.siteId):i.when(t.languages);u.then(function(n){r.languages=n;r.languageCode=_.first(r.languages).code});r.initialize=function(){t.fetchTranslations(r.entityType,r.entityKey).then(function(n){r.translations=n})};r.getTranslation=function(n,t){var i=_.find(r.translations,{Field:n,LanguageCode:t});return i?i.Value:null};r.updateTranslation=function(n,t,i){var u=_.find(r.translations,{Field:n,LanguageCode:t});u?u.Value=i:r.translations.push({Field:n,LanguageCode:t,Value:i});t===r.languageCode&&(r[n]=i)};r.changeLanguage=function(n,t){n!==t&&_.forEach(r.fieldNames,function(i){var f,u;t!=="en-US"&&(f=_.find(r.translations,{Field:i,LanguageCode:t}),f&&(f.Value=r[i]));n!=="en-US"&&(u=_.find(r.translations,{Field:i,LanguageCode:n}),u||(u={EntityKey:r.entityKey,Field:i,LanguageCode:n,Value:""},r.translations.push(u)),r[i]=u.Value)})};r.save=function(){r.languageCode!=="en-US"&&_.forEach(r.fieldNames,function(n){var t=_.find(r.translations,{Field:n,LanguageCode:r.languageCode});t.Value=r[n]});t.saveTranslations(r.entityType,r.translations)}}],compile:function(n){var i=n.find("[ccg-translation-field]"),t=[];return _.forEach(i.toArray(),function(n){var i=$(n),r=i.clone(),u=_.find(["ng-model","ng-bind","ng-href","ccg-translation-field"],function(n){return i.attr(n)!==undefined}),f=_.last(i.attr(u).split("."));t.push(f);r.attr(u,"translationCtrl."+f).attr("ng-hide","translationCtrl.languageCode === 'en-US'").removeAttr("required");i.attr("ng-hide","translationCtrl.languageCode !== 'en-US'").after(r)}),function(n,i,r,u){u.fieldNames=t;u.initialize();n.$watch("translationCtrl.languageCode",u.changeLanguage)}}}}]);angular.module("CCG.Shared").factory("translationAdminService",["webServiceFactory",function(n){return n.create({languages:[{code:"en-US",name:"English"},{code:"zh-CN",name:"Simplified Chinese"},{code:"zh-TW",name:"Traditional Chinese"},{code:"de-DE",name:"German"},{code:"en-GB",name:"UK English"},{code:"en-DE",name:"German English"},{code:"en-IN",name:"Indian English"},],fetchLanguagesForSite:function(n){return this.get("/admin/translations/languages/"+n+"/")},fetchRegistryLanguages:function(){return this.get("/admin/translations/registry-languages/")},fetchTranslations:function(n,t){return Array.isArray(t)||(t=[t]),this.get("/admin/translations/"+n+"/?entityKeys="+t.join(","))},saveTranslations:function(n,t){return this.post("/admin/translations/"+n+"/",t)}})}]);angular.module("CCG.Shared").factory("userAdminService",["webServiceFactory",function(n){return n.create({getUser:function(n){return this.get("~/admin/users/data/"+n+"/")},fetchUserAgreementsForCountry:function(n,t){return this.get("~/admin/users/data/"+n+"/"+t+"/")},fetchAgreementHistoryForUser:function(n){return this.get("~/admin/users/data/"+n+"/agreement-history/")},fetchCurrentAgreements:function(){return this.get("~/admin/users/data/current-agreements/")},fetchCountries:function(){return this.get("~/admin/users/data/countries/")},saveUser:function(n,t){return this.put("~/admin/users/data/"+n+"/",t)},saveUserAgreement:function(n,t){return this.post("~/admin/users/data/"+n+"/agreement/",{legalAgreementID:t})}})}]);angular.module("CCG.Shared").controller("userAgreementHistoryController",["$q","userAdminService",function(n,t){var i=this,r=new URI,u=r.segment(-3);n.all([t.fetchCountries(),t.fetchAgreementHistoryForUser(u),]).then(function(n){i.countries=n[0];i.agreementGroups=n[1];_.each(i.agreementGroups,function(n){n.ProIVAgreement&&(n.agreementClass=n.AgreementStatus?"icon-success":"icon-close")})})}]);angular.module("CCG.Shared").controller("userEditAdminController",["$scope","userAdminService","countryStateService","$timeout",function(n,t,i,r){function e(){return t.getUser(f).then(function(n){u.user=n;u.user.VATInfo.PeopleVATNumberID&&(!u.user.VATInfo.VATNumber||u.user.VATInfo.VATNumber=="")&&(u.noVATNumber=!0);o()})}function h(){i.fetchCountries().then(function(n){u.countries=n})}function o(){u.errorMessage="";var n=u.user.AdminRoles.filter(function(n){return n.IsInRole&&n.ParentRoleID});return n.forEach(function(n){var t=u.user.AdminRoles.find(function(t){return t.RoleID==n.ParentRoleID});t.IsInRole||(u.errorMessage+=n.DisplayName+" role requires "+t.DisplayName+" role.<br/>")}),!u.errorMessage}var u=this,s=new URI,f=s.segment(-2);u.showAddAcceptanceModal=!1;e();h();u.addAcceptance=function(i){t.fetchUserAgreementsForCountry(f,i).then(function(t){u.AddAgreementForm=t;u.AddAgreementForm.NewAgreements.forEach(function(n){n.MajorVersion<u.AddAgreementForm.LatestMajorVersion&&(n.DisplayVersion+=" (cannot submit)")});n.addAcceptanceForm.$setPristine();n.addAcceptanceForm.$setUntouched();u.showAddAcceptanceModal=!0})};u.toggleNoVATNumber=function(){r(function(){u.noVATNumber&&(u.user.VATInfo.AccountName="",u.user.VATInfo.VATCountryID="",u.user.VATInfo.VATNumber="")},100)};u.saveUser=function(){o()&&(n.form.$submitting=!0,t.saveUser(f,u.user).then(function(){u.saveUserSuccessMessage="All changes saved.";n.form.$submitting=!1}))};u.saveAgreement=function(){t.saveUserAgreement(f,u.NewLegalAgreementID).then(e).then(function(){u.showAddAcceptanceModal=!1})}}]);angular.module("CCG.Shared").animation(".ccg-animate-height",["$animateCss",function(n){function t(){return.3}return{enter:function(i){var r=$(i).height();return n(i,{event:"enter",easing:"ease-in-out",cleanupStyles:!0,duration:t(r),from:{height:0},to:{height:r}})},leave:function(i){var r=$(i).height();return n(i,{event:"leave",easing:"ease-in-out",cleanupStyles:!0,duration:t(r),from:{height:r},to:{height:0}})}}}]);angular.module("CCG.Shared").directive("certLookupSearch",["$window",function(n){return{controllerAs:"$ctrl",controller:["$scope","certLookupService",function(t,i){function u(t,i){n.location.href=i?"/certlookup/"+t+"/"+i+"/":"/certlookup/"+t+"/"}var r=this;r.lookupStatus=i.lookupStatus;r.lookup=function(n,t){r.certNumber&&r.grade&&u(n,t)};r.lookupNoGrade=function(n){r.certNumber&&u(n)}}],link:function(t,i,r,u){u.isHomepage=n.location.pathname=="/";u.certNumber=r.certNumber;u.grade=r.grade;u.isPrefilling=r.isPrefilling;u.noResults=!u.isHomepage&&u.isPrefilling;r.proIvDown?u.errorMessage=u.lookupStatus.erpDown:r.contactSupport?u.errorMessage=u.lookupStatus.contactSupport:r.rateLimited?u.errorMessage=u.lookupStatus.rateLimited:u.noResults&&(u.errorMessage=u.lookupStatus.notFound)}}}]);angular.module("CCG.Shared").factory("certLookupService",["webServiceFactory",function(n){return n.create({getDescription:function(n,t){return this.get("/certlookup/data/description/"+n+"/"+t+"/").then(function(n){return n.data||n})},lookupStatus:{success:"success",notFound:"not found",rateLimited:"rate limited",erpDown:"erp down",serverError:"server error",contactSupport:"contact support"}})}]);angular.module("CCG.Shared").directive("ccgBannerSlide",["windowWatcher","domService",function(n,t){return{scope:{fullImageUrl:"@",mobileImageUrl:"@"},controller:["$scope","$element","$timeout",function(n,i,r){var u=this;u.updateImages=function(){r(function(){var r=t.isTabletUp()?n.fullImageUrl:n.mobileImageUrl;r||(r=n.fullImageUrl);i.css("background-image","url("+r+")")})}}],link:function(t,i,r,u){n.onResize(u.updateImages);u.updateImages()}}}]);angular.module("CCG.Shared").directive("ccgBgImage",["$q","lazyLoadService",function(n,t){return{scope:!0,link:function(i,r,u){function f(n){if(!n||!u.side||i.$eval(u.side)===n){var t=i.$eval(u.ccgBgImage);e(t).then(function(n){r.toggleClass("has-image",n);r.toggleClass("no-image",!n);n?r.css("background-image","url("+t+")"):r.removeAttr("style")})}}function e(t){var i=n.defer();return t?$("<img>").on("load",function(){i.resolve(!0)}).attr("src",t):i.resolve(!1),i.promise}u.notLazy===undefined&&t.register(r,f);i.$on("ccgBgImage.refresh",f);i.$on("ccgBgImage.refresh-"+i.collectibleID,function(n,t){f(t)})}}}]);angular.module("CCG.Shared").directive("ccgTabTo",[function(){return{restrict:"A",scope:{tabToTargetId:"@ccgTabTo"},link:function(n,t){if(n.tabToTarget=$("#"+n.tabToTargetId),n.tabToTarget){n.tabToTarget.attr("tabindex",999);t.on("keydown keypress",function(t){var i=t.keyCode||t.which;i===9&&(t.preventDefault(),t.stopPropagation(),n.tabToTarget.focus())})}}}}]);angular.module("CCG.Shared").directive("ccgDragToScroll",["$window","$rootScope","$interval",function(n,t,i){return{link:function(r,u,f){function l(n){if(n.preventDefault(),c){if(s&&!h&&!y){angular.element(s).on("click",v);h=!0}e.left=e.left+(o.x-n.pageX);e.top=e.top+(o.y-n.pageY);o.x=n.pageX;o.y=n.pageY;u.scrollLeft(e.left);u.scrollTop(e.top)}}function a(){c=!1;i(function(){s&&h&&(angular.element(s).off("click",v),h=!1)},0,100);angular.element(n).off("mousemove",l);angular.element(n).off("mouseup",a);t.$broadcast("ccgDragToScroll.endScroll")}function v(n){n.preventDefault()}var s,h,c=!1,o={x:0,y:0},e={top:0,left:0},y=f.enableClick!==undefined;u.on("mousedown",function(i){i.preventDefault();c=!0;s=i.target;o.x=i.pageX;o.y=i.pageY;e.left=u.scrollLeft();e.top=u.scrollTop();angular.element(n).on("mousemove",l);angular.element(n).on("mouseup",a);t.$broadcast("ccgDragToScroll.beginScroll")})}}}]);angular.module("CCG.Shared").directive("ccgElementVisibilityEvent",["scrollService","windowWatcher",function(n,t){return{scope:{onVisible:"=",onNotVisible:"=",offset:"="},link:function(i,r){function f(){var n=t.withinViewport(r,{y:i.offset});n!==u&&(n?i.onVisible():i.onNotVisible());u=n}var u=!1;n.registerOnScroll("ccgScrollPointEvent",f);i.$on("ccgElementVisibilityEvent.check",f)}}}]);angular.module("CCG.Shared").directive("ccgFilterInput",["urlService",function(n){return{require:"ngModel",link:function(t,i,r,u){function e(t){switch(t){case"english":return/[\u0000-\u0080]+/;case"float":return/-?[1-9]\d*(\.\d+)?|-?0?\.\d+|0/;case"int":return/-?[1-9]\d*|0/;case"numbers":return/\d+/;case"creditcard":return/[\d\s]+/;case"price":switch(n.tld.toLowerCase()){case"de":return/\d+,?\d?\d?/;default:return/\d+\.?\d?\d?/}default:return new RegExp(t)}}var f=function(n){if(!r.ccgFilterInput)return n;var i=e(r.ccgFilterInput),t=n&&i?(n.match(i)||[""])[0]:n;return n!==t&&(u.$setViewValue(t),u.$render()),t};r.ccgFilterInput&&(u.$parsers.unshift(f),f(t[r.ngModel]))}}}]);angular.module("CCG.Shared").directive("ccgFocus",function(){var n;return{scope:{ccgFocusDisabled:"="},link:function(t,i){n&&clearTimeout(n);n=setTimeout(function(){t.ccgFocusDisabled||i.focus()},0)}}});angular.module("CCG.Shared").directive("ccgFormatInput",["$filter","$window","$timeout",function(n,t,i){function r(n){var r=t.navigator.userAgent,u;r.indexOf("Android")!=-1&&((u=(new RegExp(/AppleWebKit\/([\d+.]+)/).exec(r)||[])[1],u>=538)||i(function(){var i=n[0],r=n.val().length;i.contentEditable==="true"?(i.focus(),t.getSelection().collapse(i.firstChild,r)):i.setSelectionRange(r,r)},0))}return{require:"ngModel",link:function(t,i,u,f){var e=function(t){var o,h,s,e;return u.ccgFormatInput?(o=[t],u.ccgFormatInputArgs&&(h=(u.ccgFormatInputArgs||"").split(","),h.forEach(function(n){o.push(n.trim())})),s=n(u.ccgFormatInput),e=s?s.apply(this,o):t,t!==e&&(f.$setViewValue(e),f.$render(),r(i)),e):t};u.ccgFormatInput&&(f.$parsers.unshift(e),e(t[u.ngModel]))}}}]);angular.module("CCG.Shared").directive("ccgGridStickyHeader",["$compile","domService","scrollService",function(n,t,i){return{link:function(r,u,f){function v(){rt();l&&(nt(),y())}function g(n){c[0]&&c[0].rows.length===1||(l=n!==undefined?n:!l,l?(rt(),nt(),y()):tt())}function y(){var n=parseInt((s.css("margin-left")||"").replace("px","")||0)||parseInt((s.css("padding-left")||"").replace("px","")||0);o=p.width()+n;t.isSmall()||t.isXSmall()||isNaN(f.additionalOffset)||(o+=parseFloat(f.additionalOffset));e[0]&&(o=e[0].scrollLeft-o);ut&&(o=o-s.offset().left);d.offset({left:-o})}function nt(){a.appendTo(f.appendTo);b.append(k).append(w).appendTo(a);e.on("scroll",y);$(window).on("resize",v);e.trigger("scroll");i.registerOffsetElement(u)}function tt(){a.remove();a.html("");b.html("");e&&e.off("scroll",y);$(window).off("resize",v);i.deregisterOffsetElement(u)}function it(t,i,u){var o,h;o=f.isDetails==="true"&&f.gridKey==="details"?$(t.find("tr").slice(0,3)):t.find("tr.header-row");var c=o.find("th").map(function(){return this.getBoundingClientRect().width}),s=o.clone(),e=$("<div>").addClass("pinned-header-wrap").addClass(i);return s.length===0&&e.addClass("empty"),$("<table>").append(s).appendTo(e),s.find("th").each(function(n){$(this).css(f.isDetails==="true"?"width":"min-width",c[n])}),u&&(h=$("<div ccg-loading-overlay><\/div>"),e.append(n(h)(r))),e}function rt(){tt();s=$(f.container);h=s.find("."+f.mainGridClass);e=h.find(".scrollable");p=h.find(".pinned table:first-child");c=h.find(".scrollable table:first-child");k=it(p,"pinned");w=it(c,"scrollable",!0);d=w.find("table")}var st=this,s,h,e,p,c,k,w,d,l,o,a=$("<div>").addClass(f.wrapperClasses),b=$("<div>").addClass(f.mainGridClass),ut=f.hasSideBar==="true";f.gridClasses!==undefined&&b.addClass(f.gridClasses);var ft=r.$on("gridStickyHeader.show."+f.gridKey,function(){g(!0)}),et=r.$on("gridStickyHeader.hide."+f.gridKey,function(){g(!1)}),ot=r.$on("gridStickyHeader.reload."+f.gridKey,v);r.$on("$destroy",function(){ft();et();ot();i.deregisterOffsetElement(u)});v()}}}]);angular.module("CCG.Shared").directive("ngTranscludeInner",function(){return{link:function(n,t,i,r,u){function o(n,i){if(n.length&&s(n)){t.empty();t.append(n);t.on("$destroy",function(){f.$destroy()})}else i.$destroy()}function s(n){for(var i,t=0,r=n.length;t<r;t++)if(i=n[t],i.nodeType!==Node.TEXT_NODE||i.nodeValue.trim())return!0}if(!u)throw ngTranscludeInnerMinErr("orphan","Illegal use of ngTranscludeInner directive in the template! No parent directive that requires a transclusion found. Element: {0}",startingTag(t));i.ngTranscludeInner===i.$attr.ngTranscludeInner&&(i.ngTranscludeInner="");var e=i.ngTranscludeInner||i.ngTranscludeInnerSlot,f=n.$new();u(f,o,null,e)}}});angular.module("CCG.Shared").component("ccgPluralize",{template:"<span>{{ $ctrl.formattedWord }}<\/span>",bindings:{quantity:"=",singular:"@",plural:"@"},controller:[function(){var n=this;n.$onInit=function(){n.formattedWord=n.quantity==1?n.singular:n.plural}}]});angular.module("CCG.Shared").run(["$document","$window",function(n,t){n.on("contextmenu",".prevent-save img",function(n){t.alert("This image is copyrighted.");n.preventDefault()})}]);angular.module("CCG.Shared").directive("ccgPrice",[function(){return{require:"ngModel",restrict:"A",link:function(n,t,i,r){r.$parsers.unshift(function(n){return parseFloat(n.replace(",","."))})}}}]);angular.module("CCG.Shared").directive("ccgScrollPointEvent",["scrollService","windowService","$document",function(n,t,i){return{scope:{onTriggered:"=ccgScrollPointEvent",onRestored:"=",triggerOffset:"=",restoreOffset:"=",disableOnReady:"="},link:function(r,u){function e(t){if(t&&(!f||r.onRestored)){var i=n.getGlobalOffset(),e=u[0].getBoundingClientRect(),s=r.triggerOffset&&parseFloat(r.triggerOffset)!==NaN?parseFloat(r.triggerOffset):0,h=e.top+t.top+s-i,c=r.restoreOffset&&parseFloat(r.triggerOffset)!==NaN?parseFloat(r.restoreOffset):0,l=e.top+t.top+c-i;t.top>=h&&!f?(f=!0,o(r.onTriggered)):t.top<l&&f&&(f=!1,o(r.onRestored))}}function o(n){var t=typeof n;switch(t){case"string":r.$emit(n);break;case"function":n()}}var f=!1;n.registerOnScroll("ccgScrollPointEvent",e);r.$on("$destroy",function(){n.deregisterOnScroll("ccgScrollPointEvent")});r.disableOnReady||angular.element(i).ready(function(){e(t.getViewportScroll())})}}}]);angular.module("CCG.Shared").directive("ccgScrollTop",["$window",function(n){return{template:"",replace:!0,link:function(t,i){function r(){var t=n.pageYOffset;t>=400?$(i).fadeIn(200):t<400&&$(i).fadeOut(200)}angular.element(n).on("scroll",_.throttle(r,100));i.on("click",function(){document.body.scrollIntoView({behavior:"smooth",block:"start"})})}}}]);angular.module("CCG.Shared").directive("ccgSelector",[function(){return{controller:["$scope",function(n){n.selectedItem=null;n.events=n.events||{};angular.extend(n.events,{toggle:function(t){n.events.isSelected(t)?n.events.deselect(t):n.events.select(t)},select:function(t){n.selectedItem=t},deselect:function(){n.selectedItem=null},isSelected:function(t){return n.selectedItem===t}})}],link:function(){}}}]);angular.module("CCG.Shared").directive("ccgStickyElement",["$window","scrollService",function(n,t){return{scope:{buffer:"="},link:function(i,r){function h(){var c=r.offset().top,l=n.pageYOffset,h=!1;l>c-s&&!u?(o=c,r.addClass("fixed").appendTo("body"),f.removeClass("hide"),u=!0,h=!0,t.registerOffsetElement(r),e("h10","h1")):l<o-s&&u&&(f.addClass("hide").before(r),r.removeClass("fixed"),u=!1,h=!0,t.deregisterOffsetElement(r),e("h1","h10"));h&&i.$emit("ccgStickyElement.toggled",u)}function e(n,t){$(f).find(n).contents().unwrap().wrap("<"+t+"/>")}var o,u,s=i.buffer||0,f=r.clone().css("opacity",0).addClass("hide");e("h1","h10");r.after(f);t.registerOnScroll(r,h,!0);i.$on("$destroy",function(){t.deregisterOnScroll(r);t.deregisterOffsetElement(r)})}}}]);angular.module("CCG.Shared").directive("ccgUrlAwareClass",["urlService",function(n){return{link:function(t,i,r){var u=!1,f;r.ccgUrlAwareClass===""?u=n.path()==r.href:(f=new RegExp(r.ccgUrlAwareClass),u=n.path().match(f)!=null);u&&i.addClass(r.ccgUrlClass||"selected")}}}]);angular.module("CCG.Shared").directive("ccgAccordion",[function(){return{restrict:"C",link:function(n,t){t.on("click",".ccg-accordion__panel-toggle",function(n){n.stopPropagation();var i=$(this).next();i.slideToggle("fast").parent().toggleClass("ccg-accordion__panel--active");t.find(".ccg-accordion__panel-content").not(i).slideUp("fast").parent().removeClass("ccg-accordion__panel--active")})}}}]);angular.module("CCG.Shared").directive("ccgAnalyticsEvent",["analyticsService",function(n){return{link:function(t,i,r){i.on("click",function(){n.event(r.category,r.action,r.label)})}}}]);angular.module("CCG.Shared").service("analyticsService",["$window",function(n){return{event:function(t,i,r){n.ga?n.ga("send","event",t,i,r):!n._gaq||n._gaq.push(["_trackEvent",t,i,r])},pageview:function(t){n.ga?n.ga("send","pageview",t):!n._gaq||n._gaq.push(["_trackPageview",t])}}}]);angular.module("CCG.Shared").directive("ccgBanner",["urlService",function(n){return{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/banner/banner.html",transclude:!0,controllerAs:"banner",controller:["$attrs",function(t){var i=this;i.show=!$.cookie(t.cookieName);i.dismiss=function(){$.cookie(t.cookieName,1,{expires:365,path:"/",domain:n.sharedCookieDomain});i.show=!1}}]}}]);angular.module("CCG.Shared").directive("ccgCards",[function(){return{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/cards/cards.html",scope:{data:"=",expanderDataUrl:"@?",expanderDataKey:"@?",parseExpanderData:"&",scopeData:"=?",sortCriteria:"=",showAltImages:"@?",imageLabel:"@?",altImageLabel:"@?"},transclude:{cardTemplate:"cardTemplate",expanderTemplate:"?expanderTemplate"},controllerAs:"$cardCtrl",controller:["$animate","$element","$filter","$http","$q","$scope","$timeout","urlService","windowWatcher",function(n,t,i,r,u,f,e,o,s){function p(n){var t=u.when(n),i;!n.expanderData&&f.expanderDataUrl&&(i=URI.expand(f.expanderDataUrl,{key:n[f.expanderDataKey],seoName:n.SEOFriendlyName}).toString(),t=r.get(i).then(function(t){return f.parseExpanderData({card:n,results:t.data})}).then(function(t){return n.expanderData=t,n}));t.then(v)}function l(){var n=_.find(h.data,{url:decodeURI(o.path())});n?p(n):c()}function w(n){var t=_.cloneDeep(n);return t.forEach(function(n){n.template="cardTemplate";n.altText=n.Name+" image example"}),a(t)}function a(n){n=i("orderBy")(n||[],f.sortCriteria);var t=0;return _.each(n,function(n){n.template=="cardTemplate"&&(n.sort=t,t++)}),n}function c(){var n=_.findIndex(h.data,{isExpander:!0});n!=-1&&(h.data[n].card.selected=!1,h.data.splice(n,1))}function v(n){c();var t=angular.copy(n);t.isExpander=!0;t.template="expanderTemplate";t.sort=b(n);t.card=n;t.card.selected=!0;h.data.push(t)}function y(){var t=_.find(h.data,{selected:!0});t&&(n.enabled(!1),f.$apply(c),f.$apply(function(){v(t)}),n.enabled(!0))}function b(n){var i=t.find(".card"),u=i.filter("[sort="+n.sort+"]"),f=$(u).offset().top,r=_.find(i,function(t){var i=$(t),r=parseFloat(i.attr("sort"));return r<n.sort?!1:i.offset().top>f});return r?parseFloat($(r).attr("sort"))-.25:i.length}var h=this;f.baseUrl=o.baseUrl;_.assignIn(f,f.scopeData);s.onResize(y,500);f.$on("ccgViewSwitch.viewSwitched",y);f.$on("$locationChangeSuccess",l);f.$watch("sortCriteria",function(n){n&&(h.data=a(h.data))});f.$watchCollection("data",function(n){n&&(h.data=w(n),e(l))},!0);n.on("enter",t,function(n,i){if(n.is(".expander")&&i==="close"){var r=t.find(".card.selected");r.length!==0&&$("html, body").animate({scrollTop:r.offset().top},"fast")}})}]}}]);angular.module("CCG.Shared").component("ccgClickableTabs",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/clickable-tabs/clickable-tabs.html",bindings:{tabs:"<",activeTab:"<",selectTab:"<"},controller:[function(){var n=this}]});angular.module("CCG.Shared").directive("ccgCookieBanner",["urlService",function(n){return{templateUrl:"template-cache/cookie-banner.html",controllerAs:"cookieBanner",controller:[function(){var t=this;t.show=!$.cookie("cookie-policy");t.dismiss=function(){$.cookie("cookie-policy",1,{expires:365,path:"/",domain:n.sharedCookieDomain});t.show=!1}}]}}]);angular.module("CCG.Shared").directive("ccgCountdownClock",[function(){return{scope:{countdownName:"@",hasAnnouncement:"@"},transclude:!0,templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/countdown-clock/countdown-clock.html",controllerAs:"ctrl",controller:["$scope","$interval","countdownClockService",function(n,t,i){function o(){if(moment.utc().isSameOrAfter(moment.utc(f))){e();return}var n=moment.duration(Math.abs(moment.utc().diff(moment.utc(f))));r.days=_.padStart(Math.trunc(n.asDays()).toString(),2,"0");r.daysLength=r.days.length;r.hours=_.padStart(n.hours().toString(),2,"0");r.minutes=_.padStart(n.minutes().toString(),2,"0");r.seconds=_.padStart(n.seconds().toString(),2,"0");r.showCountdown=!0;r.showInnerCountdown=!0}function e(){angular.isDefined(u)&&(t.cancel(u),u=undefined);n.hasAnnouncement?(r.showCountdown=!0,r.showInnerCountdown=!1,r.showAnnouncement=!0):r.showCountdown=!1}var r=this,u,f;n.hasAnnouncement=n.hasAnnouncement==="true";r.showInnerCountdown=!1;r.showCountdown=!1;r.showAnnouncement=!1;i.getCountdownTimer(n.countdownName).then(function(n){if(!n||!n.ExpirationUTC){e();return}f=n.ExpirationUTC;moment.utc().isBefore(moment.utc(f))&&(o(),u=t(o,1e3))});n.$on("$destroy",e)}],link:function(n,t,i,r,u){u(n,function(n){t.children(".ccg-countdown-clock").append(n)})}}}]);angular.module("CCG.Shared").directive("ccgDateInput",function(){return{priority:-1,restrict:"A",require:"ngModel",link:function(n,t,i,r){r.$formatters.push(function(n){if(n)return new Date(n)})}}});angular.module("CCG.Shared").constant("DFP_URL","//www.googletagservices.com/tag/js/gpt.js").provider("DfpAdService",["DFP_URL",function(n){function e(n,t){var f=_.find(u,{name:n}),e,o;f&&(e=_.find(i,{name:f.sizeMapName}),o=googletag.defineSlot(r+f.name,f.size,t),e&&o.defineSizeMapping(e.googleSizeMap),o.addService(googletag.pubads()))}window.googletag=window.googletag||{};window.googletag.cmd=window.googletag.cmd||[];var t=this,r="",u=[],i=[],f=0;this.loadScript=function(t){var i=document.createElement("script"),u="https:"===document.location.protocol,r=document.getElementsByTagName("script")[0];i.async=!0;i.type="text/javascript";i.src=(u?"https:":"http:")+n;r.parentNode.insertBefore(i,r);i.onreadystatechange=function(){(this.readyState=="complete"||this.readyState=="loaded")&&t()};i.onload=t};this.initialize=function(){googletag.cmd.push(function(){_.forEach(i,function(n){var t=googletag.sizeMapping();_.forEach(n.sizes,function(n){t.addSize.apply(t,n)});n.googleSizeMap=t.build()});googletag.pubads().setTargeting("url",window.location.pathname.substr(0,40));googletag.pubads().setTargeting("domain",window.location.host);googletag.pubads().setCentering(!0);googletag.pubads().enableSingleRequest();googletag.enableServices();googletag.pubads().addEventListener("slotRenderEnded",function(n){n.slot.attempts=n.slot.attempts||0;n.isEmpty&&n.slot.attempts===0?(googletag.pubads().refresh([n.slot]),n.slot.attempts=n.slot.attempts+1):n.slot.attempts=0})})};this.defineSlotPrefix=function(n){r=n};this.defineSlot=function(n,t,i){u.push({name:n,size:t,sizeMapName:i})};this.defineSizeMapping=function(n,t){i.push({name:n,sizes:t})};this.$get=["$q",function(n){var i=n.defer();return t.loadScript(function(){try{t.initialize();i.resolve()}catch(n){i.reject(n)}}),{defineSlotPrefix:t.defineSlotPrefix,defineSlot:t.defineSlot,defineSizeMapping:t.defineSizeMapping,displayAd:function(n,t){i.promise.then(function(){googletag.cmd.push(function(){var i="";t=="dfp-ctc_header"?i="div-gpt-ad-1671562125418-0":t=="dfp-ctc_sidebar"?i="div-gpt-ad-1671562220742-0":t=="dfp-ctc_footer"?i="div-gpt-ad-1671562016913-0":(f++,i="div-gpt-ad-"+f);n.attr("id",i);e(t,i);googletag.display(i)})},function(){var n=document.getElementById(id);n.innerHTML=""})},refreshAllAds:function(){googletag.cmd.push(function(){googletag.pubads().refresh()})}}}]}]);angular.module("CCG.Shared").directive("ccgDfpAd",["DfpAdService","$timeout",function(n,t){return{scope:{slotName:"@ccgDfpAd"},template:"<div class='dfp-ad'><\/div>",replace:!0,link:function(i,r){t(function(){n.displayAd(r,i.slotName)})}}}]);angular.module("CCG.Shared").component("ccgEditCoverImage",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/edit-cover-image/edit-cover-image.html",bindings:{hasImage:"<",onImageSelected:"&",onImageDeleted:"&",addImageLabel:"@",addImageSubtext:"@",confirmDeleteLabel:"@",deleteImageLabel:"@",editImageLabel:"@",newImageLabel:"@"},controller:["$scope","$filter","imageResizer","notifier",function(n,t,i,r){var u=this;u.showEditMenu=function(){u.isEditing=!0};u.hideEditMenu=function(){u.isEditing=!1;u.isDeleting=!1};u.showConfirmDelete=function(){u.isDeleting=!0};u.uploadImage=function(n){var t=_.first(n);t&&(u.isLoading=!0,u.hideEditMenu(),i.resize(t,u.finishUpload))};u.finishUpload=function(i,f){if(!i){u.isLoading=!1;return}u.onImageSelected({imageFile:i,orientation:f}).then(function(i){if(i.Success){n.$emit("bgImage.refresh");n.$emit("ccgBgImage.refresh");return}i.OverSizeLimit?r.showError(t("localize")("Error.OverSizeLimit"),5e3):r.showError(t("localize")("Error.UploadError"),5e3)}).finally(function(){u.isLoading=!1})};u.deleteImage=function(){u.hideEditMenu();u.onImageDeleted().then(function(){n.$emit("bgImage.refresh");n.$emit("ccgBgImage.refresh")})}}]});angular.module("CCG.Shared").component("ccgEmailSignup",{templateUrl:"template-cache/email-signup.html",controllerAs:"$ctrl",controller:["$scope","newsService",function(n,t){var i=this;i.showThankYou=!1;i.showEmailSignup=!$.cookie("ShowEmailSignup")&&window.self===window.top;i.showEmailSignup&&$.cookie("ShowEmailSignup","Dismissed",{path:"/"});i.closeModal=function(){i.showEmailSignup=!1};i.submit=function(){t.nonMemberSignup(i.email,i.optedInName,i.SFMCNewsletterKey,window.location.origin).then(function(n){n.success?($.cookie("ShowEmailSignup","Susbcribed",{expires:365,path:"/"}),i.showThankYou=!0):(i.showError=!0,i.error=n)}).catch(function(n){i.showError=!0;i.errorMessage=n})}}]});angular.module("CCG.Shared").directive("ccgFancyboxImages",[function(){return{link:function(n,t){var i;t.hasClass("prevent-save")&&(i={protect:!0,onUpdate:null});t.find("a:not([onclick]):not([target]) > img").parent().attr("data-fancybox","group").fancybox(i)}}}]);angular.module("CCG.Shared").run([function(){$.fancybox&&($.extend(!0,$.fancybox.defaults,{animationEffect:"fade",hash:!1,spinnerTpl:'<div class="loading"><\/div>'}),$.extend(!0,$.fancybox.defaults.i18n.en,{ERROR:"The requested image is not currently available.  Please try again later."}))}]);angular.module("CCG.Shared").service("gaeService",[function(){return{event:function(n,t){n||(n="purchase");typeof gtag!="undefined"&&gtag("event",n,t)}}}]);angular.module("CCG.Shared").service("scoreGridFiltersService",["$q","coinGrades","storageService",function(n,t,i){var r=null,u=[],f=[];return{STORAGE_KEY:"scoreGridFilters",onDataFilterChanged:function(n){u.push(n)},onVisualFilterChanged:function(n){f.push(n)},dataFilterChanged:function(n){u.forEach(function(t){t(n)})},visualFilterChanged:function(n){f.forEach(function(t){t(n)})},getFilters:function(n,u){var f=t[n].slice(0);return r||(r=i.get(this.STORAGE_KEY)||{base:!0,star:!0,plus:!0,greenCAC:!u,goldCAC:!u,fromGrade:_.first(f).code,toGrade:_.last(f).code}),_.find(f,{code:r.fromGrade})||(r.fromGrade=_.first(f).code),_.find(f,{code:r.toGrade})||(r.toGrade=_.last(f).code),r},saveFilters:function(){var n=angular.copy(r);i.set(this.STORAGE_KEY,n)}}}]);angular.module("CCG.Shared").component("scoreGrid",{transclude:!0,bindings:{scores:"<",isWorldSet:"@",isNgcx:"@"},templateUrl:["$attrs","urlService",function(n,t){var i="registry/templates/competitive/";return i+=n.isNgcx==="true"?"ngcx-score-grid-template/":"score-grid-template/",t.templateUrl(i)}],controller:["$rootScope","$attrs","$element","$timeout","scoreGridFiltersService","windowWatcher",function(n,t,i,r,u,f){function h(t){var r=[],u=i.find(".scrollable th[grade='"+t.fromGrade+"']").index(),f=i.find(".scrollable th[grade='"+t.toGrade+"']").index()+3,e;u>0&&r.push(":nth-child(-n + "+u+")");f>=0&&r.push(":nth-child(n + "+f+")");t.base||r.push(".base");t.star||r.push(".star",".plus-star");t.plus||r.push(".plus",".plus-star");e=r.map(function(n){return".scrollable td"+n+", \n.scrollable th"+n}).join(", \n");s.text(e+" { display: none; }");n.$emit("gridStickyHeader.reload.main")}function c(n){n&&i.find(".pinned tr, .scrollable tr").addClass("needs-alignment").css({height:""});var t=i.find(".pinned tr.needs-alignment").removeClass("needs-alignment").toArray(),r=i.find(".scrollable tr.needs-alignment").removeClass("needs-alignment").toArray();t.forEach(function(n,t){var u=$(n),f=$(r[t]);if(u[0]&&f[0]){var e=u[0].getBoundingClientRect().height,o=f[0].getBoundingClientRect().height,i=Math.max(e,o);e!==i&&u.height(i);o!==i&&f.height(i)}})}function l(){c(!0)}function p(n){requestAnimationFrame(function(){(i.find(".focused").removeClass("focused"),n.addClass("focused"),o=n.attr("grade"),o!==a)&&($(".highlight[grade!='"+o+"']").removeClass("highlight"),$("[grade='"+o+"']").addClass("highlight"),a=o)})}var e=this,v=t.isNgcx==="true"?"ngcx-set-scores":"set-scores",s;e.$onInit=function(){var t,n;f.onResize(l,50);u.onVisualFilterChanged(h);e.isWorldSet=e.isWorldSet==="true";t=u.getFilters(v,e.isWorldSet);h(t);n=!1;i.on("mousedown",".scrollable td",function(){n=!0}).on("mouseup",".scrollable td",function(){n=!1}).on("mouseover",".scrollable td",function(t){var i=$(t.target);n||y(i)})};e.$onChanges=function(){r(l)};s=i.find("style");var a=null,o=null,y=_.throttle(p,16)}]});angular.module("CCG.Shared").directive("ccgInlineAlert",[function(){return{replace:!0,templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/inline-alert/inline-alert.html",scope:{successMessage:"=?",errorMessage:"=?",duration:"=?"},controllerAs:"$ctrl",controller:["$scope","$timeout",function(n,t){function u(u){return function(f){f&&(n.successMessage="",n.errorMessage="",i.message=f,i.visible=!0,i.isSuccess=u,i.isError=!u,t.cancel(r),r=t(function(){i.visible=!1},n.duration||3e3))}}var i=this,r;n.$watch("successMessage",u(!0));n.$watch("errorMessage",u(!1))}]}}]);angular.module("CCG.Shared").directive("ccgBackgroundLazyLoad",["lazyLoadService",function(n){return{link:function(t,i,r){n.register(i,function(){r.ccgBackgroundLazyLoad&&i.css("background-image","url("+r.ccgBackgroundLazyLoad+")")})}}}]);angular.module("CCG.Shared").directive("ccgImageLazyLoad",["lazyLoadService",function(n){return{link:function(t,i,r){n.register(i,function(){var n=i.attr("src");i.on("error",function(){n&&i.attr("src",n);i.off("error")}).attr("src",r.ccgImageLazyLoad)})}}}]);angular.module("CCG.Shared").directive("ccgModal",["$rootScope","keycodes",function(n,t){return{replace:!0,transclude:!0,templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/modal/modal-template.html",scope:{showModal:"=ccgModal",allowClose:"=",onClosing:"&",onClosed:"&"},controllerAs:"modal",controller:["$scope",function(n){this.open=function(){n.showModal=!0};this.close=function(t,i){var r=!n.allowClose||n.disableOverlayClose&&i;t!==!0&&r||(n.showModal=!1)}}],link:function(i,r,u,f,e){i.disableOverlayClose=u.disableOverlayClose!==undefined;i.showBackgroundContent=u.showBackgroundContent!==undefined;var o=e(i.$parent,function(n,t){angular.extend(t,{modal:f})});r.removeAttr("ccg-modal");r.appendTo("body");r.find(".modal-dialog-content").append(o);$("html").toggleClass("modal-is-visible",!!i.showModal);i.showBackgroundContent&&$("html").toggleClass("show-background-content",!!i.showModal);i.$on("ccgModal.resetScroll",function(){r.find(".modal-dialog-content").scrollTop(0)});i.$watch("showModal",function(t,r){if(t!==r){if(!t){if(i.onClosing()===!1){i.showModal=!0;return}i.onClosed()}$("html").toggleClass("modal-is-visible",i.showModal);i.showBackgroundContent&&$("html").toggleClass("show-background-content",!!i.showModal);n.$broadcast("modal.visibilityChanged",i.showModal)}});$(document).on("keydown",function(n){n.keyCode===t.ESCAPE&&i.showModal&&i.$apply(f.close)})}}}]);angular.module("CCG.Shared").directive("ccgPreventOuterScroll",["domService",function(n){return{link:function(t,i){function u(n,t,i){var r;i.stopPropagation();r=t;$(i.target).is("textarea")&&(r=i.target);var u=r.scrollTop===0,f=r.clientHeight+r.scrollTop===r.scrollHeight,e=r.scrollHeight<=r.clientHeight;(e||n&&f||!n&&u)&&i.preventDefault()}if(n.isTouch){var r=0;i.on("touchstart",function(n){r=n.originalEvent.touches[0].clientY}).on("touchmove",function(n){var t=n.originalEvent.touches[0].clientY,f=t<r;u(f,i[0],n)})}else i.on("mousewheel",function(n){var t=n.originalEvent.wheelDelta<0;u(t,i[0],n)})}}}]);angular.module("CCG.Shared").directive("ccgPreventScroll",[function(){return{link:function(n,t){t.on("mousewheel touchmove",function(n){n.stopPropagation();n.preventDefault()})}}}]);angular.module("CCG.Shared").factory("notifier",[function(){function t(t,i,r){t&&n.log(t,{timeout:i||humane.timeout,clickToClose:!0,addnCls:r})}var n=humane.create();return{showError:function(n,i){t(n,i,"error")},showMessage:function(n,i){t(n,i)},clearNotifications:function(){n.queue=[];n.currentTimer&&n.remove()}}}]);angular.module("CCG.Shared").directive("ccgOverlay",["$rootScope","urlService","windowWatcher","keycodes",function(n,t,i,r){return{scope:{visible:"=ccgOverlay",eventKey:"@",onOpening:"=",onOpened:"=",onClosing:"=",onClosed:"=",offset:"@",duration:"@",closeDuration:"@"},templateUrl:t.root+"resources/ccg-shared/scripts/ccg.shared/components/overlay/overlay.html",transclude:!0,controllerAs:"overlayCtrl",controller:["$scope","$element","$compile","$timeout","domService","windowWatcher",function(t,i,r,u,f,e){function y(n){h&&h.$destroy();l.empty();h=t.$new();o.content=r(n)(h);l.append(o.content);u(function(){t.$apply()})}function c(t){t&&(typeof t=="function"?t():(t=t.indexOf(",")>=0?t.split(","):[t],_.forEach(t,function(t){t&&n.$broadcast(t.trim())})))}function v(n){var r=n||!o.visible,f={translateX:0},i={duration:parseInt(t.duration)||300,easing:[.79,.24,.51,.95]};r?($("body").addClass("no-scroll"),o.resize(),c(t.onOpening),e.resizeWatcher.refresh(),f.translateX=-e.size().width,i.begin=function(){a.addClass("show");s.addClass("show")},i.complete=function(){c(t.onOpened)}):($("body").removeClass("no-scroll"),c(t.onClosing),i.duration=parseInt(t.closeDuration)||200,i.begin=function(){a.removeClass("show")},i.complete=function(){s.removeClass("show");o.content&&o.content.remove();o.closeCallback&&o.closeCallback();c(t.onClosed)});o.visible=r;u(s.velocity.bind(s,f,i),0)}var o=this,h=null,s=i.find(".offcanvas-pane"),l=i.find(".offcanvas-pane-content"),a=i.find(".offcanvas-pane-overlay");o.close=function(){v(!1)};o.open=function(n){n&&y(n);v(!0)};o.resize=function(){var n=e.size(),i=f.isSmall()||f.isXSmall()?n.width:n.width-parseFloat(t.offset);s.css({width:i+"px",top:0,right:-n.width});$.Velocity.hook(s,"translateX",(o.visible?-n.width:0)+"px")};o.content=null;o.visible=t.visible;o.visible&&o.open()}],link:function(n,t,i,u){n.$watch("visible",function(n){n!==u.visible&&(n?u.open():u.close())});n.$on("ccgOverlay.open."+n.eventKey,function(t,i,r){n.visible||(u.open(i),u.closeCallback=r)});$(window).on("resize",u.resize);$(document).on("keydown",function(t){t.keyCode===r.ESCAPE&&u.visible&&n.$apply(u.close)})}}}]);angular.module("CCG.Shared").directive("ccgPager",["urlService","keycodes",function(n){return{scope:{pagedList:"=ccgPager",pageRange:"@",onPageChanged:"&",scrollToSelector:"@"},templateUrl:n.root+"resources/ccg-shared/scripts/ccg.shared/components/pager/pager-template.html",bindToController:!0,controllerAs:"pagerCtrl",controller:["$element","$scope","domService","windowWatcher","pagerLinkText","scrollService","keycodes",function(t,i,r,u,f,e,o){var s=this,h=f||{};s.ofText=h.of;s.baseUrl=n.baseUrl;s.goToPage=function(n,t){if(n.keyCode==undefined||n.keyCode==o.ENTER||n.keyCode==o.TAB){n.preventDefault();s.page=parseInt(t);s.page==0?s.page=1:s.page>s.pageCount&&(s.page=s.pageCount);s.refresh();s.onPageChanged({page:s.page});s.scrollToSelector&&e.scrollToElement(s.scrollToSelector)}};s.refresh=function(){s.showFirst=s.page>1;s.showLast=s.page<s.pageCount;s.showPrevious=s.page>1;s.showNext=s.page<s.pageCount};i.$watch("pagerCtrl.pagedList",function(){s.pageCount=s.pagedList!==undefined?s.pagedList.PageCount:1;s.visible=s.pageCount>1;s.page=s.pagedList!==undefined?parseInt(s.pagedList.Page):1;s.refresh()});i.$watch("pagerCtrl.pagedList.Page",function(n,t){t!==undefined&&t!==n&&s.page!==n&&(s.page=parseInt(n),s.refresh())});i.$watch("pagerCtrl.pagedList.PageCount",function(n,t){t!==undefined&&t!==n&&s.pageCount!==n&&(s.pageCount=parseInt(n),s.refresh())});setTimeout(function(){s.pageCount>1&&($("html").addClass("pager-visible"),t.parent(".fixed-ccg-pager").appendTo("body"))})}]}}]);angular.module("CCG.Shared").component("ccgResourceCategories",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/resource-cards/resource-categories.html",bindings:{expanderKey:"@",countryId:"@",countryName:"@",nameColumn:"@",countColumn:"@",countLabel:"@",subcategoryNameColumn:"@",subcategoryNameLabel:"@",subcategoryCountColumn:"@",subcategoryCountLabel:"@",imageUrlBase:"@",imagePathKey:"@",placeholderImageUrl:"@",viewAllEnabled:"@",viewAllLabel:"@"},controller:["urlService","ccgResourceService",function(n,t){var i=this;i.baseUrl=n.baseUrl;i.$onInit=function(){t.fetchCategoriesForCountry(i.countryId,i.countColumn).then(function(t){t.forEach(function(t){t.url=n.baseUrl+t.SeoName+"/";t[i.imagePathKey]&&(t.imageUrl=i.imageUrlBase+t[i.imagePathKey])});i.gridItems=t})};i.parseExpanderData=function(n,t){var u={columns:[]},r=t.ResultSet||t,f=!!t.IsGroupings,o,e,s;return u.isGroupings=f,f?r.forEach(function(t){t.Subcategories.forEach(function(i){i.url=n.url+t.SeoName+"/"+i.SeoName+"/"})}):r.forEach(function(t){t.url=n.url+t.SeoName+"/"}),i.viewAllEnabled&&!f&&(o={url:n.url+"all/"},o[i.subcategoryNameColumn]=i.viewAllLabel,r.push(o)),e=r.length,e>5&&!f?(s=Math.ceil(e/2),u.columns.push(_.take(r,s)),u.columns.push(_.takeRight(r,e-s))):u.columns.push(r),u}}]});angular.module("CCG.Shared").component("ccgResourceCountries",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/resource-cards/resource-countries.html",bindings:{pageHeader:"@",alphaColumn:"@",alphaSortLabel:"@",countColumn:"@",countLabel:"@",countSortLabel:"@",sortByLabel:"@",imageUrlBase:"@",imagePathKey:"@",placeholderImageUrl:"@"},controller:["storageService","urlService","ccgResourceService",function(n,t,i){function u(t,i,u){r.orderBy=t;r.view=i;r.sortCriteria=u;n.set("resource-countries-orderby",r.orderBy)}var r=this;r.$onInit=function(){i.fetchAllCountries(r.countColumn).then(function(i){i.forEach(function(n){n.url=t.baseUrl+n.SeoName+"/";n[r.imagePathKey]&&(n.imageUrl=r.imageUrlBase+n[r.imagePathKey])});r.orderBy=n.get("resource-countries-orderby");r.gridItems=i;switch(r.orderBy){case"alpha":r.orderByAlpha();break;default:r.orderByCount()}})};r.orderByAlpha=function(){u("alpha","compact",[r.alphaColumn])};r.orderByCount=function(){u("count","expanded",["-"+r.countColumn,r.alphaColumn])}}]});angular.module("CCG.Shared").factory("ccgResourceService",["webServiceFactory",function(n){return n.create({fetchAllCountries:function(n){return this.get("/resources/data/countries/?columnName="+n)},getCountry:function(n,t){return this.get("/resources/data/countries/"+n+"/?columnName="+t)},fetchCategoriesForCountry:function(n,t){return this.get("/resources/data/countries/"+n+"/categories/?columnName="+t)},fetchSubcategoriesForCategory:function(n,t,i){return this.get("/resources/data/countries/"+n+"/categories/"+t+"/subcategories/?columnName="+i)},getSubcategory:function(n,t,i,r){return this.get("/resources/data/countries/"+n+"/categories/"+t+"/subcategories/"+i+"/?columnName="+r)}})}]);angular.module("CCG.Shared").directive("ccgSimpleExpander",["$timeout",function(n){return{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/simple-expander/simple-expander.html",transclude:{expanderTitle:"expanderTitle",expanderContent:"expanderContent"},scope:{broadcastFunction:"<"},controllerAs:"expanderCtrl",controller:["$scope","$element",function(n,t){var i=this,r,u;i.guid=UUID.generate();r=t.find("[ng-transclude='expanderContent']");u=t.find(".expander-content");i.toggleExpander=function(){n.broadcastFunction&&n.broadcastFunction("ccg-simple-expander.close-others",{target:i.guid});i.open=!i.open;var t=i.open?r.outerHeight():0;u.css("max-height",t+"px")};i.closeExpander=function(){i.open=!1}}],link:function(t,i,r,u){if(r.name){var f=new URI,e=f.fragment();e===r.name&&n(function(){$("html, body").animate({scrollTop:$(i).offset().top},1e3);u.toggleExpander()})}t.$on("ccg-simple-expander.close-others",function(n,t){t&&t.target!==u.guid&&u.closeExpander()})}}}]);angular.module("CCG.Shared").provider("siteSelectorService",function(){var t=this,n=[];this.addSites=function(t){n=n.concat(t)};this.setCurrentSite=function(t){var i=_.find(n,{className:t});_.set(i,"selected",!0)};this.$get=function(){function t(){var t=this;t.sites=n}return new t}});angular.module("CCG.Shared").directive("ccgSiteSelector",["urlService",function(n){return{templateUrl:n.root+"resources/ccg-shared/scripts/ccg.shared/components/site-selector/site-selector.html",controllerAs:"siteSelectorCtrl",controller:["siteSelectorService",function(n){this.sites=n.sites;this.currentSite=_.find(this.sites,{selected:!0})}],link:function(){}}}]);angular.module("CCG.Shared").component("ccgSortableGrid",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/sortable-grid/sortable-grid.html",bindings:{hideSelectors:"<",selectAllLabel:"@",headers:"<",items:"=",additionalSorting:"<",startSelected:"<",startHighlighted:"<",pageSize:"<"},controller:["$location","$rootScope",function(n,t){function u(n){n=Math.min(n,i.pagination.PageCount);i.startIndex=i.pageSize*(n-1)}var i=this,r;i.allSelected=!1;i.startPage=1;i.startIndex=0;r=new URI;r.hasQuery("page")&&(i.startPage=parseInt(new URLSearchParams(r.search()).get("page"))||1);i.$onInit=function(){i.hideSelectors=i.hideSelectors!==undefined?i.hideSelectors:!0;i.selectAllLabel=i.selectAllLabel||"";i.pageSize=i.pageSize||50;i.pagination={PageCount:Math.ceil(i.items.length/i.pageSize),Page:i.startPage};i.startSelected&&typeof i.startSelected=="function"&&_(i.items).forEach(function(n){n.selected=i.startSelected(n)});i.startHighlighted&&typeof i.startHighlighted=="function"&&_(i.items).forEach(function(n){n.isHighlighted=i.startHighlighted(n)});i.updateSorting();u(i.pagination.Page)};i.selectAll=function(){_(i.items).forEach(function(n){n.selected=i.allSelected})};i.selectItem=function(){i.allSelected=_.every(i.items,{selected:!0})};i.updateSorting=function(n){function e(t){return n?n.column===t.column?0:1:0}var u=_(i.headers).filter("sortOrder").orderBy([e,"sortOrder"],["asc","asc"]).value(),t,r,f;n&&n.column===i.sortColumn?i.sortDescending=!i.sortDescending:(i.sortDescending=!1,i.sortColumn=u[0].column);t=u.map(function(n){return function(t){return n.customSort?n.customSort(t):t[n.column]}});r=u.map(function(){return i.sortDescending?"desc":"asc"});i.additionalSorting&&(f=i.additionalSorting(),t=_.concat(_.map(f,"sortMethod"),t),r=_.concat(_.map(f,"sortOrder"),r));i.items=_.orderBy(i.items,t,r)};i.getSortClass=function(n){var t="";return n.column===i.sortColumn&&(t=i.sortDescending?"down-arrow-alt":"up-arrow-alt"),t};i.changePage=function(t){(t!==1||n.search().page!==undefined)&&n.search("page",t)};t.$on("$locationChangeSuccess",function(){if(i.pagination){var t=n.search().page;t===undefined&&(t=1);t!==i.pagination.Page&&(t>i.pagination.PageCount&&(t=i.pagination.PageCount,n.search("page",t).replace()),i.pagination.Page=t);u(t)}})}]});angular.module("CCG.Shared").directive("ccgTooltip",["$rootScope","$timeout","windowWatcher","urlService","domService",function(n,t,i,r,u){return{scope:{content:"@ccgTooltip",tooltipClass:"@"},link:function(r,f,e){function c(r,u){var s,c;e.persistTooltip!=undefined&&o.hasClass("show")||(n.$broadcast("tooltips.hide",r.target),s=f.offset(),s.top+=f.outerHeight()+8,s.left+=(f.outerWidth()-o.outerWidth())/2,s.left<0?s.left=0:s.left+o.outerWidth()>i.size().width&&(s.left-=s.left+o.outerWidth()-i.size().width),o.css(s),c=u===!0?0:500,t.cancel(h),h=t(function(){o.addClass("show")},c),r.stopPropagation())}function s(n,i){$.contains(f[0],i)||$(f).is(i)||(t.cancel(h),t(function(){o.removeClass("show")}),n&&n.stopPropagation&&n.stopPropagation())}function l(n){e.persistTooltip==undefined&&s(n)}function a(n){o.hasClass("show")?s(n,n.target):c(n,!0)}var o,h;if(r.content){o=$("<div>").addClass("tooltip-element").html(r.content);r.tooltipClass&&o.addClass(r.tooltipClass);u.storePositionedElement("tooltips",o);f.on("click",function(n){n.preventDefault();a(n)});o.on("click",s);r.$on("tooltips.hide",s);r.$on("mxToggle.open-menus",s);i.onResize(s);if(e.requireClick===undefined){f.on("mouseenter",c);f.on("mouseleave",l)}h=undefined}}}}]);angular.module("CCG.Shared").component("ccgTypeahead",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/typeahead/typeahead.html",bindings:{placeholder:"@",searchingLabel:"@",noResultsLabel:"@",searchUrl:"@",resultFields:"@"},controller:["$window",function(n){var t=this;t.onSelected=function(t){t.originalObject.URL&&(n.location.href=t.originalObject.URL)}}]});angular.module("CCG.Shared").directive("ccgViewSwitch",["$injector","storageService",function(n,t){return{controllerAs:"viewSwitch",controller:["$element","$scope","$rootScope",function(n,i,r){this.currentView=null;this.changeView=function(n){n.preventDefault();this.setView($(n.target).closest("[view]"));i.$apply()}.bind(this);this.refreshView=function(){var t=_.get(i[this.scopeKey],"view"),u=this.currentView?this.currentView.attr("view"):null,r;t&&t!==u&&(r=n.find("[view="+t+"]"),this.setView(r))}.bind(this);this.setView=function(n,u){n=angular.element(n);this.currentView=n;n.siblings("[view]").removeClass("selected");n.addClass("selected");var f=n.attr("view"),e={};_.forEach(n[0].attributes,function(n){e[n.name]=n.value});i[this.scopeKey]=e;n.attr("no-persist")===undefined&&this.storageKey&&t.set(this.storageKey,f);u||r.$broadcast("ccgViewSwitch.viewSwitched",f)}.bind(this);this.nextView=function(){if(this.currentView){var n=this.currentView.next();n.length===0&&(n=this.currentView.siblings("[view]")[0]);this.setView(n)}}.bind(this)}],link:function(i,r,u,f){var o,s,e;f.scopeKey=u.ccgViewSwitch;f.storageKey=u.persistAs;r.on("click","[view]",f.changeView);if(u.hotkeyCycleView)try{o=n.get("hotkeys");o.add({combo:u.hotkeyCycleView,action:"keyup",description:"Cycle views",callback:f.nextView})}catch(h){console.log("hotkey service is not available")}s=t.get(u.persistAs)||u.defaultView;e=r.find("[view="+s+"]");e.length===0&&(e=r.find("[view]:first"));f.setView(e,!0);i.$watch(f.scopeKey+".view",f.refreshView);i.$on("coinSlotScoresList.viewSwitched",function(n,t){_.set(i[f.scopeKey],"view",t?"NGCX":"Sheldon");f.refreshView()})}}}]);angular.module("CCG.Shared").factory("voteService",["webServiceFactory",function(n){return n.create({fetchVoteOptions:function(n){return this.get("/resources/services/vote/vote-options/",{categoryName:n})},submitVote:function(n,t){return this.post("/resources/services/vote/submit-vote/",{categoryName:n,voteOptionID:t})},fetchVoteResults:function(n){return this.get("/resources/services/vote/vote-results/",{categoryName:n})}})}]);angular.module("CCG.Shared").component("ccgVoteTool",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/components/vote-tool/vote-tool.html",bindings:{name:"@"},controller:["voteService",function(n){function r(){n.fetchVoteResults(t.name).then(function(n){u(n)})}function u(n){var f,o;t.voteResults=n;var e=document.getElementById("voteResultsChart").getContext("2d"),i=[],r=[],u=0;_.each(n,function(n){n.OptionName!==""&&(i.push(n.OptionName),r.push(n.NumberOfVotes),u+=n.NumberOfVotes)});t.totalVoteNumber=u;f={labels:i,datasets:[{data:r,backgroundColor:["rgb(216, 173, 97)","rgb(128, 199, 191)"],hoverOffset:4,borderWidth:8,responsive:!1}]};o=new Chart(e,{type:"pie",data:f,options:{legend:{display:!1},tooltips:{enabled:!1},responsive:!1}})}var t=this,i;t.$onInit=function(){i="vote-"+t.name.replace(" ","-");t.showVoteResult=parseInt($.cookie(i))===1;t.showVoteResult?r():n.fetchVoteOptions(t.name).then(function(n){t.voteOptions=n})};t.submitVote=function(){n.submitVote(t.name,t.selectedVoteOptionID).then(function(n){n.Success?(r(),t.showVoteResult=!0,$.cookie(i,1)):($.cookie(i,0),t.showVoteResult=!1,console.error(n.Error))})}}]});angular.module("CCG.Shared").directive("ccgWysiwygEditor",["$compile","$rootScope",function(n,t){return{restrict:"A",scope:{modalTitle:"@ccgWysiwygEditor",forceRootBlock:"=forceRootBlock"},require:["ccgWysiwygEditor","ngModel","?^ccgTranslationAdminForm"],controllerAs:"wysiwyg",controller:["$scope",function(t){function u(){i.model=r.$viewValue}var i=this,r=null;tinyMCE.baseURL="/resources/bower/tinymce";i.tinymceOptions={height:500,contextmenu:!1,menubar:!1,forced_root_block:t.forceRootBlock==!1?"":"div",paste_as_text:!0,plugins:"code, lists, link, image, paste",toolbar:"formatselect | bold italic underline forecolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image | removeformat | code"};i.openEditor=function(){i.openModal=!0;i.newHtml=i.model;var r="<div id='wysiwygModal"+i.wysiwygID+"' class='ccg-form' ccg-modal='wysiwyg.openModal' allow-close='true' on-closed='wysiwyg.closeEditor'><h2>"+t.modalTitle+"<\/h2><textarea ui-tinymce='wysiwyg.tinymceOptions' ng-model='wysiwyg.newHtml' ccg-ignore-model-override><\/textarea><div class='next-steps'><a class='btn primary' ng-click='wysiwyg.save()'>Save<\/a><a class='cancel' ng-click='wysiwyg.closeEditor()'>Cancel<\/a><\/div><\/div>",u=angular.element("#wysiwygInputWrapper"+i.wysiwygID);u.append(n(r)(t));$("html").toggleClass("wysiwyg",!0)};i.closeEditor=function(){i.openModal=!1;angular.element("#wysiwygModal"+i.wysiwygID).remove();angular.element(".tox-tinymce-aux").remove();$("html").toggleClass("wysiwyg",!1)};i.save=function(){i.model=i.newHtml;i.closeEditor()};i.setNgModelController=function(n){r=n;r.$render=u;u()};t.$watch("wysiwyg.model",function(){r.$setViewValue(i.model)})}],link:function(i,r,u,f){var h=f[0],s,e,o;h.setNgModelController(f[1]);s=f[2];s&&(i.translationCtrl=s);t.wysiwygID===undefined?t.wysiwygID=0:t.wysiwygID+=1;h.wysiwygID=t.wysiwygID;e=angular.element("<div id='wysiwygInputWrapper"+t.wysiwygID+"' class='wysiwyg-input-wrapper'><\/div>");u.ngHide&&e.attr("ng-hide",u.ngHide);o=r.clone().removeAttr("ccg-wysiwyg-editor");o.attr("ccg-ignore-model-override","");o.attr("ng-model","wysiwyg.model");e.append(o);e.append(angular.element("<span class='icon-edit' ng-click='wysiwyg.openEditor()'><\/span>"));r.replaceWith(n(e)(i))}}}]);angular.module("CCG.Shared").controller("consentController",["$scope","$window","consentService","urlService","translationDictionary",function(n,t,i,r,u){function e(){f.errorMessage=u.Error.WaiverSubmitFailed;f.disableControls=!1}var f=this;f.errorMessage=null;f.consent={};f.disableControls=!1;f.submitted=!1;f.consent.SignedDate=moment.utc();f.submitConsent=function(){n.form.$invalid||(f.disableControls=!0,n.form.$submitting=!0,i.submitConsent(f.consent).then(function(n){n?f.submitted=!0:e()}).catch(function(){e()}).finally(function(){n.form.$submitting=!1}))};f.reloadPage=function(){t.location=r.baseUrl}}]);angular.module("CCG.Shared").factory("consentService",["webServiceFactory",function(n){return n.create({submitConsent:function(n){return this.post("/consent/api/submit/",n)}})}]);angular.module("CCG.Shared").controller("contactController",["$scope",function(n){n.$on("recaptcha.ready",function(){angular.element("#contact_captcha").length&&grecaptcha.render("contact_captcha",{sitekey:CCG.recaptchaSiteKey})})}]);angular.module("CCG.Shared").value("coinGrades",{census:["PrAg","G","VG","F","VF","40","45","50","53","55","58","60","61","62","63","64","65","66","67","68","69","70"],"price-guide":["PrAg","G","VG","F","VF","XF","50","53","55","58","60","61","62","63","64","65","66","67","68","69","70"],"details-census":["PrAg","G","VG","F","VF","XF","AU","UNC"],pcgs:["Genuine","PrAg Details","G Details","VG Details","F Details","VF Details","XF Details","AU Details","UNC Details","Proof Details","1","2","3","4","6","8","10","12","15","20","25","30","35","40","45","45+","50","50+","53","53+","55","55+","58","58+","60","60+","61","61+","62","62+","63","63+","64","64+","65","65+","66","66+","67","67+","68","68+","69","70"],"set-scores":[{code:"PrAg",grade:"PrAg"},{code:"G",grade:"G"},{code:"VG",grade:"VG"},{code:"F",grade:"F"},{code:"VF",grade:"VF"},{code:"40",grade:"40"},{code:"45",grade:"45"},{code:"50",grade:"50"},{code:"53",grade:"53"},{code:"55",grade:"55"},{code:"58",grade:"58"},{code:"60",grade:"60"},{code:"61",grade:"61"},{code:"62",grade:"62"},{code:"63",grade:"63"},{code:"64",grade:"64"},{code:"65",grade:"65"},{code:"66",grade:"66"},{code:"67",grade:"67"},{code:"68",grade:"68"},{code:"69",grade:"69"},{code:"70",grade:"70"},]});angular.module("CCG.Shared").controller("dealerEditController",["$scope","countryStateService",function(n,t){var i=this;this.changeCountry=function(){i.country=_.find(i.CountryList,{CountryCode:n.CountryCode});t.fetchStatesForCountryByCountryCode(n.CountryCode).then(function(n){i.StateList=n})};t.fetchCountries().then(function(t){i.CountryList=t;i.country=_.find(i.CountryList,{CountryCode:n.CountryCode})});$(document).ready(function(){i.changeCountry()})}]);angular.module("CCG.Shared").controller("dealerExpirationController",["dealerService",function(n){var t=this;t.loading=!0;n.getDealerExpirationDetails().then(function(n){t.dealer=n;t.loading=!1})}]);angular.module("CCG.Shared").controller("dealerMembershipController",["dealerMembershipService",function(n){var t=this;t.dealerID=$("#DealerMembership #DealerID").val();t.newMembership=$("#DealerMembership #IsNew").val()=="True";t.paidMembership=$("#DealerMembership #IsActive").val()=="True";t.cancelledMembership=$("#DealerMembership #IsCancelled").val()=="True";t.expiredMembership=$("#DealerMembership #IsExpired").val()=="True";t.error=!1;t.submitting=!1;t.cancelMembership=function(){t.error=!1;t.submitting=!0;n.cancelMembership().then(function(n){t.processCancel(n)}).catch(function(){t.error=!0;t.submitting=!1;t.showCancelDealerMembershipModal=!1})};t.adminCancelMembership=function(){t.error=!1;t.submitting=!0;n.adminCancelMembership(t.dealerID).then(function(n){t.processCancel(n)}).catch(function(){t.error=!0;t.submitting=!1;t.showCancelDealerMembershipModal=!1})};t.processCancel=function(n){t.submitting=!1;n.Success?(t.cancelledMembership=!0,t.paidMembership=!1,t.showCancelDealerMembershipModal=!1,t.showSorryToSeeYouGoModal=!0):(t.error=!0,$this.showCancelDealerMembershipModal=!1)}}]);angular.module("CCG.Shared").factory("dealerMembershipService",["webServiceFactory",function(n){return n.create({cancelMembership:function(){return this.post("/dealers/account/membership-cancel/")},adminCancelMembership:function(n){return this.post("/admin/dealers/"+n+"/autorenew/cancel/")}})}]);angular.module("CCG.Shared").controller("dealerPaymentController",["$scope","dealerPaymentService","$window","$q",function(n,t,i,r){var u=this;angular.extend(n,i.bootstrap);u.dealerID=$("#DealerPaymentDealerID").val();u.failedSubmit=!1;u.showChargeFailed=!1;u.showCashFailed=!1;u.showCardChargedFailed=!1;u.showAutorenewFailed=!1;u.autorenewFailedRedirectUrl="";u.paymentSuccess=!1;u.cashSuccess=!1;u.paymentType="Card";u.ConfirmationEmail=n.FormData.ConfirmationEmail;u.showSubmitButton=!0;u.dealerAccounts=n.FormData.DealerAccounts;u.billingCompanies=n.FormData.BillingCompanies;u.showCardPayment=function(){return u.paymentType=="Card"};u.showCashPayment=function(){return u.paymentType=="Cash"};u.clearErrors=function(){u.showChargeFailed=!1;u.paymentSuccess=!1};u.cancelPayment=function(n){i.location.href=n};u.changeCollectibleInterest=function(){r.all([t.getBillingCompany(n.FormData.Interest),t.getDealerAccounts(n.FormData.Interest,u.dealerID),]).then(function(n){u.billingCompanies=n[0];u.dealerAccounts=n[1]})};u.processPayments=function(){if(u.clearErrors(),n.form.$invalid){u.failedSubmit=!0;return}n.form.$setPristine(!0);n.form.$submitting=!0;t.processPayment(n.FormData).then(function(n){n.Success&&n.AutorenewSuccess?i.location.href=n.RedirectUrl:u.processErrors(n)}).catch(function(){u.showChargeFailed=!0;u.showCardChargedFailed=!1;n.form.$submitting=!1})};u.processAdminPayments=function(){if(u.clearErrors(),n.form.$invalid){u.failedSubmit=!0;return}n.form.$setPristine(!0);n.form.$submitting=!0;var i={DealerID:u.dealerID,FormData:n.FormData,EmailLanguageCode:u.cardPaymentEmailLanguageCode};t.processAdminPayment(i).then(function(t){t.Success&&t.AutorenewSuccess?(u.paymentSuccess=!0,n.form.$submitting=!1,u.showSubmitButton=!1):u.processErrors(t)},function(){u.showChargeFailed=!0;u.showCardChargedFailed=!1;n.form.$submitting=!1})};u.processAdminCashPayments=function(){if(u.clearErrors(),n.cashform.$invalid){u.failedSubmit=!0;return}n.cashform.$setPristine(!0);n.cashform.$submitting=!0;var i={DealerID:u.dealerID,Payment:u.cashAmount,FormData:n.FormData,ConfirmationEmail:u.ConfirmationEmail,EmailLanguageCode:u.cashPaymentEmailLanguageCode};t.processAdminCashPayment(i).then(function(t){t.Success&&t.AutorenewSuccess?(u.cashSuccess=!0,u.showSubmitButton=!1):u.processErrors(t);n.cashform.$submitting=!1},function(){u.showCashFailed=!0;n.cashform.$submitting=!1})};u.processChangeRenew=function(){if(u.clearErrors(),n.form.$invalid){u.failedSubmit=!0;return}n.form.$setPristine(!0);n.form.$submitting=!0;t.processChangeRenew(n.FormData).then(function(t){t.Success&&t.AutorenewSuccess?i.location.href=t.RedirectUrl:(u.showChargeFailed=!0,u.showCardChargedFailed=!1,n.form.$submitting=!1)},function(){u.showChargeFailed=!0;u.showCardChargedFailed=!1;n.form.$submitting=!1})};u.processAdminChangeRenew=function(){if(u.clearErrors(),n.form.$invalid){u.failedSubmit=!0;return}n.form.$setPristine(!0);n.form.$submitting=!0;var r={DealerID:u.dealerID,FormData:n.FormData};t.processAdminChangeRenew(r).then(function(t){t.Success&&t.AutorenewSuccess?i.location.href=t.RedirectUrl:(u.showChargeFailed=!0,n.form.$submitting=!1)},function(){u.showChargeFailed=!0;n.form.$submitting=!1})};u.processErrors=function(t){t.Success&&!t.AutorenewSuccess?(u.showAutorenewFailed=!0,u.autorenewFailedRedirectUrl=t.RedirectUrl):t.BillingSuccess&&!t.AccountSaveSuccess?(u.showCardChargedFailed=!0,u.cardChargedRedirectUrl=t.RedirectUrl):(u.showChargeFailed=!0,n.form.$submitting=!1)};u.chargeCardFailureRedirect=function(){i.location.href=u.cardChargedRedirectUrl};u.autoRenewFailureRedirect=function(){i.location.href=u.autorenewFailedRedirectUrl};u.redirect=function(n){i.location.href=n};u.validateDiscountCode=function(){n.FormData.DiscountCode="";t.validateCode(u.discountCode).then(function(t){t?(u.codeError=!1,u.hasValidDiscountCode=!0,n.FormData.DiscountCode=u.discountCode,u.discountCode=""):(u.codeError=!0,u.hasValidDiscountCode=!1,n.FormData.DiscountCode="")}).catch(function(){})}}]);angular.module("CCG.Shared").factory("dealerPaymentService",["webServiceFactory",function(n){return n.create({processPayment:function(n){return this.post("/dealers/account/payment/",n)},processAdminPayment:function(n){return this.post("/admin/dealers/payment/",n)},processChangeRenew:function(n){return this.post("/dealers/account/membership-payment/",n)},processAdminChangeRenew:function(n){return this.post("/admin/dealers/autorenew/payment/",n)},processAdminCashPayment:function(n){return this.post("/admin/dealers/cash-payment/",n)},getDealerAccounts:function(n,t){return this.get("/admin/dealers/dealer-account/"+n+"/"+t)},getBillingCompany:function(n){return this.get("/admin/dealers/billing-company/"+n)},validateCode:function(n){return this.get("/dealers/account/api/validate-code/?code="+n)}})}]);angular.module("CCG.Shared").factory("dealerService",["webServiceFactory",function(n){return n.create({getDealerExpirationDetails:function(){return this.get("/dealers/data/expiration-details/")}})}]);angular.module("CCG.Shared").controller("dealerLocatorController",["$timeout","$q","$window","dealerLocatorService","dealerLocatorFaq","urlService","$attrs",function(n,t,i,r,u,f,e){var o=this,s;o.isLoading=!0;o.featuredCities=r.getFeaturedCities(f.tld.toLowerCase());o.featuredStates=r.getFeaturedStates();o.featuredStatesInt=r.getFeaturedStatesInt();o.faqItems=u.getFAQs();s=e.collectibleTypeCode;t.all([r.fetchFeaturedSpecialties(s),r.fetchSpecialties(s),r.fetchServices(s),r.getFeaturedCountriesIntl()]).then(function(n){o.featuredSpecialties=n[0];o.specialties=n[1];o.services=n[2];o.featuredCountriesIntl=n[3]}).finally(function(){o.isLoading=!1;o.splitFaqsColumns()});o.searchLocations=function(){i.location=o.location?"results/?location="+o.location:"results/"};o.splitFaqsColumns=function(){var t=$(".dl-landing__faqs").children(".ccg-full-expander"),i;n(function(){$(window).width()>=1024&&o.wrapFaqs(t)},100);$(window).on("resize",function(){clearTimeout(i);i=setTimeout(function(){$(window).width()>=1024?o.wrapFaqs(t):$(".ccg-full-expander").parent().is(".dl-landing__faqs-col")&&$(".ccg-full-expander").unwrap()},250)})};o.wrapFaqs=function(n){if(!$(".dl-landing__faqs-col").length){$(".dl-landing__faqs").append("<div class='dl-landing__faqs-col' /><div class='dl-landing__faqs-col' />");var i=n.length,t=Math.ceil(i/2);$(n).slice(t).appendTo(".dl-landing__faqs-col:last");$(n).slice(0,t).appendTo(".dl-landing__faqs-col:first")}}}]);angular.module("CCG.Shared").controller("dealerLocatorLocationDetailsController",["$attrs","$q","urlService","dealerLocatorService","dealerLocatorGeocoderService",function(n,t,i,r,u){function o(){var n=document.getElementById("back");console.log(document.referrer);document.referrer?n.setAttribute("href",document.referrer):n.setAttribute("href","/"+f.baseURL+"/results/")}var f=this,e;f.isLoading=!0;f.locationID=parseInt(i.pathParts()[2])||0;f.baseURL=i.pathParts()[0];f.isValidAddress=!1;f.showContactInfo=!1;e=n.collectibleTypeCode;t.all([r.getLocationDetails(f.locationID,e),r.fetchDealerLocationSpecialtiesGroups(f.locationID,e)]).then(function(n){f.location=n[0];f.specialtiesGroups=n[1];f.isValidAddress=f.location.Latitude&&f.location.Longitude;f.showContactInfo=f.location.PhoneNumbers.length>0||f.location.Email||f.location.WebAddress||f.location.SocialMedia.length>0;u.getMap(f.location.Latitude,f.location.Longitude,"map")}).catch(function(n){console.log(n)}).finally(function(){f.isLoading=!1;f.setPageTitle()});f.getHoursDisplay=function(n,t){return t==="Closed"?"Closed":n?n+" - "+t:""};f.cleanUrl=function(n){var t="",i=n.ContactValue;switch(n.ContactType){case"Facebook":t="https://facebook.com/";break;case"Instagram":t="https://instagram.com/";break;case"Twitter":t="https://twitter.com/";n.ContactValue=n.ContactValue.replace("@","");break;case"YouTube":t="https://youtube.com/";break;case"WhatsApp":t="https://api.whatsapp.com/send?phone="}return n.ContactValue.toLowerCase().includes(t)||(i=t+n.ContactValue),i};f.getUserName=function(n){return n?n.replace("@","").split("/").pop():""};f.getCurrentPosition=function(){navigator.geolocation?navigator.geolocation.getCurrentPosition(f.getGoogleMapsDirectionsUrl,f.getGoogleMapsDirectionsUrl):f.getGoogleMapsDirectionsUrl(undefined)};f.getGoogleMapsDirectionsUrl=function(n){var t=0,i=0,r="",u;n&&n.coords&&(t=n.coords.latitude,i=n.coords.longitude,r="saddr="+t+", "+i);u="https://maps.google.com/maps?"+r+"&daddr="+f.location.Latitude+","+f.location.Longitude+"&mode=driving";window.open(u,"_blank")};f.setWebLink=function(n){return n.includes("://")||(n="http://"+n),n};f.setPageTitle=function(){var n=document.title;document.title=f.location.CompanyNoHtml+" | "+n};o()}]);angular.module("CCG.Shared").controller("dealerLocatorResultsController",["$location","$timeout","$q","urlService","dealerLocatorService","dealerLocatorGeocoderService","$attrs",function(n,t,i,r,u,f,e){function c(n){return n?(n instanceof Array||(n=n.split(",")),n):undefined}var o=this,s,h;o.isLoading=!0;o.location=n.search().location||"";o.specialties=c(n.search().specialties);o.services=c(n.search().services);o.totalLocationAmount=0;o.showClearLocationButton=!1;s=e.collectibleTypeCode;h=r.baseUrl;o.searchLocations=function(){o.noResults=!1;o.isLoading=!0;var n=undefined,i=undefined;o.location?(o.showClearLocationButton=!0,f.getGeocoderLocation(o.location).then(function(t){return r.replaceUrl(h,{location:o.location,specialties:o.specialties,services:o.services}),t=t.results[0],t!==undefined?(n=t.geometry.location.lat(),i=t.geometry.location.lng(),u.fetchSearchLocations(n,i,o.specialties,o.services,s).then(function(n){o.locations=n.Locations;o.totalLocationAmount=n.TotalLocationAmount;o.isLoading=!1})):void 0}).catch(function(n){t(function(){n!==google.maps.GeocoderStatus.OK&&(r.replaceUrl(h,{location:o.location,specialties:o.specialties,services:o.services}),o.noResults=!0,o.totalLocationAmount=0);o.isLoading=!1;console.log(n)},100)})):(o.showClearLocationButton=!1,u.fetchSearchLocations(0,0,o.specialties,o.services,s).then(function(n){r.replaceUrl(h,{location:o.location,specialties:o.specialties,services:o.services});o.locations=n.Locations;o.totalLocationAmount=n.TotalLocationAmount;o.isLoading=!1;o.scrollInitMobile()}))};i.all([u.fetchServices(s),u.fetchSpecialtyGroups(s),o.searchLocations(),]).then(function(n){o.servicesComponent=n[0];o.specialtyGroupsComponent=n[1];o.specialties&&_.forEach(o.specialtyGroupsComponent,function(n){_.forEach(n.Specializations,function(n){n.selected=_.some(o.specialties,function(t){return t===n.SeoName.toString()})})});o.services&&_.forEach(o.servicesComponent,function(n){n.selected=_.some(o.services,function(t){return t===n.SeoName.toString()})})}).catch(function(n){console.log(n)});o.filterSpecialties=function(){var n=[];_.forEach(o.specialtyGroupsComponent,function(t){n=n.concat(t.Specializations)});o.specialties=_(n).filter("selected").map("SeoName").value();o.searchLocations()};o.filterServices=function(n){o.services=n;o.searchLocations()};o.clearFilters=function(){o.specialties=undefined;o.services=undefined;_.forEach(o.servicesComponent,function(n){n.selected=!1});_.forEach(o.specialtyGroupsComponent,function(n){_.forEach(n.Specializations,function(n){n.selected=!1})});o.searchLocations();$(".ccg-multiselect-dropbox__option").removeClass("ccg-multiselect-dropbox__option--active");$(".ccg-multiselect-dropbox__list").removeClass("ccg-multiselect-dropbox__list--active")};o.toggleList=function(n){var t=$(n.currentTarget),i=t.next(".ccg-multiselect-dropbox__list");t.hasClass("ccg-multiselect-dropbox__option--active")||($(".dl-filters__option.services .ccg-multiselect-dropbox__option").removeClass("ccg-multiselect-dropbox__option--active"),$(".dl-filters__option.services .ccg-multiselect-dropbox__list").removeClass("ccg-multiselect-dropbox__list--active"));t.toggleClass("ccg-multiselect-dropbox__option--active");i.toggleClass("ccg-multiselect-dropbox__list--active")};o.scrollInitMobile=function(){if($(window).width()<=719){var n=$(".dl-searchbar").offset().top;$("html, body").animate({scrollTop:n})}}}]);angular.module("CCG.Shared").component("ccgMultiselectDropbox",{templateUrl:"/resources/ccg-shared/scripts/ccg.shared/dealers/dealer-locator/components/multiselect-dropbox/multiselect-dropbox.html",bindings:{name:"@",options:"=?",onChange:"&"},controller:["$scope",function(){var n=this;n.$onInit=function(){n.optionsVisible=!1;n.outboundFiltersClick()};n.sendSelectedItems=function(){var t=_(n.options).filter("selected").map("SeoName").value();n.onChange&&n.onChange()(t)};n.toggleList=function(n){var t=$(n.currentTarget),i=t.next(".ccg-multiselect-dropbox__list");!t.hasClass("ccg-multiselect-dropbox__option--active")&&t.parents(".dl-filters__option").hasClass("services")&&($(".dl-filters__option.specialties .ccg-multiselect-dropbox__option").removeClass("ccg-multiselect-dropbox__option--active"),$(".dl-filters__option.specialties .ccg-multiselect-dropbox__list").removeClass("ccg-multiselect-dropbox__list--active"));t.parents("ccg-multiselect-dropbox").siblings().find(".ccg-multiselect-dropbox__option").removeClass("ccg-multiselect-dropbox__option--active");t.parents("ccg-multiselect-dropbox").siblings().find(".ccg-multiselect-dropbox__list").removeClass("ccg-multiselect-dropbox__list--active");t.toggleClass("ccg-multiselect-dropbox__option--active");i.toggleClass("ccg-multiselect-dropbox__list--active")};n.outboundFiltersClick=function(){$(document).click(function(n){$(n.target).parents(".ccg-multiselect-dropbox").length||($(".ccg-multiselect-dropbox__option").removeClass("ccg-multiselect-dropbox__option--active"),$(".ccg-multiselect-dropbox__list").removeClass("ccg-multiselect-dropbox__list--active"))})}}]});angular.module("CCG.Shared").provider("dealerLocatorFaq",[function(){var n=this;this.baseFaqItems=[];this.setFAQs=function(t){n.baseFaqItems=t.filter(function(n){return n.question})};this.$get=[function(){return{getFAQs:function(){return n.baseFaqItems}}}]}]);angular.module("CCG.Shared").factory("dealerLocatorGeocoderService",[function(){return{getGeocoderLocation:function(n){if(n!==undefined&&n!==""){var t=new google.maps.Geocoder;return t.geocode({address:n,componentRestrictions:{country:n=="90210"?"US":undefined}})}},getMap:function(n,t,i,r){r||(r=13);var u={lat:n,lng:t},f=new google.maps.Map(document.getElementById(i),{zoom:r,center:u}),e=new google.maps.Marker({position:u,map:f})}}}]);angular.module("CCG.Shared").factory("dealerLocatorService",["webServiceFactory",function(n){return n.create({getFeaturedCities:function(n){switch(n){case"com":return[{name:"New York City"},{name:"Los Angeles"},{name:"Chicago"},{name:"Philadelphia"},{name:"Dallas"},{name:"San Diego"},{name:"Phoenix"},{name:"Baltimore"},{name:"Jacksonville"},{name:"Houston"},{name:"San Francisco"},{name:"Denver"},{name:"Las Vegas"},{name:"Atlanta"},{name:"Tucson"},];case"uk":return[{name:"York"},{name:"Edinburgh"},{name:"London"},{name:"Cambridge"},{name:"Oxford"},{name:"Brighton"},{name:"Liverpool"},{name:"Manchester"},{name:"Exeter"},{name:"Bristol"},{name:"Southend on Sea"},{name:"Whitehaven"},{name:"Cardiff"},{name:"Glasgow"},]}},getFeaturedStates:function(){return[{name:"Alabama"},{name:"Alaska"},{name:"Arizona"},{name:"Arkansas"},{name:"California"},{name:"Colorado"},{name:"Connecticut"},{name:"Delaware"},{name:"Florida"},{name:"Georgia"},{name:"Hawaii"},{name:"Idaho"},{name:"Illinois"},{name:"Indiana"},{name:"Iowa"},{name:"Kansas"},{name:"Kentucky"},{name:"Louisiana"},{name:"Maine"},{name:"Maryland"},{name:"Massachusetts"},{name:"Michigan"},{name:"Mississippi"},{name:"Missouri"},{name:"Montana"},{name:"Nebraska"},{name:"Nevada"},{name:"New Hampshire"},{name:"New Jersey"},{name:"New Mexico"},{name:"New York"},{name:"North Carolina"},{name:"North Dakota"},{name:"Ohio"},{name:"Oklahoma"},{name:"Oregon"},{name:"Pennsylvania"},{name:"Rhode Island"},{name:"South Carolina"},{name:"South Dakota"},{name:"Tennessee"},{name:"Texas"},{name:"Utah"},{name:"Vermont"},{name:"Virginia"},{name:"Washington"},{name:"West Virginia"},{name:"Wisconsin"},{name:"Wyoming"},]},getFeaturedCountriesIntl:function(){return this.get("/dealer-locator/api/featured-countries/")},getFeaturedStatesInt:function(){return[]},fetchFeaturedSpecialties:function(n){return this.get("/dealer-locator/api/featured-specialties/",{collectibleTypeCode:n})},fetchSpecialties:function(n){return this.get("/dealer-locator/api/specialties/",{collectibleTypeCode:n})},fetchServices:function(n){return this.get("/dealer-locator/api/services/",{collectibleTypeCode:n})},fetchSearchLocations:function(n,t,i,r,u){var f="",e="";return i?_.forEach(i,function(n){e+="&specialties="+n}):i="",r&&r.length?_.forEach(r,function(n){f+="&services="+n}):r="",this.get("/dealer-locator/api/search/?lat="+n+"&lon="+t+e+f+"&collectibleTypeCode="+u)},fetchSpecialtyGroups:function(n){return this.get("/dealer-locator/api/specialty-groups/",{collectibleTypeCode:n})},getLocationDetails:function(n,t){return this.get("/dealer-locator/api/location/"+n+"/",{collectibleTypeCode:t})},fetchDealerLocationSpecialtiesGroups:function(n,t){return this.get("/dealer-locator/api/location/specialties/"+n+"/",{collectibleTypeCode:t})}})}]);angular.module("CCG.Shared").controller("dealerLocationsEditController",["$q","$scope","$timeout","$window","urlService","countryStateService","dealerLocationsService","dealerLocatorGeocoderService",function(n,t,i,r,u,f,e,o){function y(){if(!s.dealerLocation.TimeZone){var n=v();t.$broadcast("angucomplete-alt:changeInput","tz",n);s.dealerLocation.TimeZone=n}}function p(){if(!s.dealerLocation||!s.dealerLocation.Country)return!0;var n=function(){s.selectedState=_(s.stateList).filter({Abbreviation:s.dealerLocation.State}).first()};s.selectedCountry=_(s.countryList).filter(function(n){return s.dealerLocation.Country===n.Name||s.dealerLocation.Country===n.DisplayName}).first();s.changeCountry(n)}function a(){return _.filter(s.dealerPhones,"ContactValue").concat(_.filter(s.dealerEmails,"ContactValue")).concat(_.filter(s.dealerSocialMedia,"ContactValue"))}function w(){if(!c)return null;var n=_(a()).filter("DealerContactMethodID").map("DealerContactMethodID").value();return _(c).filter("DealerContactMethodID").filter(function(t){return _.indexOf(n,t.DealerContactMethodID)===-1}).value()}function b(){var n=[];return _.forEach(s.collectibles,function(t){_.forEach(t.componentSpecialties,function(t){n=n.concat(t.Specializations)})}),_.filter(n,function(n){return n.ID!==0||!n.IsDisabled})}function k(){var n=[];return _.forEach(s.collectibles,function(t){n=n.concat(t.componentServices)}),_.filter(n,function(n){return n.ID!==0||!n.IsDisabled})}function d(){return _.filter(s.dealerMemberships,function(n){return n.DealerLocationMembershipID!==0||!n.IsDisabled})}function v(){var n=moment.tz.guess();return"(GMT"+moment.tz(n).format("Z")+") "+n}function g(){s.clearAddress&&(s.dealerLocation.DealerLocationID=0,s.dealerLocation.Address1="",s.dealerLocation.Address2="",s.dealerLocation.City="",s.dealerLocation.Description="",s.dealerLocation.State="",s.dealerLocation.Zip="",s.dealerLocation.TimeZone=v(),s.dealerLocation.Image="",s.dealerLocation.OpenSunday="",s.dealerLocation.CloseSunday="",s.dealerLocation.OpenMonday="",s.dealerLocation.CloseMonday="",s.dealerLocation.OpenTuesday="",s.dealerLocation.CloseTuesday="",s.dealerLocation.OpenWednesday="",s.dealerLocation.CloseWednesday="",s.dealerLocation.OpenThursday="",s.dealerLocation.CloseThursday="",s.dealerLocation.OpenFriday="",s.dealerLocation.CloseFriday="",s.dealerLocation.OpenSaturday="",s.dealerLocation.CloseSaturday="",s.dealerPhones=[{ContactType:"Main"}],s.dealerEmails=[{}],_.forEach(s.dealerSocialMedia,function(n){n.DealerContactMethodID=0;n.DealerLocationID=0}))}function nt(){return _.some(s.dealerMemberships,{errorInExpirationDate:!0})||_.some(s.dealerMemberships,{errorInAnaNumber:!0})}function tt(){return!s.dealerLocation.IsNGC&&!s.dealerLocation.IsPMG&&!s.dealerLocation.IsCGC&&!s.dealerLocation.IsCTC&&!s.dealerLocation.IsCSG}function it(){return[s.dealerLocation.Address1,s.dealerLocation.Address2,s.dealerLocation.City,s.dealerLocation.State,s.dealerLocation.Zip,s.dealerLocation.Country].filter(Boolean).join(" ")}function rt(){return h===undefined||s.dealerLocation.Address1!==h.Address1||s.dealerLocation.Address2!==h.Address2||s.dealerLocation.City!==h.City||s.dealerLocation.State!==h.State||s.dealerLocation.Zip!==h.Zip}function l(n,t){t&&(n!==undefined?(s.dealerLocation.Latitude=n.geometry.location.lat(),s.dealerLocation.Longitude=n.geometry.location.lng()):(s.dealerLocation.Latitude=undefined,s.dealerLocation.Longitude=undefined));var i={DealerLocation:_.omitBy(s.dealerLocation,_.isNull),ContactMethods:a(),RemoveContactMethods:w(),DealerLocationMemberships:d(),DealerLocationSpecialties:b(),DealerLocationServices:k()};s.selectedCountry&&(i.DealerLocation.Country=s.countryName(s.selectedCountry),i.DealerLocation.CountryID=s.selectedCountry.CountryID);s.stateList!==undefined&&s.stateList.length>0?(i.DealerLocation.State=s.selectedState.Abbreviation,i.DealerLocation.StateID=s.selectedState.StateID):i.DealerLocation.State=undefined;e.submitLocation(i,s.newLogoAvatarImage).then(function(n){n.data.Success?r.location="/dealers/locations/":(s.errorMessage="There was an issue with processing the location information. Please try again later.",s.isLoading=!1)}).catch(function(){s.errorMessage="There was an issue with processing the location information. Please try again later.";s.isLoading=!1})}var s=this,c,h;s.isLoading=!0;s.daysOfWeek=e.getDaysOfWeek();s.collectibles=e.getCollectiblesTypes();s.dealerLocationID=parseInt(u.pathParts()[3])||0;s.clearAddress=u.pathParts()[2].toLowerCase()==="copy"&&s.dealerLocationID!==0;n.all([e.fetchSocialMediaPlatforms(),e.fetchTimeZones(),e.fetchHours(),e.getDealerLocation(s.dealerLocationID),e.fetchContactMethods("phone",s.dealerLocationID),e.fetchContactMethods("email",s.dealerLocationID),e.fetchContactMethods("social",s.dealerLocationID),e.fetchDealerMemberships(s.dealerLocationID),f.fetchCountries()]).then(function(n){s.socialMediaPlatforms=n[0];s.timeZones=n[1];s.hours=n[2];s.dealerLocation=n[3];s.dealerPhones=n[4]||[{ContactType:"Main"}];s.dealerEmails=n[5]||[{}];s.dealerSocialMedia=n[6]||[{}];s.dealerMemberships=n[7];s.countryList=n[8];u.tld.toLowerCase()==="com"&&(s.countryList=s.countryList.sort(function(n){return n.Name==="United States"?-1:1}));s.dealerPhones.length===0&&(s.dealerPhones=[{}]);s.dealerEmails.length===0&&(s.dealerEmails=[{}]);s.dealerSocialMedia.length===0?(s.dealerSocialMedia=[{}],s.availablePlatforms()):s.initAvailablePlatforms();s.dealerLocation===null&&(s.dealerLocation={VisibleOnLocator:!0});c=s.dealerPhones.concat(s.dealerEmails,s.dealerSocialMedia);p();s.refreshAvailablePlatforms();y();g();s.dealerSocialMedia&&_.forEach(s.dealerSocialMedia,function(n){s.prefillSocialMedia(n)})}).catch(function(n){console.log(n)}).finally(function(){s.isLoading=!1});s.changeCountry=function(n){s.selectedCountry&&f.fetchStatesForCountryByCountryCode(s.selectedCountry.CountryCode).then(function(t){s.stateList=t;n&&n()}).catch(function(n){console.log(n)})};s.removeItem=function(n,t,i,r){n.preventDefault();n.stopPropagation();t.length>1&&(t=t.splice(i,1),r&&r())};s.addItem=function(n,t,i,r){n.preventDefault();n.stopPropagation();t.length<i&&(t.push({}),r&&r())};s.hasRepeatedPlatform=function(){var n=!1,t=_.map(s.dealerSocialMedia,"ContactType"),i=_.reduce(t,function(n,t){return n[t]=n[t]+1||1,n},{});return _.forEach(s.socialMediaPlatforms,function(t){i[t]>1&&(n=!0)}),n};s.preventCheckout=function(){return s.dealerLocation!==undefined&&(tt()||s.hasRepeatedPlatform()||nt())};s.submit=function(){if(t.form.$invalid||s.preventCheckout())return!1;var n=rt();s.isLoading=!0;n?o.getGeocoderLocation(it()).then(function(t){l(t.results[0],n)}).catch(function(t){i(function(){t.code&&t.code=="ZERO_RESULTS"?l(undefined,n):(s.errorMessage="There was an issue with processing the location information. Please try again later.",s.isLoading=!1)},100)}):l(undefined,n)};s.initAvailablePlatforms=function(){_.forEach(s.dealerSocialMedia,function(n){n.availablePlatforms=s.socialMediaPlatforms})};s.refreshAvailablePlatforms=function(n){var t=_.map(s.dealerSocialMedia,"ContactType");_.forEach(s.dealerSocialMedia,function(n){n.availablePlatforms=_.filter(s.socialMediaPlatforms,function(n){return _.indexOf(t,n)===-1});n.ContactType!==undefined&&n.availablePlatforms.push(n.ContactType)});n&&s.prefillSocialMedia(n)};s.availablePlatforms=function(){var n=_.map(s.dealerSocialMedia,"ContactType");_.last(s.dealerSocialMedia).availablePlatforms=_.filter(s.socialMediaPlatforms,function(t){return _.indexOf(n,t)===-1})};s.deleteLocation=function(){s.showConfirmDeleteLocationModal=!1;s.isLoading=!0;e.deleteLocation(s.dealerLocationID).then(function(n){n&&n.Success?r.location="/dealers/locations/":(s.errorMessage="There was an issue when deleting the location information. Please try again later.",s.isLoading=!1)}).catch(function(){s.errorMessage="There was an issue when deleting the location information. Please try again later.";s.isLoading=!1})};s.selectedTimeZone=function(n){s.dealerLocation.TimeZone=n?n.title:""};s.countryName=function(n){return n.DisplayName?n.DisplayName:n.Name};s.validateHours=function(n){var f=n.indexOf("Open")>=0?n:"Open"+n.substr(5),r=s.dealerLocation[f],o=s.hours.indexOf(r),e="Close"+f.substr(4),u=s.dealerLocation[e],h=s.hours.indexOf(u),i=!0;r==undefined||u==undefined?i=!1:r=="Closed"||u=="Closed"?r!=u&&(i=!1):o>=h&&(i=!1);t.form[f].$setValidity("valid",i);t.form[e].$setValidity("valid",i)};s.prefillSocialMedia=function(n){switch(n.ContactType){case"Facebook":n.PrefillValue="https://www.facebook.com/";break;case"YouTube":n.PrefillValue="https://www.youtube.com/";break;case"Twitter":n.PrefillValue="@";break;case"Instagram":n.PrefillValue="https://instagram.com/";break;case"WhatsApp":n.PrefillValue=""}}}]);angular.module("CCG.Shared").controller("dealerLocationsListController",["dealerLocationsService",function(n){var t=this;t.isLoading=!0;t.collectibles=n.getCollectiblesTypes();n.fetchDealerLocations().then(function(n){t.locations=n}).catch(function(n){console.log(n)}).finally(function(){t.isLoading=!1})}]);angular.module("CCG.Shared").factory("dealerLocationsService",["Upload","webServiceFactory",function(n,t){var i=["Facebook","Instagram","WhatsApp","Twitter","YouTube"];return t.create({getCollectiblesTypes:function(){return[{name:"Coins",column:"IsNGC",tag:"NGC",type:"Coin"},{name:"Banknotes",column:"IsPMG",tag:"PMG",type:"Note"},{name:"Comics",column:"IsCGC",tag:"CGC",type:"Comic"},{name:"Trading Cards",column:"IsCTC",tag:"CTC",type:"Trading Card"},{name:"Sports Cards",column:"IsCSG",tag:"CSG",type:"Sports Card"}]},getDaysOfWeek:function(){return[{name:"Monday",localizedName:moment().locale(CCG.culture)._locale._weekdays[1],openColumn:"OpenMonday",closeColumn:"CloseMonday"},{name:"Tuesday",localizedName:moment().locale(CCG.culture)._locale._weekdays[2],openColumn:"OpenTuesday",closeColumn:"CloseTuesday"},{name:"Wednesday",localizedName:moment().locale(CCG.culture)._locale._weekdays[3],openColumn:"OpenWednesday",closeColumn:"CloseWednesday"},{name:"Thursday",localizedName:moment().locale(CCG.culture)._locale._weekdays[4],openColumn:"OpenThursday",closeColumn:"CloseThursday"},{name:"Friday",localizedName:moment().locale(CCG.culture)._locale._weekdays[5],openColumn:"OpenFriday",closeColumn:"CloseFriday"},{name:"Saturday",localizedName:moment().locale(CCG.culture)._locale._weekdays[6],openColumn:"OpenSaturday",closeColumn:"CloseSaturday"},{name:"Sunday",localizedName:moment().locale(CCG.culture)._locale._weekdays[0],openColumn:"OpenSunday",closeColumn:"CloseSunday"}]},fetchDealerLocations:function(){return this.get("/dealers/locations/api/locations/")},getDealerLocation:function(n){return this.get("/dealers/locations/api/location/"+n+"/")},fetchSocialMediaPlatforms:function(){return i},fetchTimeZones:function(){return _.map(moment.tz.names(),function(n){return{name:"(GMT"+moment.tz(n).format("Z")+") "+n.replace("_"," ")}},[])},fetchHours:function(){return this.get("/dealers/locations/api/hours/")},fetchContactMethods:function(n,t){return this.get("/dealers/locations/api/contact-methods/"+n+"/"+t+"/")},fetchDealerMemberships:function(n){return this.get("/dealers/locations/api/dealer-memberships/"+n+"/")},submitLocation:function(t,i){var r=_.merge({image:i},t);return n.upload({method:"POST",url:"/dealers/locations/api/location-info/",data:_.omitBy(r,_.isNull)})},fetchDealerLocationServices:function(n,t){return this.get("/dealers/locations/api/services/"+n+"/"+t+"/")},fetchDealerLocationSpecialties:function(n,t){return this.get("/dealers/locations/api/specialties/"+n+"/"+t+"/")},deleteLocation:function(n){return this.post("/dealers/locations/api/location/"+n+"/delete/")}})}]);angular.module("CCG.Shared").component("ccgServicesAndSpecialties",{templateUrl:"/dealers/locations/templates/services-and-specialties/",bindings:{name:"@",type:"@",dealerLocationId:"@",visible:"<",clearAddress:"<",specialties:"=?",services:"=?",dealerMemberships:"=?"},controller:["$scope","$q","$timeout","dealerLocationsService",function(n,t,i,r){function f(){u.clearAddress&&(_.forEach(u.specialties,function(n){n.ID=0;n.DealerLocationID=0}),_.forEach(u.services,function(n){n.ID=0;n.DealerLocationID=0}),_.forEach(u.dealerMemberships,function(n){n.DealerLocationMembershipID=0;n.DealerLocationID=0;n.IsDisabled=!0}))}var u=this;u.$onInit=function(){u.services=undefined;t.all([r.fetchDealerLocationSpecialties(u.type,u.dealerLocationId),r.fetchDealerLocationServices(u.type,u.dealerLocationId),]).then(function(n){u.specialties=n[0];u.services=n[1];f();_.forEach(u.dealerMemberships,function(n){n.MembershipExpirationDate&&(n.MembershipExpirationDate=new Date(moment(n.MembershipExpirationDate).format("L")))})}).catch(function(n){console.log(n)})};u.validateSpecializations=function(n){u.showSpecializationsErrorMessage=!1;var t=_(u.specialties).map("Specializations").reduce(function(n,t){return n.concat(t)}).filter(function(n){if(!n.IsDisabled)return n}).length;t>6&&(n.IsDisabled=!0,u.showSpecializationsErrorMessage=!0)};u.showMemberships=function(){return u.name==="Coin"||u.name==="Note"};u.showErrorMessage=function(n,t){return!n&&angular.element("#"+t+u.name).hasClass("ng-touched")}}]});angular.module("CCG.Shared").controller("eventsController",["eventsService","countryStateService","urlService","preselectedEventFilters",function(n,t,i,r){var u=this;u.initialized=!1;u.filter={hasTagFilter:!1,tags:{}};_.isArrayLike(r)&&r.length>0&&(_.forEach(r,function(n){u.filter.tags[n]=!0}),u.filter.hasTagFilter=!0,i.replaceUrl(i.path()));n.fetchEvents().then(function(n){u.initialized=!0;u.tags=n.Tags;u.months=n.Months;u.eventsByMonth=n.EventsByMonth;u.countries=n.Countries});u.changeCountry=function(){t.fetchStatesForCountryByID(u.filter.countryID).then(function(n){u.states=n})};u.clearFilter=function(){u.filter={hasTagFilter:!1,tags:{}}};u.filterBy=function(n){u.filter.tags[n]=!u.filter.tags[n];u.filter.hasTagFilter=!1;for(var t in u.filter.tags)if(u.filter.tags[t]){u.filter.hasTagFilter=!0;break}};u.filterMonth=function(n){var t=!0,i;return u.filter.includePastEvents||(i=moment().startOf("month"),t=moment(n.Date).isSameOrAfter(i)),t&&u.filter.month&&(t=n.Display===u.filter.month.Display),t};u.filterEvent=function(n){var t=!0,i,r;return u.filter.countryID&&(t=n.CountryID===u.filter.countryID),t&&u.filter.stateID&&(t=n.StateID===u.filter.stateID),t&&u.filter.hasTagFilter&&(t=n.Tags.some(function(n){return!!u.filter.tags[n.EventTagID]})),t&&!u.filter.includePastEvents&&(i=moment(n.EndDate),r=moment().startOf("month"),t=i.isSameOrAfter(r)),t};u.checkNoEvents=function(){return _.every(u.filteredMonths,function(n){return!n.filteredEvents||!n.filteredEvents.length})}}]);angular.module("CCG.Shared").factory("eventsService",["webServiceFactory",function(n){return n.create({fetchEvents:function(){return this.get("/submit/events/data/events/")}})}]);angular.module("CCG.Shared").filter("collectibleTerm",["orderformCartService",function(n){return function(t,i){var r=n.collectibleServices[i];return t===1?r.collectibleTermSingular:r.collectibleTermPlural}}]);angular.module("CCG.Shared").filter("creditcard",[function(){return function(n){var t=n||"";return t.length===0?t:(t=t.replace(/[^0-9]/g,""),t=t[0]=="3"?t.replace(/(\d{4})(\d{0,6})(\d{0,5})(?:.*)/,"$1 $2 $3"):t.replace(/(\d{4})(\d{0,4})(\d{0,4})(\d{0,4})(?:.*)/,"$1 $2 $3 $4"),t.trim())}}]);angular.module("CCG.Shared").filter("dateLocalize",[function(){return function(n,t){if(!n)return"";var i=null,r=_.get(t,"tld")||CCG.tld;switch(r){case"uk":i="en-GB";break;case"de":i="de-DE";break;default:i="en-US"}return typeof n!="object"&&(n=new Date(n)),n.toLocaleDateString(i)}}]);angular.module("CCG.Shared").filter("localize",["translationDictionary",function(n){function t(n,t){return n.replace(/{(\d+)}/g,function(n,i){return typeof t[i]!="undefined"?t[i]:n})}return function(i,r){var u=_.get(n,i);return u&&r&&(u=t(u,r)),u||(u="[["+i+"]]"),u}}]);angular.module("CCG.Shared").filter("numberLocalizer",[function(){return function(n,t){var r=_.get(t,"decimalPlaces"),i=null;switch(CCG.tld){case"de":i="de-DE";break;case"uk":i="en-GB";break;default:i="en-US"}return n?n.toLocaleString(i,{minimumFractionDigits:r}):n}}]);angular.module("CCG.Shared").filter("phoneFormat",[function(){function t(t){var i=t?t.toString().replace(/\D/g,""):"",u="",r,f;return i.length>10&&(u="+"+i.substring(0,i.length-10)+" ",i=i.substring(i.length-10,i.length)),r=n.exec(i),f=r?(r[1]?"("+r[1]+") ":"")+r[2]+"-"+r[3]:i,u+f}var n=/^(\d{3})?(\d{3})(\d{4})$/;return function(n){if(n)try{var i=libphonenumber.parsePhoneNumber(n);return i.country=="US"?i.formatNational():i.formatInternational()}catch(r){return t(n)}}}]);angular.module("CCG.Shared").filter("replaceWith",function(){return function(n,t,i){return n===t?i:n}});angular.module("CCG.Shared").filter("singleLine",[function(){return function(n){return n=n||"",n.replace(/\s/g," ")}}]);angular.module("CCG.Shared").filter("truncate",[function(){return function(n,t,i){return n=n||"",i=i||"...",t=parseInt(t)||n.length,n.length<=t?n:n.substring(0,t)+i}}]);angular.module("CCG.Shared").filter("trustedHtml",["$sce",function(n){return function(t){return n.trustAsHtml(t)}}]);angular.module("CCG.Shared").filter("usCurrency",["$filter","urlService",function(n,t){return function(i){if(_.isNil(i))return"";switch(t.tld){case"de":return Intl.NumberFormat("de-DE",{minimumFractionDigits:2}).format(i)+" US $";default:return n("currency")(i,t.tld=="com"?"$":"US $")}}}]);angular.module("CCG.Shared").controller("galleryController",["$attrs","$q","$scope","galleryService","urlService",function(n,t,i,r,u){function e(){if(f.filtersLoaded){var n=(new URI).search(!0);if(_.isEmpty(n))return;f.filters=n;t.all([r.fetchItems(f.galleryID,f.filters),r.getFilterLists(f.galleryID,f.filters),]).then(function(n){n[0].Items.forEach(function(n){n.url=u.baseUrl+n.CoinGalleryItemID+"/"});f.dropdownFilters=_.filter(n[1],{IsCheckbox:!1});f.gallery=n[0];f.loaded=!0})}}var f=this;f.galleryID=n.galleryId;f.filters=(new URI).search(!0);f.filterLists=[];f.loaded=!1;t.all([r.getGallery(f.galleryID),r.getFilterLists(f.galleryID,f.filters)]).then(function(n){var t;f.filtersLoaded=!0;f.showAltImages=n[0].ShowAltImages;f.imageLabel=n[0].ImageLabel;f.altImageLabel=n[0].AltImageLabel;f.dropdownFilters=_.filter(n[1],{IsCheckbox:!1});f.checkboxFilters=_.filter(n[1],{IsCheckbox:!0});f.checkboxFilters.forEach(function(n){n.yesValue=_.find(n.Options,{Name:"Yes"}).CoinGalleryFilterOptionID});f.inclusiveCheckboxFilters=_.filter(f.checkboxFilters,{IsInclusive:!0});t=!0;f.inclusiveCheckboxFilters.length&&(t=f.checkboxFilters.some(function(n){return f.filters[n.Name]}));t?e():(f.checkboxFilters.forEach(function(n){f.filters[n.Name]=n.yesValue}),f.refreshGallery())});f.resetFilters=function(){f.filters={};for(var n=1;n<f.dropdownFilters.length;n++)f.dropdownFilters[n].Options=[];f.refreshGallery()};f.changeFilter=function(n){for(var t=n+1;t<f.dropdownFilters.length;t++)delete f.filters[f.dropdownFilters[t].Name];f.refreshGallery()};f.refreshGallery=function(){f.changePage(1)};f.changePage=function(n){f.filters.page=(n||"1").toString();u.replaceUrl(u.baseUrl,f.filters)};i.$on("$locationChangeSuccess",e);f.filters.page=f.filters.page||"1";u.replaceUrl(u.baseUrl,f.filters)}]);angular.module("CCG.Shared").factory("graderNotesService",["webServiceFactory",function(n){return n.create({fetchGraderNotes:function(n){return this.get("/certlookup/data/"+n+"/grader-notes/")}})}]);angular.module("CCG.Shared").directive("graderNotes",function(){return{scope:{certNum:"@",canViewGraderNotes:"@"},transclude:!0,controllerAs:"$ctrl",controller:["$scope","$rootScope","$element","$transclude",function(n,t,i,r){var u=this;r(n,function(n){i.append(n)});u.userOwnsNotes=!1}]}});angular.module("CCG.Shared").directive("affiliateCodeValidator",["$q","joinService",function(n,t){return{require:"ngModel",link:function(i,r,u,f){f.$asyncValidators.affiliateCode=function(i){return i?t.validateAffiliateCode(i).then(function(t){return t?n.resolve(!0):n.reject()}):n.resolve()}}}}]);angular.module("CCG.Shared").controller("autorenewController",["$scope","$window","$timeout","joinService",function(n,t,i,r){n=angular.extend(n,t.bootstrap);n.cache={CardNumber:n.FormData.CreditCard.CardNumber,AutorenewAccount:n.FormData.AutorenewAccount};n.modal={showAutorenewDetails:!1,showAutorenewEnabled:!1,showAutorenewDisabled:!1,showConfirmDisableAutorenew:!1};n.events={processAutorenew:function(){if(!n.form.$invalid){n.form.$submitting=!0;n.events.clearResults();var t=r.processAutorenew(n.FormData).then(function(t){t.Success?(n.HasSavedCard=t.Autorenew===!0,n.CardNumber=t.CardNumber,n.CardExpiration=t.CardExpiration,n.modal.showAutorenewEnabled=t.Autorenew===!0,n.modal.showAutorenewDisabled=t.Autorenew===!1,n.FormData.CreditCard=undefined,n.ShowChangeCard=!1):(n.HasSavedCard=!1,n.showFailure=!0)},function(){n.showFailure=!0});t["finally"](function(){n.form.$submitting=!1;n.modal.showConfirmDisableAutorenew=!1;n.cache.AutorenewAccount=n.FormData.AutorenewAccount})}},confirmDisableAutorenew:function(t){n.FormData.AutorenewAccount=!1;n.events.processAutorenew(t)},clearResults:function(){n.modal.showAutorenewEnabled=!1;n.modal.showAutorenewDisabled=!1;n.showFailure=!1},changeCard:function(){n.ShowChangeCard=!0}};n.$watch("FormData.AutorenewAccount",function(t,r){t||!n.cache.AutorenewAccount||n.modal.showConfirmDisableAutorenew||(n.FormData.AutorenewAccount=!0,t!=r&&(n.modal.showConfirmDisableAutorenew=!0));t!=r&&i(function(){t==!0?n.FormData.CreditCard.CardNumber=n.cache.CardNumber:n.cache.CardNumber=n.FormData.CreditCard.CardNumber},0)})}]);angular.module("CCG.Shared").controller("autorenewErrorController",["$window","joinService",function(n,t){var i=this;i.showConfirmAutorenewRemovalModal=!1;i.cancelAutorenew=function(){t.cancelAutorenew().then(function(t){t?n.location.href="/":i.cancelAutorenewFailed=!0})}}]);angular.module("CCG.Shared").controller("billingController",["$scope","$window","joinService","translationDictionary",function(n,t,i,r){angular.extend(n,t.bootstrap);n.currentDate=new Date;n.anaMaxExpirationDate=new Date("2199-01-02");n.events={clearExpDate:function(){n.FormData.ANA.IsLifetimeMember&&(n.FormData.ANA.ExpirationDate=null)},clearErrors:function(){n.showChargeFailed=!1;n.invalidCode=!1},applyDiscount:function(t,u){(t=t||n.discountCode,u||t&&t!=="")&&i.fetchDiscount(n.FormData.TierName,n.JoinMode,t,u).then(function(i){i?(u||(n.currentDiscount="("+r.Terms.DiscountApplied.replace("CODE",'"'+t+'"')+")"),n.discountPrice=i.Rate>n.price?"0.00":n.price-i.Rate,n.FormData.DiscountCode=t,n.discountCode=null,n.nonEmptyCode=!1,n.invalidCode=!1,n.discountForm.DiscountCode&&n.discountForm.DiscountCode.$setValidity("discountCode",!0)):(n.FormData.DiscountCode=null,n.invalidCode=!0,n.discountForm.DiscountCode&&n.discountForm.DiscountCode.$setValidity("discountCode",!1))})},discountCodeChanged:function(){n.nonEmptyCode=n.discountCode===""||n===null?!1:!0;n.discountForm.DiscountCode.$setValidity("discountCode",!0);n.discountFailedSubmit=!1;n.invalidCode=!1},processBilling:function(){if(n.events.clearErrors(),n.form.$invalid||n.invalidCode||n.nonEmptyCode){n.failedSubmit=!0;(n.invalidCode||n.nonEmptyCode)&&(n.discountFailedSubmit=!0);return}n.form.$setPristine(!0);n.form.$submitting=!0;var r=i.processBilling(n.FormData).then(function(i){i.Success&&i.AutorenewSuccess?t.location.href=i.RedirectUrl:i.Success&&!i.AutorenewSuccess?(n.showAutorenewFailed=!0,n.autorenewFailedRedirectUrl=i.RedirectUrl):i.BillingSuccess&&!i.AccountSaveSuccess?(n.showCardChargedFailed=!0,n.cardChargedRedirectUrl=i.RedirectUrl):i.IsANANumberInUse?(n.showANANumberInUse=!0,n.form.$submitting=!1):(n.showChargeFailed=!0,n.form.$submitting=!1)},function(){n.showChargeFailed=!0;n.showCardChargedFailed=!1;n.form.$submitting=!1})},redirect:function(n){t.location.href=n},copyBillingToShipping:function(){n.FormData.IsAddressSync&&(n.FormData.ShippingAddress.Address1=n.FormData.CreditCard.StreetAddress1,n.FormData.ShippingAddress.Address2=n.FormData.CreditCard.StreetAddress2,n.FormData.ShippingAddress.City=n.FormData.CreditCard.City,n.FormData.ShippingAddress.ZipCode=n.FormData.CreditCard.ZipCode,n.$broadcast("billingForm.syncAddresses"))}};n.$on("billingForm.addressFieldChanged",function(){n.FormData.IsAddressSync=!1})}]);angular.module("CCG.Shared").controller("createAccountController",["$scope","joinService",function(n,t){n=angular.extend(n,window.bootstrap);n.events={createAccount:function(){function i(){n.showErrorMessage=!0}if(n.showErrorMessage=!1,!n.form.$invalid){CCG.showRecaptcha&&(n.FormData["g-recaptcha-response"]=grecaptcha.getResponse(n.recaptchaWidgetId));n.form.$submitting=!0;var r=t.createAccount(n.FormData).then(function(t){t.RedirectUrl?(n.redirectUrl=t.RedirectUrl,n.FormData.TierName=="free"?n.events.redirect():n.events.displayModal(!0)):i()},i);r["finally"](function(){n.form.$submitting=!1})}},displayModal:function(t){n.showModal=t},redirect:function(){window.location.href=n.redirectUrl}};n.$on("recaptcha.ready",function(){angular.element("#create_account_captcha").length&&(n.recaptchaWidgetId=grecaptcha.render("create_account_captcha",{sitekey:CCG.recaptchaSiteKey}))})}]);angular.module("CCG.Shared").controller("creditCardController",["$scope","countryStateService",function(n,t){function u(){var t=_.head(_.filter(n.CreditCardCountryList,{CountryID:n.FormData.CreditCard.CountryID})),r=t&&t.ZipCodeRegex&&t.ZipCodeRegex!=""?!0:!1;i.ZipCodeRegex=new RegExp(r?t.ZipCodeRegex:/^[\w]+[\s]{0,1}[\w]+$/);i.RequireZipCode=r;n.$parent.form.CardZipCode.$setViewValue(n.$parent.form.CardZipCode.$viewValue)}var i=this,r=!1;t.fetchCountries().then(function(t){_.each(t,function(n){n.CountryID=n.CountryID.toString()});n.CreditCardCountryList=t});n.$watch("FormData.CreditCard.CountryID",function(f){u();i.changeAddressField();f&&t.fetchStatesForCountryByID(f).then(function(t){_.each(t,function(n){n.StateID=n.StateID.toString()});n.CreditCardStateList=t;r&&(n.FormData.CreditCard.State="");r=!0})});this.changeAddressField=function(){n.$emit("billingForm.addressFieldChanged")};$(document).ready(function(){u()})}]);angular.module("CCG.Shared").factory("joinService",["webServiceFactory",function(n){return n.create({createAccount:function(n){return this.post("resources/services/join/create-account/",n)},createShowJoinAccount:function(n){return this.post("resources/services/join/create-show-join-account/",n)},updateShowAccount:function(n){return this.post("resources/services/join/update-show-join-account/",n)},processBilling:function(n){return this.post("resources/services/join/billing/",n)},processAutorenew:function(n){return this.post("account/autorenew/",n)},cancelAutorenew:function(){return this.get("resources/services/join/autorenew/cancel/")},fetchDiscount:function(n,t,i,r){return this.get("resources/services/join/discount/"+n+"/"+t+"/"+i+"/"+r+"/")},validateAffiliateCode:function(n){return this.get("resources/services/join/affiliate-code/validate/"+n+"/")}})}]);angular.module("CCG.Shared").controller("shippingInfoController",["$scope","countryStateService",function(n,t){function r(){var t=_.head(_.filter(n.CountryList,{CountryID:n.FormData.ShippingAddress.CountryID})),r=t&&t.ZipCodeRegex&&t.ZipCodeRegex!=""?!0:!1;i.ZipCodeRegex=new RegExp(r?t.ZipCodeRegex:/^[\w]+[\s]{0,1}[\w]+$/);i.RequireZipCode=r;n.$parent.form.ZipCode.$setViewValue(n.$parent.form.ZipCode.$viewValue)}var i=this;_.each(n.CountryList,function(n){n.CountryID=n.CountryID.toString()});this.changeCountry=function(u,f){r();f||i.changeAddressField();t.fetchStatesForCountryByID(n.FormData.ShippingAddress.CountryID).then(function(t){n.StateList=t;n.FormData.ShippingAddress.StateID=u})};this.changeAddressField=function(){n.$emit("billingForm.addressFieldChanged")};$(document).ready(function(){r()});n.$on("billingForm.syncAddresses",function(){var t=_.find(n.CountryList,["CountryID",n.FormData.CreditCard.CountryID]);n.FormData.ShippingAddress.CountryID=t?t.CountryID:"";i.changeCountry(n.FormData.CreditCard.StateID,!0)})}]);angular.module("CCG.Shared").directive("enewsSubscribe",function(){return{scope:{value:"@"},transclude:!0,controllerAs:"$ctrl",controller:["$scope","$element","$window","$transclude","newsService",function(n,t,i,r,u){var f=this;f.url=i.location.href;r(n,function(n){t.append(n)});f.subscribeToENews=function(){f.enabled=!1;u.enewsSubscribe().then(function(n){n.Success?(f.isSubscribed=!0,f.newsletterName=n.NewsletterName,f.hasResults=!0):n.Redirect?i.location=n.Redirect:(f.enabled=!0,f.isSubscribed=!1,f.error=!0,f.hasResults=!0)},function(){f.hasResults=!0;f.isSubscribed=!1;f.error=!0;f.enabled=!0})};u.isEnewsSubscribed().then(function(n){f.display=n.display;f.isSubscribed=n.isSubscribed},function(){f.display=!1});f.newUserSubscribeToENews=function(){u.nonMemberSignup(f.email,f.optedInName,f.SFMCNewsletterKey,f.url).then(function(n){n.success?($.cookie("ShowEmailSignup","Subscribed",{expires:365,path:"/"}),f.isSubscribed=!0,f.hasResults=!0):(f.error=!0,f.isSubscribed=!1)}).catch(function(){f.error=!0;f.isSubscribed=!1})}}]}});angular.module("CCG.Shared").controller("newsListingCtrl",["$window","newsService","urlService",function(n,t,i){function e(){var n="/news/";return r.filters.filter&&r.filters.filter!=="all"&&(n+="series/"+r.filters.filter+"/"),r.filters.page&&(n+="?page="+r.filters.page),n}var r=this,u,f;r.filters={};u=new URI;f=u.search(!0);r.filters.page=parseInt(f.page)||1;r.filters.filter=u.segment(-3)==="series"?u.segment(-2):"all";r.changeFilter=function(){r.filters.page=1;r.loadArticles();var n=e();i.replaceUrl(n)};r.refresh=function(n){r.filters.page=n||1;r.loadArticles();var t=e();i.replaceUrl(t)};r.loadArticles=function(){t.fetchArticles(r.filters).then(function(n){r.articles=n})};r.loadArticles()}]);angular.module("CCG.Shared").factory("newsService",["webServiceFactory",function(n){return n.create({fetchArticles:function(n){var t="/news/data/";return n.filter&&n.filter!=="all"&&(t+="series/"+n.filter+"/"),n.page&&(t+="?page="+n.page),this.get(t)},isEnewsSubscribed:function(){return this.get("/news/subscribe-to-enews/")},enewsSubscribe:function(){return this.post("/news/subscribe-to-enews/")},nonMemberSignup:function(n,t,i,r){return this.post("/news/subscribe-to-enews/non-member",{email:n,optedInName:t,SFMCNewsletterKey:i,siteUrl:r})}})}]);angular.module("CCG.Shared").directive("ccgModelOverride",function(){return{priority:-1,restrict:"A",require:"ngModel",compile:function(n,t){var i=n.val()||n.text();return i===t.placeholder&&(i=undefined),{pre:function(n,t,r,u){var f=n.$eval(r.ngModel);f!==undefined?u.$setViewValue(f):i!==undefined&&u.$setViewValue(i);u.$setPristine(!0)}}}}});angular.module("CCG.Shared").factory("cardinalService",["payService",function(n){function i(t){t.FormData.CreditCard.CardNumber="";n.generateToken().then(function(n){Cardinal.setup("init",{jwt:n.token});t.FormData.CCGTransactionID=n.orderNumber})}function r(n){var t="Cardinal Cannot Continue. ";return n?n.AcsURL?n.TransactionId?n.JWTPayload?!1:t+"No JWTPayload was returned with the initial response.":t+"No TransactionID was returned with the initial response.":t+"No AcsURL was returned with the initial response.":t+"No data is present from the initial response."}function u(n){var t={Consumer:{Email1:n.FormData.Email,ShippingAddress:{FirstName:n.FormData.FirstName,LastName:n.FormData.LastName},BillingAddress:{FirstName:n.FormData.FirstName,LastName:n.FormData.LastName}},Options:{EnableCCA:!0},OrderDetails:{OrderNumber:n.FormData.PaymentReferenceNumbers.join(","),Amount:parseInt(Number(n.FormData.PaymentAmount)*100),CurrencyCode:"GBP",OrderChannel:"S"}},i,r;return n.FormData.PeoplePaymentProfileID?(r=_.find(n.paymentProfiles,{PeoplePaymentProfileID:n.FormData.PeoplePaymentProfileID}).PaymentProfileID,t.Token={Token:r}):(i=n.FormData.CreditCard.CardNumber,i=i.replace(/\s+/g,""),i=Number(i),t.Consumer.ShippingAddress.Address1=n.FormData.CreditCard.StreetAddress1,t.Consumer.ShippingAddress.Address2=n.FormData.CreditCard.StreetAddress2,t.Consumer.ShippingAddress.City=n.FormData.CreditCard.City,t.Consumer.ShippingAddress.State=n.FormData.CreditCard.State,t.Consumer.ShippingAddress.PostalCode=n.FormData.CreditCard.ZipCode,t.Consumer.ShippingAddress.CountryCode=n.FormData.CreditCard.Country,t.Consumer.BillingAddress.Address1=n.FormData.CreditCard.StreetAddress1,t.Consumer.BillingAddress.Address2=n.FormData.CreditCard.StreetAddress2,t.Consumer.BillingAddress.City=n.FormData.CreditCard.City,t.Consumer.BillingAddress.State=n.FormData.CreditCard.State,t.Consumer.BillingAddress.PostalCode=n.FormData.CreditCard.ZipCode,t.Consumer.BillingAddress.CountryCode=n.FormData.CreditCard.Country,t.Consumer.Account={AccountNumber:i,ExpirationMonth:Number(n.FormData.CreditCard.ExpirationMonth),ExpirationYear:Number(n.FormData.CreditCard.ExpirationYear),CardCode:Number(n.FormData.CreditCard.CVV)}),t}var t={};return t.cardinalFatalErrors=function(){return[1003,1010,1020]},t.reinitializeCardinal=function(n){i(n)},t.start=function(r,u,f,e,o,s){Cardinal.on("payments.setupComplete",function(n){r.FormData.DFReferenceID=n.sessionId});Cardinal.on("payments.validated",function(h,c){h.ErrorNumber&&_.includes(t.cardinalFatalErrors(),h.ErrorNumber)||n.handleCCAResponse(c,r.FormData,u,f).then(e).catch(function(n){o(n);i(r)}).finally(s)});i(r)},t.handleUKPaymentResponse=function(n,t,f,e,o){if(t.Success)f(t);else if(t.CardinalContinue)if(e(t),r(t))o(t),i(n);else{var s=u(n);s.TransactionId=t.TransactionId;Cardinal.continue("cca",{AcsUrl:t.AcsURL,Payload:t.JWTPayload},{OrderDetails:s})}else o(t),i(n)},t}]);angular.module("CCG.Shared").controller("payController",["$scope","$window","$timeout","payService","cardinalService","saferpayService",function(n,t,i,r,u,f){function s(){for(var t=0;t<n.FormData.PaymentReferenceNumbers.length;t++)e.validateInvoice(t,!0)}function y(){return(e.showChargeFailed=!1,n.form.$invalid)?!1:!0}function h(t){n.form.$submitting=!0;t.then(function(n){switch(CCG.tld){case"uk":p(n);break;case"de":w(n);break;default:b(n)}}).catch(function(){e.showChargeFailed=!0;n.form.$submitting=!1})}function p(t){u.handleUKPaymentResponse(n,t,function(t){n.onSuccess(t)},function(){},function(t){console.log(t);e.showChargeFailed=!0;n.form.$submitting=!1})}function w(i){if(i.Success)n.onSuccess(i);else i.Redirect?i.Redirect.UseFancybox?n.$broadcast("payments.fancybox.open",{url:i.Redirect.URL}):t.location=i.Redirect.URL:(e.showChargeFailed=!0,n.form.$submitting=!1,f.init(n))}function b(i){if(i.Redirect)t.location=i.Redirect.URL;else if(i.Success)n.onSuccess(i);else e.showChargeFailed=!0,n.form.$submitting=!1}function k(t,r){i(function(){n.modal[r.modalName]=!0},1e3)}var e=this,o={},c="14",l=10,a="6",v=7;e.paySuccess=!1;e.showChargeFailed=!1;e.validatingInvoiceInput={};e.invoiceValidated={};n.FormData={PaymentReferenceNumbers:[""],PaymentReferenceType:"Submission Number",CreditCard:{ExpirationMonth:"",ExpirationYear:""}};e.clearPaymentInfoFields=function(){n.FormData.Email="";n.FormData.ConfirmEmail="";n.FormData.FirstName="";n.FormData.LastName="";n.FormData.CreditCard.Country="";n.FormData.CreditCard.CardNumber="";n.FormData.CreditCard.ExpirationMonth="";n.FormData.CreditCard.ExpirationYear="";n.FormData.CreditCard.CVV="";n.FormData.CreditCard.Country="";n.FormData.CreditCard.StreetAddress1="";n.FormData.CreditCard.StreetAddress2="";n.FormData.CreditCard.City="";n.FormData.CreditCard.State="";n.FormData.CreditCard.ZipCode=""};e.changePaymentType=function(){CCG.tld!=="de"||n.FormData.PeoplePaymentProfileID||f.init(n)};r.fetchPeoplePaymentProfiles().then(function(t){n.paymentProfiles=t});e.deleteRow=function(t){e.currentDeleteIdx=t;n.FormData.PaymentReferenceNumbers[t]===""?e.confirmDelete():e.showDeleteConfirm=!0};e.confirmDelete=function(){n.FormData.PaymentReferenceNumbers.splice(e.currentDeleteIdx,1);e.showDeleteConfirm=!1;s()};e.validateInvoice=function(t,i){var r=n.FormData.PaymentReferenceNumbers[t],f,u;if((e.invoiceValidated[t]=null,n.form&&n.form["PaymentReferenceNumber"+t])&&(n.form["PaymentReferenceNumber"+t].$setValidity("duplicate",!0),r))if(f=_.some(n.FormData.PaymentReferenceNumbers,function(n,i){return n===r&&i!==t}),f)n.form["PaymentReferenceNumber"+t].$setValidity("duplicate",!1);else if(n.FormData.PaymentReferenceType!=="Online Order Number"){if(i&&o[r]!==undefined){e.invoiceValidated[t]=o[r];return}u=r.startsWith(c)&&r.length===l||r.startsWith(a)&&r.length===v;e.invoiceValidated[t]=u;o[r]=u}};e.resetPaymentModal=function(){e.paymentProcessed=!1;e.showChargeFailed=!1};e.submitInvoice=function(){y()&&(n.onSuccess=function(n){t.location="/pay/result/?requestID="+n.TransactionId},CCG.tld!=="de"||n.FormData.PeoplePaymentProfileID?h(r.submitInvoice(n.FormData)):f.submit(function(t){n.FormData.SaferpayToken=t.token;h(r.submitInvoice(n.FormData))},function(){e.showChargeFailed=!0;n.form.$submitting=!1}))};CCG.tld==="uk"?u.start(n,t.location.href,"invoice",function(t){if(t.Success)n.onSuccess(t);else e.showChargeFailed=!0,n.form.$submitting=!1,u.reinitializeCardinal(n)},function(){e.showChargeFailed=!0;n.form.$submitting=!1}):CCG.tld==="de"&&f.init(n);n.$on("payments.openModal",k);n.$watch("FormData.PaymentReferenceType",s)}]);angular.module("CCG.Shared").factory("payService",["webServiceFactory",function(n){return n.create({fetchPeoplePaymentProfiles:function(){return this.get("/pay/api/profiles/")},submitInvoice:function(n){return this.post("/pay/api/submit/",n)},validateInvoice:function(n){return this.post("/pay/api/validate-invoice",{invoiceNumber:n})},generateToken:function(){return this.get("/pay/api/generate-token")},getPaymentStatus:function(n){return this.get("/pay/api/result/"+n+"/")},handleCCAResponse:function(n,t){return this.post("/pay/api/handle-cca-response",{jwt:n,form:t})},getPaymentProcessorInfo:function(){return this.get("/pay/api/payment-processor-info/")},generateIframeValues:function(n,t,i,r,u,f){return this.get("/pay/api/generate-iframe-values/",{firstName:n,lastName:t,email:i,paymentAmount:r,customerNumber:u,paymentReferenceNumbers:f})},savePaymentLog:function(n){return this.post("/pay/api/save-paymentlog/",n)}})}]);angular.module("CCG.Shared").directive("paymentFancybox",[function(){return{link:function(n){n.$on("payments.fancybox.open",function(n,t){$.fancybox.open({src:t.url,type:"iframe",opts:{modal:!0}})})}}}]);angular.module("CCG.Shared").directive("paymentRedirectForm",["urlService","$timeout",function(n,t){return{scope:{redirect:"="},templateUrl:n.root+"resources/ccg-shared/scripts/ccg.shared/pay/payment-redirect-form.html",link:function(n){n.redirect&&t(function(){$("#paymentRedirectForm").submit()})}}}]);angular.module("CCG.Shared").directive("ccgPaymentResult",function(){return{scope:{transactionId:"@"},transclude:!0,controllerAs:"$ctrl",controller:["$scope","$element","$transclude","$window","payService",function(n,t,i,r,u){var f=this;f.loading=!0;r.self===r.top?(f.success=!1,f.error=!1,f.payResult=null,i(n,function(n){t.append(n)}),u.getPaymentStatus(n.transactionId).then(function(n){f.loading=!1;n.Success?(f.success=!0,f.payResult=n):f.error=!0})):top.location=self.location}]}});angular.module("CCG.Shared").factory("saferpayService",["payService","translationDictionary",function(n,t){function u(){}function r(n){console.error(n)}function f(){var t=angular.element(document).find("div.saferpay-css"),n=t.find(".saferpay-focus-color").html();return{".input-large":"font-size: 18.4px; padding: 8px; margin: 2px; -webkit-transition: box-shadow 300ms ease; transition: box-shadow 300ms ease; border-radius: 6px; height: 40px !important; border: 1px solid #c1c1c1; color: #333333; outline: none; width: calc(100% - 4px);",".input-large:focus":"box-shadow: 0 0 5px "+n+";",".input-group":"height: 50px !important;",".input-small":"font-size: 18.4px; padding: 8px; margin: 2px; -webkit-transition: box-shadow 300ms ease; transition: box-shadow 300ms ease; border-radius: 6px; height: 40px !important; border: 1px solid #c1c1c1; color: #333333; outline: none; width: 98% !important;",".input-small:focus":"box-shadow: 0 0 5px "+n+";",".input-large.is-invalid":"border: 1px solid #bf4040;",".input-small.is-invalid":"border: 1px solid #bf4040;",".expiration":"height: 50px; width: 100%;",".cvc":"height: 50px; width: 100%;",".input-large.is-invalid:focus":"box-shadow: 0 0 5px #bf4040;",".input-small.is-invalid:focus":"box-shadow: 0 0 5px #bf4040;"}}var i={};return i.init=function(i){n.getPaymentProcessorInfo().then(function(n){SaferpayFields.init({apiKey:n.ApiKey,url:n.Url,style:f(),paymentMethods:["visa","mastercard"],onValidated:function(n){var t=n.id.replace(/\-/g,"_");n.isValid?i.form[t].$setValidity("required",!0):i.form[t].$setValidity("required",!1);i.form[t].$setTouched();i.$apply()},onSuccess:u,onError:r,placeholders:{holdername:t.Forms.Name,cardnumber:"0000 0000 0000 0000",expiration:"MM/YY",cvc:"CVV"}})},r)},i.submit=function(n,t){SaferpayFields.submit({onSuccess:n,onError:t})},i}]);angular.module("CCG.Shared").controller("ukPayController",["$scope","payService",function(n,t){function s(){for(var n=0;n<i.paymentReferenceNumbers.length;n++)i.validateInvoice(n,!0)}var i=this,r={},u=10,f="14",e=7,o="6";i.paySuccess=!1;i.showChargeFailed=!1;i.paymentReferenceNumbers=[""];i.paymentReferenceType="Submission Number";i.validatingInvoiceInput={};i.invoiceValidated={};i.iframeValues={};i.isCRD=(new URI).hostname().indexOf("cgccards")!==-1;i.deleteRow=function(n){i.currentDeleteIdx=n;i.paymentReferenceNumbers[n]===""?i.confirmDelete():i.showDeleteConfirm=!0};i.confirmDelete=function(){i.paymentReferenceNumbers.splice(i.currentDeleteIdx,1);i.showDeleteConfirm=!1;s()};i.validateInvoice=function(s,h){var c=i.paymentReferenceNumbers[s],a,l;if((i.invoiceValidated[s]=null,n.form&&n.form["PaymentReferenceNumber"+s])&&(n.form["PaymentReferenceNumber"+s].$setValidity("duplicate",!0),c))if(a=_.some(i.paymentReferenceNumbers,function(n,t){return n===c&&t!==s}),a)n.form["PaymentReferenceNumber"+s].$setValidity("duplicate",!1);else if(i.paymentReferenceType!=="Online Order Number"){if(h&&r[c]!==undefined){i.invoiceValidated[s]=r[c];return}i.isCRD?(l=c.startsWith(f)&&c.length===u||c.startsWith(o)&&c.length===e,i.invoiceValidated[s]=l,r[c]=l):(i.validatingInvoiceInput[s]=!0,t.validateInvoice(c).then(function(n){i.invoiceValidated[s]=n;r[c]=n}).catch(function(){i.invoiceValidated[s]=!1;r[c]=!1}).finally(function(){i.validatingInvoiceInput[s]=!1}))}};i.goToPaymentForm=function(){t.generateIframeValues(i.firstName,i.lastName,i.email,i.paymentAmount,i.CustomerNumber,i.paymentReferenceNumbers.join()).then(function(n){i.iframeValues=n;$.cookie("customer-number",i.CustomerNumber,{path:"/"});$.cookie("payment-reference-type",i.paymentReferenceType,{path:"/"});$.cookie("payment-reference-number",i.paymentReferenceNumbers,{path:"/"})})}}]);angular.module("CCG.Shared").controller("ukPayHandleController",["$window","payService",function(n,t){var i=this;i.paymentLog={};i.$onInit=function(){var r=$.cookie("customer-number"),u=$.cookie("payment-reference-type"),f=$.cookie("payment-reference-number");i.paymentLog.CustomerNumber=r;i.paymentLog.PaymentReferenceType=u;i.paymentLog.PaymentReferenceNumber=f;t.savePaymentLog(i.paymentLog).then(function(t){t.Success&&(n.location.href="/pay/result/?requestID="+t.TransactionID)})}}]);angular.module("CCG.Shared").factory("collectibleTypeService",["webServiceFactory",function(n){return n.create({getCollectibleImage:function(n){return this.get("resources/services/collectible-type/image/"+n)}})}]);angular.module("CCG.Shared").factory("countdownClockService",["webServiceFactory",function(n){return n.create({getCountdownTimer:function(n){return this.get("resources/services/countdown-clock/"+n+"/")}})}]);angular.module("CCG.Shared").factory("countryStateService",["$q","webServiceFactory",function(n,t){return t.create({fetchCountries:function(){return this.get("/resources/services/country/")},fetchStatesForCountryByName:function(t,i){return t?this.get("/resources/services/country/name/"+t.trim()+"/states/?isFromOSF="+!!i):n.when([])},fetchStatesForCountryByCountryCode:function(t,i){return t?this.get("/resources/services/country/code/"+t.trim()+"/states/?isFromOSF="+!!i):n.when([])},fetchStatesForCountryByID:function(n,t){return this.get("/resources/services/country/id/"+n+"/states/?isFromOSF="+!!t)},countryNames:{unitedStates:"United States"}})}]);angular.module("CCG.Shared").factory("galleryService",["$sce","webServiceFactory",function(n,t){return t.create({getGallery:function(n){return this.get("/resources/services/gallery/"+n+"/")},fetchItems:function(t,i){return this.get("/resources/services/gallery/"+t+"/images/",i).then(function(t){return _.forEach(t.Items,function(t){t.Grade=(t.Grade||"").replace(/(\d)\+/g,"$1<i class='plus-grade'><\/i>").replace(/(\d)\*/g,"$1<i class='star-grade'><\/i>");var i=[t.Name,t.Grade];_.remove(i,_.isEmpty);t.Caption=i.join(", ");t.Text2=n.trustAsHtml(t.Text2)}),t})},getFilterLists:function(n,t){return this.get("/resources/services/gallery/"+n+"/filters/",t)}})}]);angular.module("CCG.Shared").provider("seoService",[function(){var n=this;this.baseSuffix="";this.setTitleSuffix=function(t){n.baseSuffix=t;n.baseSuffix.includes("|")||(n.baseSuffix=" | "+n.baseSuffix.trim())};this.$get=[function(){return{setTitle:function(t){document.title=t+n.baseSuffix},setFullTitle:function(n){document.title=n},setMetaDescription:function(n){var t=document.head.children.description;t===undefined&&(t=document.createElement("meta"),t.name="description",document.head.append(t));t.content=n},setCanonicalUrl:function(n,t){var u,r,f,i;if(!n)throw new Error("No url defined");u=new URI;r=new URI(n);r.origin()||r.origin(u.origin());Array.isArray(t)&&(f=u.query(!0),t.forEach(function(n){var t=f[n];t!==undefined&&r.setQuery(n,t)}));i=document.querySelector("link[rel='canonical']");i||(i=document.createElement("link"),i.setAttribute("rel","canonical"),document.head.append(i));i.setAttribute("href",r.toString())}}}]}]);angular.module("CCG.Shared").factory("updateCreditCardService",["webServiceFactory",function(n){return n.create({fetchOpenInvoices:function(){return this.get("/account/my-submissions/update-payment/api/open-invoices/")},updatePaymentToken:function(n,t,i,r){return this.post("/account/my-submissions/update-payment/api/update-payment-token/",{transactionID:n,preAuthData:t,invoices:i,address:r})},setUpdatedInvoices:function(n){sessionStorage.UpdatedInvoices=JSON.stringify(n)},getUpdatedInvoices:function(){return JSON.parse(sessionStorage.UpdatedInvoices)}})}]);angular.module("CCG.Shared").controller("gradingScaleController",["urlService",function(n){var t=this,i=(new URI).search(!0);t.currentScale=i.scale||"standard";t.changeScale=function(i,r){i.preventDefault();t.currentScale=r;n.replaceUrl(n.baseUrl,{scale:r})}}]);angular.module("CCG.Shared").controller("servicesFeesController",["$scope","urlService",function(n,t){var i=this,r=(new URI).search(!0);i.selectedView=r.view||"all";n.$on("ccgViewSwitch.viewSwitched",function(n,r){i.selectedView=r;t.replaceUrl(t.baseUrl,{view:r})});$(".ad-bottom").hide()}]);angular.module("CCG.Shared").provider("apiServiceFactory",[function(){var n=this;this.baseEndpoint="";this.localVariable=[];this.setEndpoint=function(t){n.baseEndpoint=t};this.setLocalVariable=function(t,i){n.localVariable[t]=i};this.$get=["$http","$q","urlService",function(t,i,r){function u(){}return u.prototype.init=function(t){n.baseEndpoint=t},u.prototype.get=function(n,t,i){return this.callService({method:"GET",url:n,params:t},i)},u.prototype.post=function(n,t,i){return this.httpMethod("POST",n,t,i)},u.prototype.put=function(n,t,i){return this.httpMethod("PUT",n,t,i)},u.prototype["delete"]=function(n,t,i){return this.httpMethod("DELETE",n,t,i)},u.prototype.httpMethod=function(n,t,i,r){var u=null;return i&&i.timeout&&(u=i.timeout,i=_.omit(i,"timeout")),this.callService({method:n,url:t,data:i,timeout:u},r)},u.prototype.callService=function(r,u){var e=r.timeout||i.defer(),f=i.defer();return f.promise.cancel=function(){e.resolve()},r.method=r.method.toUpperCase(),r.url=n.baseEndpoint+this.cleanUrl(r.url),r.cache=u||!1,r.timeout=e.promise||e,r.headers={"Accept-Language":CCG.culture},t(r).then(function(n){f.resolve(n.data)}).catch(function(n){f.reject(n)}),f.promise},u.prototype.cleanUrl=function(n){n=n||"";var t=n.indexOf("http")!==0;return t?(n.indexOf("~/")===0&&(n=n.replace("~/","")),n.indexOf("/")!==0&&t&&(n=r.root+n),n.match(/.*\/[^.?]*[^\/]$/)&&(n+="/"),n):n},u.prototype.getLocalVariable=function(t){return n.localVariable[t]},{create:function(n){return angular.extend(new u,n)}}}]}]);angular.module("CCG.Shared").factory("batchRequestService",["$http",function(n){function f(){if(t.length!==0&&i!==u){var f=$(t.map(function(n){return n.element[0]})),e=f.filter(":visible").slice(0,u-i),o=_.remove(t,function(n){return e.index(n.element)>=0});o.forEach(function(t){i++;n[t.method.toLowerCase()](t.url).then(function(n){i--;t.callback(n.data);i==0&&r()})});t.length>0&&r()}}var t=[],r=_.debounce(f,300),u=4,i=0;return{load:r,register:function(n,i,u,f){t.push({element:n,url:i,method:u,callback:f});r()}}}]);angular.module("CCG.Shared").factory("dndBulkMoveService",[function(){var n={};return n.deselectAll=function(n){angular.forEach(n,function(n){n.selected=!1})},n.onDrop=function(t,i,r,u){return n.deselectAll(r),Array.prototype.splice.apply(i,[u,0].concat(r)),_.remove(i,function(n){return n.selected}),t.dragging=!1,!0},n.getSelectedItemsIncluding=function(n,t){return t.selected=!0,n.filter(function(n){return n.selected})},n.onDragStart=function(n,t){if(n.dragging=!0,t.dataTransfer.setDragImage){var i=new Image;i.src=CCG.rootUrl+"Resources/ccg-shared/images/template/stack_2x.png";t.dataTransfer.setDragImage(i,0,0)}},n.onSelected=function(n,t){t&&t.target.getAttribute("dnd-ignore-click")||(n.selected=!n.selected)},n.onDragEnd=function(n){n.dragging=!1},n.onCanceled=function(t){n.deselectAll(t)},n}]);angular.module("CCG.Shared").factory("DOMPosition",["$rootScope",function(n){function t(n){var i=$(n),r;i.length!==0&&(r=$.isWindow(n)?{top:i.scrollTop(),left:i.scrollLeft()}:i.offset(),this.minX=r.left,this.maxX=r.left+i.width(),this.minY=r.top,this.maxY=r.top+i.height(),this.loadedTime=t.refreshTime,i.data("DOMPosition",this))}t.prototype.contains=function(n,i){var r=t.getPosition(n),u=this.minX,f=this.maxX,e=this.minY,o=this.maxY,s,h;return i&&(i.x&&(u+=i.x,f+=i.x),i.y&&(e+=i.y,o+=i.y)),s=u<=r.minX&&r.minX<=f||u<=r.maxX&&r.maxX<=f,h=e<=r.minY&&r.minY<=o||e<=r.maxY&&r.maxY<=o,s&&h};t.prototype.fullyContains=function(n){var i=t.getPosition(n),r=this.minX<=i.minX&&i.maxX<=this.maxX,u=this.minY<=i.minY&&i.maxY<=this.maxY;return r&&u};t.prototype.partiallyContains=function(n,i){i=Math.min(Math.max(i,0),1);var r=t.getPosition(n),u=r.maxY-r.minY,f=u*i+r.minY;return this.maxY>f};t.refreshTime=Date.now();t.needsRefresh=_.throttle(function(){t.refreshTime=Date.now()},150);t.getPosition=function(n){var r=$(n),i;if(r.length!==0)return i=r.data("DOMPosition"),i&&i.loadedTime===t.refreshTime||(i=new t(n),r.data("DOMPosition",i)),i};n.$on("DOMPosition.needsRefresh",t.needsRefresh);n.$on("ccgViewSwitch.viewSwitched",t.needsRefresh);$(window).on("resize",t.needsRefresh);return t}]);angular.module("CCG.Shared").factory("domService",["$window","$timeout",function(n,t){var i=angular.element(n.document.body);return{isTouch:Modernizr.touch,isXSmall:Modernizr.mq.bind(null,"(max-width: 400px)"),isSmall:Modernizr.mq.bind(null,"(min-width: 401px) and (max-width: 720px)"),isMedium:Modernizr.mq.bind(null,"(min-width: 721px) and (max-width: 1023px)"),isStandard:Modernizr.mq.bind(null,"(min-width: 1024px) and (max-width: 1365px)"),isLarge:Modernizr.mq.bind(null,"(min-width: 1366px) and (max-width: 1679px)"),isXLarge:Modernizr.mq.bind(null,"(min-width: 1680px)"),isMobile:navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/),isTabletUp:Modernizr.mq.bind(null,"(min-width: 501px)"),isDesktop:Modernizr.mq.bind(null,"(min-width: 720px)"),supportsFileReader:Modernizr.filereader,hasScroll:function(n){return n[0].scrollHeight>n[0].clientHeight},canScroll:function(n){var i=n[0].scrollHeight,t=n[0].clientHeight,r=n.scrollTop(),u=r+t>=i-5;return!u&&t!==0},storePositionedElement:function(n,t){var i=$("#"+n);i.length||(i=$("<div>").attr("id",n).prependTo("body"));i.append(t)},repositionTo:function(i,r,u){var f=r.offset(),e=r.outerHeight();t(function(){var t=-(2*u.yBuffer-e/2),o=f.top+t,r;u.useReverse&&(r=f.top>n.pageYOffset+n.innerHeight/2,r&&(t=-(e/2)-2*u.yBuffer,o=f.top-(i.outerHeight()+t)),i.find(".ebay-popover").toggleClass("reversed",r));i.css({position:"absolute",left:u.useFixedX?u.xOffset:u.xOffset+f.left-u.yBuffer,top:o,visibility:"visible"})},0)}}}]);angular.module("CCG.Shared").factory("EventWatcher",[function(){function n(n,t,i){this.$element=angular.element(n);this.events=t;this.valueHandler=i;this.value=this.valueHandler.call(this.$element);this.handlers=[];this.isListening=!1;this.lastValue=null}return n.prototype.addHandler=function(n,t){this.isListening||this.startListening();this.handlers.push(_.throttle(n,t||150))},n.prototype.startListening=function(){if(!this.isListening){this.$element.on(this.events,this.listener.bind(this));this.isListening=!0}},n.prototype.stopListening=function(){this.isListening&&this.$element.off(this.events,this.listener)},n.prototype.listener=function(n){(this.lastValue=this.value,this.value=this.valueHandler.call(this.$element),_.isEqual(this.lastValue,this.value))||this.handlers.forEach(function(t){t(n,this.value)}.bind(this))},n.prototype.refresh=function(){this.value=this.valueHandler.call(this.$element)},n}]);angular.module("CCG.Shared").directive("ccgIframeBuster",function(){return{controller:["$window",function(n){n.self!==n.top&&(n.top.location=n.self.location)}]}});angular.module("CCG.Shared").factory("imageResizer",[function(){function i(i){var f={height:n,width:t,needsResize:!1};if(i){var r=i.width,u=i.height,e=!1;r>=u?r>t&&(r=t,u*=t/r,e=!0):u>n&&(u=n,r*=n/u,e=!0);f.width=r;f.height=u;f.needsResize=e}return f}function r(n,t){for(var e=n.match(/data:([^;]*)(;base64)?,([0-9A-Za-z+/]+)/),r=atob(e[3]),u=r.length,f=new Uint8Array(u),i=0;i<u;i++)f[i]=r.charCodeAt(i);return new Blob([f],{type:t||"image/png"})}function u(n,t,i,u){var f=new FileReader;f.onloadend=function(){var f=EXIF.readFromBinaryFile(new BinaryFile(this.result));canvasResize(n,{width:t,height:i,crop:!1,quality:90,callback:function(t){u(r(t,n.type),f.Orientation)}})};f.readAsBinaryString(n)}var n=2448,t=2448;return{resize:function(n,t){if(n&&n.type.match(/image.*/)){var r=new FileReader;r.onload=function(r){var f=document.createElement("img");f.onload=function(r){var f=i(r.target);f.needsResize?u(n,f.width,f.height,t):t(n)};f.src=r.target.result};r.readAsDataURL(n)}else t(null)}}}]);angular.module("CCG.Shared").constant("keycodes",{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,_1:49,_2:50,_3:51,_4:52,_5:53,_6:54,_7:55,_8:56,_9:57,_0:48,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,ESCAPE:27,TILDE:192,MINUS:189,EQUALS:187,BACKSPACE:8,TAB:9,LEFT_BRACKET:219,RIGHT_BRACKET:221,BACK_SLASH:220,CAPS_LOCK:20,SEMI_COLON:186,QUOTE:222,ENTER:13,SHIFT:16,COMMA:188,PERIOD:190,FWD_SLASH:191,CTRL:17,ALT:18,LEFT_CMD:91,RIGHT_CMD:92,INSERT:45,HOME:36,PAGE_UP:33,DELETE:46,END:35,PAGE_DOWN:34,UP:38,LEFT:37,DOWN:40,RIGHT:39,SCROLL_LOCK:145,PAUSE:19,NUM_LOCK:144,NUM_MINUS:109,NUM_STAR:106,NUM_SLASH:111,NUM_7:103,NUM_8:104,NUM_9:105,NUM_PLUS:107,NUM_4:100,NUM_5:101,NUM_6:102,NUM_1:97,NUM_2:98,NUM_3:99,NUM_0:96});angular.module("CCG.Shared").factory("lazyLoadService",["$rootScope","windowWatcher",function(n,t){function r(){if(i.length!==0){var r=t.size(),n=t.viewport();n.minX-=r.width;n.maxX+=r.width;n.minY-=r.height;n.maxY+=r.height*2;setTimeout(function(){var t=$(i.map(function(n){return n.element[0]})),r=t.filter(":visible"),u=_.remove(i,function(t){return r.index(t.element)>=0&&n.contains(t.element)});f(u)})}}function f(n){n.length!==0&&n.forEach(function(n){n.callback()})}var i=[],u=_.debounce(r,300);t.onResize(r);t.onScroll(r);return n.$on("ccgViewSwitch.viewSwitched",u),{register:function(n,t){i.push({element:n,callback:t});u()}}}]);angular.module("CCG.Shared").service("scrollService",["$window","windowWatcher","windowService",function(n,t,i){function l(n,t){n&&n.length!==0&&n.forEach(function(n){n.callback(t)})}function v(){var n=t.scroll();n.directionX=y(n.left,e.left,"right","left");n.directionY=y(n.top,e.top,"down","up");e=n;l(c,n);a(h,n)}function y(n,t,i,r){return n>t?i:n<t?r:void 0}function p(){h=_.filter(f,{noDelay:undefined});c=_.filter(f,{noDelay:!0})}function w(){o=_.sumBy(u,"offset")||0}var r=this,f=[],h,c,e=i.getViewportScroll(),a,o,u,s;r.scrollToElement=function(n,t,i){n&&(i=i||0,window.requestAnimationFrame(function(){var u=0,f;!$(n).offset()||(u=$(n).offset().top);f=r.getGlobalOffset();$("html, body").animate({scrollTop:u-f+i},t)}))};r.registerOnScroll=function(n,t,i){f.push({element:n,callback:t,noDelay:i});p()};r.deregisterOnScroll=function(n){_.remove(f,{element:n});p()};a=_.throttle(function(n,t){l(n,t)},100);o=0;u=[];r.registerOffsetElement=function(n){_.some(u,{element:n})||(u.push({element:n,offset:n[0].offsetHeight}),w())};r.deregisterOffsetElement=function(n){_.remove(u,{element:n});w()};r.getGlobalOffset=function(n){return n?_.sumBy(_.reject(u,{element:n}),"offset"):o};s=angular.element(n);s.on("resize scroll mousewheel",v);s.ready(v)}]);angular.module("CCG.Shared").factory("sessionService",["$window",function(n){return{get:function(t){if(t){var i=n.sessionStorage.getItem(t);return i?JSON.parse(i):i}},set:function(t,i){if(t)try{n.sessionStorage.setItem(t,JSON.stringify(i))}catch(r){}}}}]);angular.module("CCG.Shared").factory("storageService",["$window",function(n){return{get:function(t){if(t){var i=n.localStorage[t];return i?JSON.parse(i):i}},set:function(t,i){if(t)try{n.localStorage[t]=JSON.stringify(i)}catch(r){}}}}]);angular.module("CCG.Shared").factory("urlService",["$window","$rootScope",function(n,t){angular.element(n).on("popstate",function(n){n.state&&(n.state.eventKeys&&n.state.eventKeys.length>0&&n.state.eventKeys.forEach(function(n){t.$broadcast(n)}),n.state.callbacks&&n.state.callbacks.length>0&&n.state.callbacks.forEach(function(t){t(n)}),t.$apply())});return{root:CCG.rootUrl,baseUrl:CCG.basePageUrl,culture:CCG.culture,tld:CCG.tld,sharedCookieDomain:[""].concat(_.takeRight(n.location.hostname.split("."),2)).join("."),supportsHtml5History:Modernizr&&Modernizr.history,collectibleTypeSeo:function(){var t=new RegExp("(sports-cards|trading-cards|coins)");return(n.location.pathname.match(t)||[""])[0]},path:function(){return n.location.pathname},fullPath:function(){return n.location.pathname+n.location.search+n.location.hash},updateUrl:function(t,i){t=this.buildUrl(t,i);n.history.pushState(null,null,t)},replaceUrl:function(t,i,r){t=this.buildUrl(t,i);n.history.replaceState(r,null,t)},updateWithState:function(n,t,i){this.replaceUrl(this.fullPath(),null,i);n&&this.updateUrl(n,t)},buildUrl:function(n,t){if(n.indexOf("http")!==0&&n.indexOf("/")!==0&&(n=this.root+n),t=_.pickBy(t,_.identity),t.length===0)return n;var i=new URI(n);return i.escapeQuerySpace(!1),i.setSearch(t),i.toString()},templateUrl:function(n){return this.buildUrl(n,{lang:this.culture})},pathParts:function(){return _.filter(n.location.pathname.split("/"),function(n){return!!n})},buildUrlFromPathParts:function(n,t){var i=_(n).compact().map(function(n){return n.toString().replaceAll("/","")}).value().join("/");return this.buildUrl(i,t)}}}]);angular.module("CCG.Shared").factory("webServiceFactory",["$http","$q","urlService",function(n,t,i){function r(){}return r.prototype.get=function(n,t,i,r){return this.callService({method:"GET",url:n,params:t,timeout:r},i)},r.prototype.post=function(n,t,i){return this.httpMethod("POST",n,t,i)},r.prototype.put=function(n,t,i){return this.httpMethod("PUT",n,t,i)},r.prototype["delete"]=function(n,t,i){return this.httpMethod("DELETE",n,t,i)},r.prototype.httpMethod=function(n,t,i,r){var u=null;return i&&i.timeout&&(u=i.timeout,i=_.omit(i,"timeout")),this.callService({method:n,url:t,data:i,timeout:u},r)},r.prototype.callService=function(i,r){var f=i.timeout||t.defer(),u=t.defer();return u.promise.cancel=function(){f.resolve()},i.method=i.method.toUpperCase(),i.url=this.cleanUrl(i.url),i.cache=r||!1,i.timeout=f.promise||f,n(i).then(function(n){u.resolve(n.data)}).catch(function(n){u.reject(n)}),u.promise},r.prototype.cleanUrl=function(n){n=n||"";var t=n.indexOf("http")!==0;return t?(n.indexOf("~/")===0&&(n=n.replace("~/","")),n.indexOf("/")!==0&&t&&(n=i.root+n),n.match(/.*\/[^.?]*[^\/]$/)&&(n+="/"),n):n},{create:function(n){return angular.extend(new r,n)}}}]);angular.module("CCG.Shared").service("windowService",["$window",function(n){var t=this;t.getViewportScroll=function(){return{x:n.pageXOffset,y:n.pageYOffset}};t.getElementOffset=function(n){var u=angular.element(n),i=u[0].getBoundingClientRect(),r=t.getViewportScroll();return{top:i.top+r.y,left:i.left+r.x,right:i.right+r.x,bottom:i.bottom+r.y}}}]);angular.module("CCG.Shared").factory("windowWatcher",["$window","EventWatcher","DOMPosition",function(n,t,i){return{scrollWatcher:new t(n,"scroll",function(){return{top:n.pageYOffset,left:n.pageXOffset}}),resizeWatcher:new t(n,"resize",function(){return{height:this.height(),width:this.width()}}),size:function(){return this.resizeWatcher.value},scroll:function(){return{top:n.pageYOffset,left:n.pageXOffset}},viewport:function(){var r=this.resizeWatcher.value,t=this.scrollWatcher.value,n=new i;return n.minX=t.left,n.maxX=t.left+r.width,n.minY=t.top,n.maxY=t.top+r.height,n},withinViewport:function(n,t){var i=this.viewport();return i.contains(n,t)},fullyWithinViewport:function(n){var t=this.viewport();return t.fullyContains(n)},partiallyWithinViewport:function(n,t){var i=this.viewport();return i.partiallyContains(n,t)},onScroll:function(n,t){this.scrollWatcher.addHandler(n,t)},onResize:function(n,t){this.resizeWatcher.addHandler(n,t)}}}]);angular.module("CCG.Shared").directive("ccgFallbackSrc",[function(){return{link:function(n,t,i){t.bind("error",function(){var t=i.ccgFallbackSrc?i.ccgFallbackSrc:i.src;i.src!==i.errSrc&&i.$set("src",t);n.$emit("image.errorLoading")})}}}]);angular.module("CCG.Shared").directive("ccgGreaterThanZero",[function(){return{require:"ngModel",link:function(n,t,i,r){r.$validators.greaterthanzero=function(n,t){return parseInt(t)>0}}}}]);angular.module("CCG.Shared").directive("ccgValidatePhoneNumber",function(){return{require:"ngModel",link:function(n,t,i,r){function f(){var n,i,t;r.$pristine||(!r.$invalid||r.$error.valid)&&(n=r.$modelValue||"",i=!1,u.CountrySelect&&u.CountrySelect.$viewValue?(t=u.CountrySelect.$viewValue.CountryCode,i=(t=="US"||libphonenumber.isValidPhoneNumber(n))&&libphonenumber.isValidPhoneNumber(n,t)&&libphonenumber.parsePhoneNumber(n,t).country==t):i=libphonenumber.isValidPhoneNumber(n),e(i))}function e(n){r.$setValidity("valid",n)}var u=t.parents("form:first").controller("form");if(u&&u.registerValidator&&u.registerValidator(f),i.validateOn!==undefined)t.on(i.validateOn,f)}}});angular.module("CCG.Shared").directive("ccgValidateUnique",["validationService",function(n){return{require:"ngModel",link:function(t,i,r,u){function h(){var i,e;if(!u.$pristine&&(!u.$invalid||u.$error.unique)){if(f&&f.cancel(),i=u.$modelValue||"",i.length===0){o(!0);return}return e=t.$eval(r.uniqueException),f=n.validateUnique(c,l,i,e),f.then(function(n){o(n.Success)})}}function o(n){u.$setValidity("unique",n)}var s=r.ccgValidateUnique.split("."),c=s[0],l=s[1],e=i.parents("form:first").controller("form"),f;if(e&&e.registerValidator&&e.registerValidator(h),r.validateOn!==undefined)i.on(r.validateOn,h);i.on("keyup",function(){i.val()!==i.data("last-value")&&(i.data("last-value",i.val()),o(!0),t.$apply())})}}}]);angular.module("CCG.Shared").factory("validationService",["webServiceFactory",function(n){return n.create({validateUnique:function(n,t,i,r){var u=["resources/services/validate",n,t,""].join("/"),f={value:i,exceptionID:r};return this.post(u,f,!1)}})}])