var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opens = _____WB$wombat$assign$function_____("opens");
!function(){"use strict";angular.module("nbiSubmodules",[]),angular.module("giftCardsWidget",["ui.router","mdl","datePicker","ngMessages","ngSanitize","ngStorage","duScroll","markdown","ngTouch","nbiSubmodules","jm.i18next"])}();
!function(){"use strict";countryFlagCtrl.$inject=["$scope","$document","$element"];var countries=[{code:"au",name:"Australia",prefix:"+61",upCode:"AU"},{code:"af",name:"Afghanistan",prefix:"+93",upCode:"AF"},{code:"ax",name:"Aland Islands",prefix:"+358",upCode:"AX"},{code:"al",name:"Albania",prefix:"+355",upCode:"AL"},{code:"dz",name:"Algeria",prefix:"+213",upCode:"DZ"},{code:"as",name:"AmericanSamoa",prefix:"+1684",upCode:"AS"},{code:"ad",name:"Andorra",prefix:"+376",upCode:"AD"},{code:"ao",name:"Angola",prefix:"+244",upCode:"AO"},{code:"ai",name:"Anguilla",prefix:"+1264",upCode:"AI"},{code:"aq",name:"Antarctica",prefix:"+672",upCode:"AQ"},{code:"ag",name:"Antigua and Barbuda",prefix:"+1268",upCode:"AG"},{code:"ar",name:"Argentina",prefix:"+54",upCode:"AR"},{code:"am",name:"Armenia",prefix:"+374",upCode:"AM"},{code:"aw",name:"Aruba",prefix:"+297",upCode:"AW"},{code:"at",name:"Austria",prefix:"+43",upCode:"AT"},{code:"az",name:"Azerbaijan",prefix:"+994",upCode:"AZ"},{code:"bs",name:"Bahamas",prefix:"+1242",upCode:"BS"},{code:"bh",name:"Bahrain",prefix:"+973",upCode:"BH"},{code:"bd",name:"Bangladesh",prefix:"+880",upCode:"BD"},{code:"bb",name:"Barbados",prefix:"+1246",upCode:"BB"},{code:"by",name:"Belarus",prefix:"+375",upCode:"BY"},{code:"be",name:"Belgium",prefix:"+32",upCode:"BE"},{code:"bz",name:"Belize",prefix:"+501",upCode:"BZ"},{code:"bj",name:"Benin",prefix:"+229",upCode:"BJ"},{code:"bm",name:"Bermuda",prefix:"+1441",upCode:"BM"},{code:"bt",name:"Bhutan",prefix:"+975",upCode:"BT"},{code:"bo",name:"Bolivia, Plurinational State of",prefix:"+591",upCode:"BO"},{code:"ba",name:"Bosnia and Herzegovina",prefix:"+387",upCode:"BA"},{code:"bw",name:"Botswana",prefix:"+267",upCode:"BW"},{code:"br",name:"Brazil",prefix:"+55",upCode:"BR"},{code:"io",name:"British Indian Ocean Territory",prefix:"+246",upCode:"IO"},{code:"bn",name:"Brunei Darussalam",prefix:"+673",upCode:"BN"},{code:"bg",name:"Bulgaria",prefix:"+359",upCode:"BG"},{code:"bf",name:"Burkina Faso",prefix:"+226",upCode:"BF"},{code:"bi",name:"Burundi",prefix:"+257",upCode:"BI"},{code:"kh",name:"Cambodia",prefix:"+855",upCode:"KH"},{code:"cm",name:"Cameroon",prefix:"+237",upCode:"CM"},{code:"ca",name:"Canada",prefix:"+1",upCode:"CA"},{code:"cv",name:"Cape Verde",prefix:"+238",upCode:"CV"},{code:"ky",name:"Cayman Islands",prefix:"+ 345",upCode:"KY"},{code:"cf",name:"Central African Republic",prefix:"+236",upCode:"CF"},{code:"td",name:"Chad",prefix:"+235",upCode:"TD"},{code:"cl",name:"Chile",prefix:"+56",upCode:"CL"},{code:"cn",name:"China",prefix:"+86",upCode:"CN"},{code:"cx",name:"Christmas Island",prefix:"+61",upCode:"CX"},{code:"cc",name:"Cocos (Keeling) Islands",prefix:"+61",upCode:"CC"},{code:"co",name:"Colombia",prefix:"+57",upCode:"CO"},{code:"km",name:"Comoros",prefix:"+269",upCode:"KM"},{code:"cg",name:"Congo",prefix:"+242",upCode:"CG"},{code:"cd",name:"Congo, The Democratic Republic of the Congo",prefix:"+243",upCode:"CD"},{code:"ck",name:"Cook Islands",prefix:"+682",upCode:"CK"},{code:"cr",name:"Costa Rica",prefix:"+506",upCode:"CR"},{code:"ci",name:"Cote d'Ivoire",prefix:"+225",upCode:"CI"},{code:"hr",name:"Croatia",prefix:"+385",upCode:"HR"},{code:"cu",name:"Cuba",prefix:"+53",upCode:"CU"},{code:"cy",name:"Cyprus",prefix:"+357",upCode:"CY"},{code:"cz",name:"Czech Republic",prefix:"+420",upCode:"CZ"},{code:"dk",name:"Denmark",prefix:"+45",upCode:"DK"},{code:"dj",name:"Djibouti",prefix:"+253",upCode:"DJ"},{code:"dm",name:"Dominica",prefix:"+1767",upCode:"DM"},{code:"do",name:"Dominican Republic",prefix:"+1849",upCode:"DO"},{code:"ec",name:"Ecuador",prefix:"+593",upCode:"EC"},{code:"eg",name:"Egypt",prefix:"+20",upCode:"EG"},{code:"sv",name:"El Salvador",prefix:"+503",upCode:"SV"},{code:"gq",name:"Equatorial Guinea",prefix:"+240",upCode:"GQ"},{code:"er",name:"Eritrea",prefix:"+291",upCode:"ER"},{code:"ee",name:"Estonia",prefix:"+372",upCode:"EE"},{code:"et",name:"Ethiopia",prefix:"+251",upCode:"ET"},{code:"fk",name:"Falkland Islands (Malvinas)",prefix:"+500",upCode:"FK"},{code:"fo",name:"Faroe Islands",prefix:"+298",upCode:"FO"},{code:"fj",name:"Fiji",prefix:"+679",upCode:"FJ"},{code:"fi",name:"Finland",prefix:"+358",upCode:"FI"},{code:"fr",name:"France",prefix:"+33",upCode:"FR"},{code:"gf",name:"French Guiana",prefix:"+594",upCode:"GF"},{code:"pf",name:"French Polynesia",prefix:"+689",upCode:"PF"},{code:"ga",name:"Gabon",prefix:"+241",upCode:"GA"},{code:"gm",name:"Gambia",prefix:"+220",upCode:"GM"},{code:"ge",name:"Georgia",prefix:"+995",upCode:"GE"},{code:"de",name:"Germany",prefix:"+49",upCode:"DE"},{code:"gh",name:"Ghana",prefix:"+233",upCode:"GH"},{code:"gi",name:"Gibraltar",prefix:"+350",upCode:"GI"},{code:"gr",name:"Greece",prefix:"+30",upCode:"GR"},{code:"gl",name:"Greenland",prefix:"+299",upCode:"GL"},{code:"gd",name:"Grenada",prefix:"+1473",upCode:"GD"},{code:"gp",name:"Guadeloupe",prefix:"+590",upCode:"GP"},{code:"gu",name:"Guam",prefix:"+1671",upCode:"GU"},{code:"gt",name:"Guatemala",prefix:"+502",upCode:"GT"},{code:"gg",name:"Guernsey",prefix:"+44",upCode:"GG"},{code:"gn",name:"Guinea",prefix:"+224",upCode:"GN"},{code:"gw",name:"Guinea-Bissau",prefix:"+245",upCode:"GW"},{code:"gy",name:"Guyana",prefix:"+595",upCode:"GY"},{code:"ht",name:"Haiti",prefix:"+509",upCode:"HT"},{code:"va",name:"Holy See (Vatican City State)",prefix:"+379",upCode:"VA"},{code:"hn",name:"Honduras",prefix:"+504",upCode:"HN"},{code:"hk",name:"Hong Kong",prefix:"+852",upCode:"HK"},{code:"hu",name:"Hungary",prefix:"+36",upCode:"HU"},{code:"is",name:"Iceland",prefix:"+354",upCode:"IS"},{code:"in",name:"India",prefix:"+91",upCode:"IN"},{code:"id",name:"Indonesia",prefix:"+62",upCode:"ID"},{code:"ir",name:"Iran, Islamic Republic of Persian Gulf",prefix:"+98",upCode:"IR"},{code:"iq",name:"Iraq",prefix:"+964",upCode:"IQ"},{code:"ie",name:"Ireland",prefix:"+353",upCode:"IE"},{code:"im",name:"Isle of Man",prefix:"+44",upCode:"IM"},{code:"il",name:"Israel",prefix:"+972",upCode:"IL"},{code:"it",name:"Italy",prefix:"+39",upCode:"IT"},{code:"jm",name:"Jamaica",prefix:"+1876",upCode:"JM"},{code:"jp",name:"Japan",prefix:"+81",upCode:"JP"},{code:"je",name:"Jersey",prefix:"+44",upCode:"JE"},{code:"jo",name:"Jordan",prefix:"+962",upCode:"JO"},{code:"kz",name:"Kazakhstan",prefix:"+77",upCode:"KZ"},{code:"ke",name:"Kenya",prefix:"+254",upCode:"KE"},{code:"ki",name:"Kiribati",prefix:"+686",upCode:"KI"},{code:"kp",name:"Korea, Democratic People's Republic of Korea",prefix:"+850",upCode:"KP"},{code:"kr",name:"Korea, Republic of South Korea",prefix:"+82",upCode:"KR"},{code:"kw",name:"Kuwait",prefix:"+965",upCode:"KW"},{code:"kg",name:"Kyrgyzstan",prefix:"+996",upCode:"KG"},{code:"la",name:"Laos",prefix:"+856",upCode:"LA"},{code:"lv",name:"Latvia",prefix:"+371",upCode:"LV"},{code:"lb",name:"Lebanon",prefix:"+961",upCode:"LB"},{code:"ls",name:"Lesotho",prefix:"+266",upCode:"LS"},{code:"lr",name:"Liberia",prefix:"+231",upCode:"LR"},{code:"ly",name:"Libyan Arab Jamahiriya",prefix:"+218",upCode:"LY"},{code:"li",name:"Liechtenstein",prefix:"+423",upCode:"LI"},{code:"lt",name:"Lithuania",prefix:"+370",upCode:"LT"},{code:"lu",name:"Luxembourg",prefix:"+352",upCode:"LU"},{code:"mo",name:"Macao",prefix:"+853",upCode:"MO"},{code:"mk",name:"Macedonia",prefix:"+389",upCode:"MK"},{code:"mg",name:"Madagascar",prefix:"+261",upCode:"MG"},{code:"mw",name:"Malawi",prefix:"+265",upCode:"MW"},{code:"my",name:"Malaysia",prefix:"+60",upCode:"MY"},{code:"mv",name:"Maldives",prefix:"+960",upCode:"MV"},{code:"ml",name:"Mali",prefix:"+223",upCode:"ML"},{code:"mt",name:"Malta",prefix:"+356",upCode:"MT"},{code:"mh",name:"Marshall Islands",prefix:"+692",upCode:"MH"},{code:"mq",name:"Martinique",prefix:"+596",upCode:"MQ"},{code:"mr",name:"Mauritania",prefix:"+222",upCode:"MR"},{code:"mu",name:"Mauritius",prefix:"+230",upCode:"MU"},{code:"yt",name:"Mayotte",prefix:"+262",upCode:"YT"},{code:"mx",name:"Mexico",prefix:"+52",upCode:"MX"},{code:"fm",name:"Micronesia, Federated States of Micronesia",prefix:"+691",upCode:"FM"},{code:"md",name:"Moldova",prefix:"+373",upCode:"MD"},{code:"mc",name:"Monaco",prefix:"+377",upCode:"MC"},{code:"mn",name:"Mongolia",prefix:"+976",upCode:"MN"},{code:"me",name:"Montenegro",prefix:"+382",upCode:"ME"},{code:"ms",name:"Montserrat",prefix:"+1664",upCode:"MS"},{code:"ma",name:"Morocco",prefix:"+212",upCode:"MA"},{code:"mz",name:"Mozambique",prefix:"+258",upCode:"MZ"},{code:"mm",name:"Myanmar",prefix:"+95",upCode:"MM"},{code:"na",name:"Namibia",prefix:"+264",upCode:"NA"},{code:"nr",name:"Nauru",prefix:"+674",upCode:"NR"},{code:"np",name:"Nepal",prefix:"+977",upCode:"NP"},{code:"nl",name:"Netherlands",prefix:"+31",upCode:"NL"},{code:"nc",name:"New Caledonia",prefix:"+687",upCode:"NC"},{code:"nz",name:"New Zealand",prefix:"+64",upCode:"NZ"},{code:"ni",name:"Nicaragua",prefix:"+505",upCode:"NI"},{code:"ne",name:"Niger",prefix:"+227",upCode:"NE"},{code:"ng",name:"Nigeria",prefix:"+234",upCode:"NG"},{code:"nu",name:"Niue",prefix:"+683",upCode:"NU"},{code:"nf",name:"Norfolk Island",prefix:"+672",upCode:"NF"},{code:"mp",name:"Northern Mariana Islands",prefix:"+1670",upCode:"MP"},{code:"no",name:"Norway",prefix:"+47",upCode:"NO"},{code:"om",name:"Oman",prefix:"+968",upCode:"OM"},{code:"pk",name:"Pakistan",prefix:"+92",upCode:"PK"},{code:"pw",name:"Palau",prefix:"+680",upCode:"PW"},{code:"ps",name:"Palestinian Territory, Occupied",prefix:"+970",upCode:"PS"},{code:"pa",name:"Panama",prefix:"+507",upCode:"PA"},{code:"pg",name:"Papua New Guinea",prefix:"+675",upCode:"PG"},{code:"py",name:"Paraguay",prefix:"+595",upCode:"PY"},{code:"pe",name:"Peru",prefix:"+51",upCode:"PE"},{code:"ph",name:"Philippines",prefix:"+63",upCode:"PH"},{code:"pn",name:"Pitcairn",prefix:"+872",upCode:"PN"},{code:"pl",name:"Poland",prefix:"+48",upCode:"PL"},{code:"pt",name:"Portugal",prefix:"+351",upCode:"PT"},{code:"pr",name:"Puerto Rico",prefix:"+1939",upCode:"PR"},{code:"qa",name:"Qatar",prefix:"+974",upCode:"QA"},{code:"ro",name:"Romania",prefix:"+40",upCode:"RO"},{code:"ru",name:"Russia",prefix:"+7",upCode:"RU"},{code:"rw",name:"Rwanda",prefix:"+250",upCode:"RW"},{code:"re",name:"Reunion",prefix:"+262",upCode:"RE"},{code:"bl",name:"Saint Barthelemy",prefix:"+590",upCode:"BL"},{code:"sh",name:"Saint Helena, Ascension and Tristan Da Cunha",prefix:"+290",upCode:"SH"},{code:"kn",name:"Saint Kitts and Nevis",prefix:"+1869",upCode:"KN"},{code:"lc",name:"Saint Lucia",prefix:"+1758",upCode:"LC"},{code:"mf",name:"Saint Martin",prefix:"+590",upCode:"MF"},{code:"pm",name:"Saint Pierre and Miquelon",prefix:"+508",upCode:"PM"},{code:"vc",name:"Saint Vincent and the Grenadines",prefix:"+1784",upCode:"VC"},{code:"ws",name:"Samoa",prefix:"+685",upCode:"WS"},{code:"sm",name:"San Marino",prefix:"+378",upCode:"SM"},{code:"st",name:"Sao Tome and Principe",prefix:"+239",upCode:"ST"},{code:"sa",name:"Saudi Arabia",prefix:"+966",upCode:"SA"},{code:"sn",name:"Senegal",prefix:"+221",upCode:"SN"},{code:"rs",name:"Serbia",prefix:"+381",upCode:"RS"},{code:"sc",name:"Seychelles",prefix:"+248",upCode:"SC"},{code:"sl",name:"Sierra Leone",prefix:"+232",upCode:"SL"},{code:"sg",name:"Singapore",prefix:"+65",upCode:"SG"},{code:"sk",name:"Slovakia",prefix:"+421",upCode:"SK"},{code:"si",name:"Slovenia",prefix:"+386",upCode:"SI"},{code:"sb",name:"Solomon Islands",prefix:"+677",upCode:"SB"},{code:"so",name:"Somalia",prefix:"+252",upCode:"SO"},{code:"za",name:"South Africa",prefix:"+27",upCode:"ZA"},{code:"ss",name:"South Sudan",prefix:"+211",upCode:"SS"},{code:"gs",name:"South Georgia and the South Sandwich Islands",prefix:"+500",upCode:"GS"},{code:"es",name:"Spain",prefix:"+34",upCode:"ES"},{code:"lk",name:"Sri Lanka",prefix:"+94",upCode:"LK"},{code:"sd",name:"Sudan",prefix:"+249",upCode:"SD"},{code:"sr",name:"Suriname",prefix:"+597",upCode:"SR"},{code:"sj",name:"Svalbard and Jan Mayen",prefix:"+47",upCode:"SJ"},{code:"sz",name:"Swaziland",prefix:"+268",upCode:"SZ"},{code:"se",name:"Sweden",prefix:"+46",upCode:"SE"},{code:"ch",name:"Switzerland",prefix:"+41",upCode:"CH"},{code:"sy",name:"Syrian Arab Republic",prefix:"+963",upCode:"SY"},{code:"tw",name:"Taiwan",prefix:"+886",upCode:"TW"},{code:"tj",name:"Tajikistan",prefix:"+992",upCode:"TJ"},{code:"tz",name:"Tanzania, United Republic of Tanzania",prefix:"+255",upCode:"TZ"},{code:"th",name:"Thailand",prefix:"+66",upCode:"TH"},{code:"tl",name:"Timor-Leste",prefix:"+670",upCode:"TL"},{code:"tg",name:"Togo",prefix:"+228",upCode:"TG"},{code:"tk",name:"Tokelau",prefix:"+690",upCode:"TK"},{code:"to",name:"Tonga",prefix:"+676",upCode:"TO"},{code:"tt",name:"Trinidad and Tobago",prefix:"+1868",upCode:"TT"},{code:"tn",name:"Tunisia",prefix:"+216",upCode:"TN"},{code:"tr",name:"Turkey",prefix:"+90",upCode:"TR"},{code:"tm",name:"Turkmenistan",prefix:"+993",upCode:"TM"},{code:"tc",name:"Turks and Caicos Islands",prefix:"+1649",upCode:"TC"},{code:"tv",name:"Tuvalu",prefix:"+688",upCode:"TV"},{code:"ug",name:"Uganda",prefix:"+256",upCode:"UG"},{code:"ua",name:"Ukraine",prefix:"+380",upCode:"UA"},{code:"ae",name:"United Arab Emirates",prefix:"+971",upCode:"AE"},{code:"gb",name:"United Kingdom",prefix:"+44",upCode:"GB"},{code:"us",name:"United States",prefix:"+1",upCode:"US"},{code:"uy",name:"Uruguay",prefix:"+598",upCode:"UY"},{code:"uz",name:"Uzbekistan",prefix:"+998",upCode:"UZ"},{code:"vu",name:"Vanuatu",prefix:"+678",upCode:"VU"},{code:"ve",name:"Venezuela, Bolivarian Republic of Venezuela",prefix:"+58",upCode:"VE"},{code:"vn",name:"Vietnam",prefix:"+84",upCode:"VN"},{code:"vg",name:"Virgin Islands, British",prefix:"+1284",upCode:"VG"},{code:"vi",name:"Virgin Islands, U.S.",prefix:"+1340",upCode:"VI"},{code:"wf",name:"Wallis and Futuna",prefix:"+681",upCode:"WF"},{code:"ye",name:"Yemen",prefix:"+967",upCode:"YE"},{code:"zm",name:"Zambia",prefix:"+260",upCode:"ZM"},{code:"zw",name:"Zimbabwe",prefix:"+263",upCode:"ZW"}];function countryFlagCtrl($scope,$document,$element){var originalPhone,vm=this,phoneInputFirstChange=!1;vm.focusHandler=function(focusStatus){vm.inputFocus&&vm.inputFocus(focusStatus)};$document[0].body.addEventListener("click",(function(event){var isChild=$element[0].contains(event.target),isSelf=$element[0]===event.target;isChild||isSelf||($scope.searchInput="",vm.isDropdownActive=!1,$scope.$apply())})),vm.prefix="",vm.code="",vm.isDropdownActive=!1;$scope.$watch("searchInput",(function(){var _a;if((null===(_a=$scope.searchInput)||void 0===_a?void 0:_a.length)>0){var str_1=$scope.searchInput.toLowerCase(),tempList=[];2===$scope.searchInput.length&&(tempList=countries.filter((function(country){return-1!==country.code.indexOf(str_1)}))),tempList.length>0?vm.countryList=tempList:vm.countryList=countries.filter((function(country){return-1!==country.name.toLowerCase().indexOf(str_1)||-1!==country.code.indexOf(str_1)||-1!==country.prefix.indexOf(str_1)}))}else vm.countryList=countries})),$scope.$watch("phone",(function(){var _a;try{if($scope.phone&&originalPhone!==$scope.phone){if($scope.phone=$scope.phone.replace(/\D/g,""),$scope.phone.length>0){var phoneStr=void 0;if(vm.prefix){var validationResult=window.libphonenumber.parsePhoneNumber(vm.prefix+$scope.phone);validationResult.country&&($scope.phone=validationResult.nationalNumber),phoneStr=(vm.prefix+$scope.phone).split("+")[1]}else phoneStr=$scope.phone;vm.onUpdate(phoneStr),phoneInputFirstChange=!0}}else 0===(null===(_a=$scope.phone)||void 0===_a?void 0:_a.length)&&vm.onUpdate("")}catch(e){return null}})),$scope.$watch("originalValue",(function(){if($scope.originalValue&&!phoneInputFirstChange){phoneInputFirstChange=!0,originalPhone=$scope.originalValue,$scope.phone=originalPhone;var phoneNumber=void 0;phoneNumber=-1!==$scope.originalValue.indexOf("+")?$scope.originalValue:"+"+$scope.originalValue;var res=window.libphonenumber.parsePhoneNumber(phoneNumber);res.country&&(vm.code=res.country.toLowerCase(),vm.countryUpdate(res.country),vm.prefix="+"+res.countryCallingCode,$scope.phone=res.nationalNumber)}})),$scope.$watch("country",(function(){if($scope.country&&!$scope.phone){var country=getCountryFromList($scope.country);country&&(vm.prefix=country.prefix,vm.code=country.code,vm.countryUpdate(country.code))}}));var getCountryFromList=function(country){for(var listLength=countries.length,i=0;i<listLength;i++)if(-1!==country.toLowerCase().indexOf(countries[i].name.toLowerCase())||-1!==country.toLowerCase().indexOf(countries[i].code.toLowerCase()))return countries[i]};$scope.clickHandler=function(prefix,code){if(vm.isDropdownActive=!1,vm.prefix=prefix,vm.code=code,$scope.searchInput="",$scope.phone){var validationResult=window.libphonenumber.parsePhoneNumber(vm.prefix+$scope.phone);validationResult.country&&($scope.phone=validationResult.nationalNumber),vm.onUpdate((vm.prefix+$scope.phone).split("+")[1])}vm.countryUpdate(code),phoneInputFirstChange=!0},$scope.dropdownTrigger=function(){vm.isDropdownActive=!vm.isDropdownActive},vm.countryList=countries}angular.module("nbiSubmodules").directive("countryFlag",["$document",function($document){return{bindToController:{onUpdate:"=",originalValue:"=",country:"=",projectName:"@",theme:"=",inputFocus:"=",countryUpdate:"=",checkPrefix:"="},scope:{originalValue:"=",country:"="},controllerAs:"vm",controller:countryFlagCtrl,template:window.FLAG_PHONE_PICKER_HTML,restrict:"E"}}])}();
!function(){"use strict";function link(){}function Controller($scope,$timeout){var timer,vm=this;function updateParent(value){vm.internalValue=value,timer&&$timeout.cancel(timer),timer=$timeout((function(){vm.value=value}),800)}vm.internalValue=0,vm.increment=function(dir){if("up"===dir)return vm.internalValue++,void updateParent(vm.internalValue);vm.internalValue&&0!==vm.internalValue&&(vm.internalValue--,updateParent(vm.internalValue))},$scope.$watch("vm.value",(function(newValue){vm.internalValue=newValue})),$scope.$watch("vm.internalValue",updateParent)}Controller.$inject=["$scope","$timeout"],angular.module("giftCardsWidget").directive("spinner",(function(){return{bindToController:!0,controller:Controller,templateUrl:"app/directives/spinner/spinner.html",controllerAs:"vm",link:link,scope:{value:"=",label:"@"},restrict:"E"}}))}();
!function(){"use strict";function link(){}function Controller($rootScope,$scope,appData){var autocomplete,vm=this;vm.internalValue={},vm.geolocate=function(){if(!navigator.geolocation)return;navigator.geolocation.getCurrentPosition((function(position){var geolocation={lat:position.coords.latitude,lng:position.coords.longitude},circle=new google.maps.Circle({center:geolocation,radius:position.coords.accuracy});autocomplete.setBounds(circle.getBounds())}))},vm.isSubmitted,vm.busy;var addressMap={subpremise:"short_name",street_number:"short_name",route:"short_name",locality:"short_name",administrative_area_level_1:"short_name",country:"long_name",postal_code:"short_name",sublocality_level_1:"short_name",formatted_address:"short_name"};function updateInternalValues(value){value&&Object.keys(value).length&&(vm.internalValue=value,vm.isFormActive=!0,updateInputs(value))}function updateInputs(value){for(var key in value){var htmlElement=document.getElementById(key);htmlElement&&value[key]&&value[key].length&&(htmlElement.className=getUpdatedClassName(htmlElement))}}function getUpdatedClassName(htmlElement){return htmlElement.className.replace("is-invalid","")+(htmlElement.className.indexOf("ng-touched")>=0?"":" ng-touched")+(htmlElement.className.indexOf("is-dirty")>=0?"":" is-dirty")}function parseGooglePlace(){var userInput=vm.internalValue.formattedAddress,addressValue={},place=autocomplete.getPlace();if(place.address_components.length){addressValue.place_id=place.place_id,addressValue.reference=place.reference,addressValue.formatted_address=place.formatted_address;for(var i=0;i<place.address_components.length;i++){var addressType=place.address_components[i].types[0];if(addressMap[addressType]){var value="";if("street_number"===addressType&&0===i){var delimiter=place.address_components[i][addressMap[addressType]];userInput.indexOf(delimiter)&&(value+=userInput.split(delimiter)[0],addressValue.formatted_address=userInput.split(delimiter)[0]+addressValue.formatted_address)}value+=place.address_components[i][addressMap[addressType]],addressValue[addressType]=value}}!function(value){if(!value)return void(vm.value={});var valueMap=function(country){if("New Zealand"===country)return{address:["subpremise","street_number","route"],country:"country",postcode:"postal_code",suburb:"sublocality_level_1",city:"administrative_area_level_1",formattedAddress:"formatted_address",state:""};return{address:["subpremise","street_number","route"],country:"country",postcode:"postal_code",suburb:"locality",city:"",formattedAddress:"formatted_address",state:"administrative_area_level_1"}}(value.country);for(var key in valueMap)if(Array.isArray(valueMap[key])){for(var values=[],i=0;i<valueMap[key].length;i++){var keyValue=valueMap[key][i];values.push(value[keyValue])}vm.internalValue[key]=values.join(" ")}else vm.internalValue[key]=value[valueMap[key]];vm.isFormActive=!0,updateInputs(vm.internalValue),$scope.$apply()}(addressValue)}else vm.value={}}function getBounds(country){var lat=25.2744,lng=133.7751;return"NZ"===country&&(lat=40.9006,lng=174.886),new google.maps.LatLngBounds(new google.maps.LatLng(lat,lng),new google.maps.LatLng(lat,lng))}function internalUpdate(newValue){vm.addressForm.$valid&&formChanged(vm.addressForm.$valid)}function formChanged(newValue,lastValue){if(newValue!==lastValue)if(newValue&&Object.keys(vm.internalValue).length){var updatedValue={};for(var key in vm.internalValue)updatedValue[key]=vm.internalValue[key];vm.value=updatedValue}else vm.value=void 0}$rootScope.$on("form-submitted",(function(){vm.isSubmitted=!0})),$scope.$watch("vm.addressForm.$valid",formChanged),$scope.$watch("vm.value",updateInternalValues),$scope.$watch("vm.internalValue.address",internalUpdate),$scope.$watch("vm.internalValue.address2",internalUpdate),$scope.$watch("vm.internalValue.locality",internalUpdate),$scope.$watch("vm.internalValue.administrativeAreaLevel1",internalUpdate),$scope.$watch("vm.internalValue.postcode",internalUpdate),function(){var _a,_b;vm.isBusy=!0,vm.country||(vm.country=(null===(_b=null===(_a=null==appData?void 0:appData.gcw)||void 0===_a?void 0:_a.venue)||void 0===_b?void 0:_b.country)||"AU");updateInternalValues(vm.value),input=document.getElementById("address-autocomplete"),options={types:["geocode"],bounds:getBounds(vm.country)},console.log("google: ",google),(autocomplete=new google.maps.places.Autocomplete(input,options)).addListener("place_changed",parseGooglePlace);var input,options}()}Controller.$inject=["$rootScope","$scope","appData"],angular.module("giftCardsWidget").directive("address",(function(){return{bindToController:!0,controller:Controller,templateUrl:"app/directives/address/address.html",controllerAs:"vm",link:link,scope:{value:"=",country:"="},restrict:"E"}}))}();
!function(){"use strict";function Controller($rootScope,appData,languageService,appValues,$window){var vm=this;function createShade(colour){var values=colour.split(",");return(parseInt(values[0])>0?colourValue(values[0]):0)+","+(parseInt(values[1])>0?colourValue(values[1]):0)+","+(parseInt(values[2])>0?colourValue(values[2]):0)}function colourValue(int){return Math.round(.92*parseInt(int))}vm.isBgTransparent=-1!==window.location.search.indexOf("&background=transparent"),vm.appData=appData.gcw,$rootScope.$on("language-changed",(function(){vm.language=languageService.selectedLanguage})),function(){if(!vm.appData.params)return;var theme=vm.appData.params.theme||void 0,accent=vm.appData.params.accent||"0, 149, 135",bg=vm.appData.params.bg?"url('assets/images/"+vm.appData.params.bg+".png')":"";vm.theme=function(theme,accent,bg){switch(theme){case"dark":return{accent:accent,accentText:"255,255,255",accentHover:createShade(accent),background:"0,0,0",defaultHover:"0,0,0",line:"255,255,255",border:"25, 25, 25",backgroundFeature:"7, 7, 7",text:"255,255,255",inputLabel:"255, 255, 255",error:"255, 0, 0",type:"dark",bg:bg};case"light":return{accent:accent,accentText:"255,255,255",accentHover:createShade(accent),background:"255,255,255",defaultHover:"248, 248, 248",line:"0,0,0",border:"222, 222, 222",backgroundFeature:"250, 250, 250",text:"55, 55, 55",inputLabel:"159, 159, 159",error:"222, 50, 38",type:"light",bg:bg};case"blueGrey":return{accent:accent,accentText:"255,255,255",accentHover:createShade(accent),background:"62,70,76",defaultHover:"101, 111, 117",line:"255,255,255",border:"124, 124, 124",backgroundFeature:"126, 126, 126",text:"255, 255, 255",inputLabel:"159, 159, 159",error:"167, 15, 15",type:"dark",bg:bg};default:return{accent:"0, 149, 135",accentText:"255,255,255",accentHover:createShade("0, 149, 135"),background:"255,255,255",defaultHover:"248, 248, 248",line:"0,0,0",border:"222, 222, 222",backgroundFeature:"250, 250, 250",text:"55, 55, 55",inputLabel:"159, 159, 159",error:"222, 50, 38",type:"light",bg:bg}}}(theme,accent,bg),vm.language=languageService.selectedLanguage||languageService.getDefaultLanguageFromBrowser($window.navigator.language),vm.currency=appValues.DEFAULT_CURRENCY_UNIT}()}Controller.$inject=["$rootScope","appData","languageService","appValues","$window"],angular.module("giftCardsWidget").directive("theme",(function(){var directive={bindToController:!0,controller:Controller,controllerAs:"vm",templateUrl:"app/theme/theme.html",link:function(){},restrict:"E",scope:{}};return directive}))}();
!function(){"use strict";function Service($rootScope,$location,appValues,appData){var vm=this;vm.init=function(){(function(){var params=$location.search();if(!Object.keys(params).length&&appData.gcw.params&&appData.gcw.params.accountid)return;if(!appData.params)return appData.gcw.params={},void(appData.gcw.params=params);if(params.accountid!==appData.gcw.params.accountid)return appData.gcw.params={},void(appData.gcw.params=params);if(params.venueid!==appData.gcw.params.venueid)appData.gcw.params={},appData.gcw.params=params})(),$rootScope.$on("$stateChangeStart",(function(event,toState,toParams,fromState,fromParams){window.scrollTo(0,0),function(toState,fromState){return!fromState.name.length||"app"===toState.name}(toState,fromState)?$rootScope.$emit("refresh-app"):function(toState,fromState){var route=appValues.ROUTES.find((function(route){return route.name===toState.name}));return route.isDisabled}(toState)&&event.preventDefault()})),$rootScope.$on("$stateChangeSuccess",(function(event,toState){vm.currState=toState.name,"complete"!==toState.name&&"error"!==toState.name||$rootScope.$emit("reset-routes"),function(currRoute){for(var i=0;i<appValues.ROUTES.length;i++){var route=appValues.ROUTES[i];route.isActive=route.name===currRoute}}(toState.name)}))},vm.params=$location.search(),vm.currState,$rootScope.$on("route-status-change",(function(event,args){for(var i=0;i<appValues.ROUTES.length;i++){var route=appValues.ROUTES[i],nextRoute=appValues.ROUTES[i+1];route.name===args.route&&args.isComplete&&(route.isDisabled=!1,nextRoute.isDisabled=!1),route.name!==args.route||args.isComplete||(nextRoute.isDisabled=!0)}}))}Service.$inject=["$rootScope","$location","appValues","appData"],angular.module("giftCardsWidget").service("stateService",Service)}();
!function(){"use strict";function Service($http,appValues){var i18next=window.i18next,isLocal="local"===window.ENV,vm=this;vm.selectedLanguage,vm.loadi18Next=function(lang){var loadPathVal=isLocal?"assets/language/"+lang+".json":"assets/language/"+lang+"-"+appValues.VERSION+".json";return new Promise((function(resolve,reject){vm.selectedLanguage=lang,i18next&&i18next.use(i18nextXHRBackend).init({debug:!1,lng:lang,fallbackLng:"en",backend:{loadPath:loadPathVal},useCookie:!1,useLocalStorage:!1,keySeparator:!1},(function(err,t){err?(console.error("Failed to load i18next resources",err),reject(err)):(console.log("loaded i18next",lang),resolve())}))}))},vm.localizeWithCount=localizeWithCount,vm.localizeWithAmount=localizeWithAmount,vm.getDefaultLanguageFromBrowser=function(language){var defaultLanguage=language.split("-")[0];if(!appValues.SUPPORTED_LANGUAGE.includes(defaultLanguage))return"en";return defaultLanguage}}Service.$inject=["$http","appValues"],angular.module("giftCardsWidget").service("languageService",Service);var reCount=/(?:\d+,?)*\d+(\.\d*)?/,PLACEHOLDER_COUNT="{{ count }}";function localizeWithCount(src){var count=void 0,key=src.replace(reCount,(function(match){return count=+match.replace(/,/g,""),PLACEHOLDER_COUNT}));return i18next.t(key,{count:count})}var reAmount=/((\$|£)\s*(?:\d+,?)*\d+(\.\d*)?)/,PLACEHOLDER_AMOUNT="{{ amount }}";function localizeWithAmount(src){var amount=void 0,key=src.replace(reAmount,(function(match){return amount=match,PLACEHOLDER_AMOUNT}));return i18next.t(key,{amount:amount})}}();
!function(){"use strict";angular.module("giftCardsWidget").service("errorTrackingService",(function(){this.errorCode}))}();
!function(){"use strict";function Service($filter){this.dateFullLong=function(date){return $filter("date")(date,"EEEE, MMMM d, y")},this.dateFullMonthDay=function(date){var suffixes=["th","st","nd","rd"],dtfilter=$filter("date")(date,"MMMM d"),day=parseInt(dtfilter.slice(-2)),relevantDigits=day<30?day%20:day%30;return dtfilter+(relevantDigits<=3?suffixes[relevantDigits]:suffixes[0])},this.dateYearMonthDay=function(date){return $filter("date")(date,"yyyy-M-d")},this.convertTimeStrToDate=function(date,timeStr){date=date._d?date.toDate():new Date(date);date=angular.copy(date);var timeBreakdown=timeStr.split(":"),hours=Number(timeBreakdown[0]),minutes=Number(timeBreakdown[1].substring(0,2));return"pm"===timeBreakdown[1].substring(2,4)&&hours<12&&(hours+=12),date.setHours(hours),date.setMinutes(minutes),date.setSeconds(0),date.setMilliseconds(0),date},this.getCorrectTime=function(timeZone){var browserTime=moment().format();return moment.tz(browserTime,timeZone).format("YYYY-MM-DD h:mm:ss a")},this.dateToTimeOnly=function(date){return $filter("date")(date,"h:mm a")},this.getLocalDateJs=function(){var a=moment().format().split(/[^0-9]/);return new Date(a[0],a[1]-1,a[2],a[3],a[4],a[5])},this.getJsDate=function(date){var a=date.split(/[^0-9]/);return new Date(a[0],a[1]-1,a[2],a[3],a[4],a[5])}}Service.$inject=["$filter"],angular.module("giftCardsWidget").service("dateUtils",Service)}();
!function(){"use strict";angular.module("giftCardsWidget").service("customMethods",(function(){this.init=function(){String.prototype.firstCharToLowercase=function(value){return value.charAt(0).toLowerCase()+value.substr(1,value.length)},Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(predicate){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var value,list=Object(this),length=list.length>>>0,thisArg=arguments[1],i=0;i<length;i++)if(value=list[i],predicate.call(thisArg,value,i,list))return value}}),Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof predicate)throw new TypeError("predicate must be a function");for(var value,list=Object(this),length=list.length>>>0,thisArg=arguments[1],i=0;i<length;i++)if(value=list[i],predicate.call(thisArg,value,i,list))return i}}),Math.precisionRound||(Math.precisionRound=function(value,decimals){return Number(Math.round(value+"e"+decimals)+"e-"+decimals).toFixed(2)})}}))}();
!function(){"use strict";function Service($http,appValues,appData){var vm=this;function sendPaymentIntentRequest(accountId,venueId,paymentintentGC,recaptchaToken){return paymentintentGC.recaptchaV3Token=recaptchaToken,$http.post(appValues.APIBASE+"/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/payment-intent-GC",paymentintentGC,{cache:!0}).then((function(response){return response.data}))}vm.getAccount=function(id){return $http.get("api/gift-cards/accounts/"+id,{cache:!0}).then((function(response){return response.data}))},vm.getCards=function(accountId,venueId){return $http.get("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/gift-card-types",{cache:!0}).then((function(response){return response.data}))},vm.getOrderTotals=function(accountId,venueId,order){return $http.post("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/payment-summary",order,{cache:!0}).then((function(response){return response.data}))},vm.paynow=function(accountId,venueId,order){return $http.post("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/paynow",order,{cache:!0}).then((function(response){return response.data}))},vm.paynow3D=function(accountId,venueId,order){return $http.post("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/finalisePaynow3DSecure",order,{cache:!0}).then((function(response){return response.data}))},vm.preCompletionCheck=function(accountId,venueId,purchaseOrderId){return $http.get("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/pre-completion/"+purchaseOrderId,{cache:!0}).then((function(response){return response.data}))},vm.complete=function(accountId,venueId,summary){return $http.post("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/completed",summary,{cache:!0}).then((function(response){return response.data}))},vm.paymentIntentGC=function(accountId,venueId,paymentintentGC){var venue=appData.gcw.venue;if(venue.giftCardSettings.enableGiftCardRecaptchaV3&&venue.captchaConfig.siteKeyV3)return(config=venue.captchaConfig,new Promise((function(resolve,reject){grecaptcha.enterprise.ready((function(){grecaptcha.enterprise.execute(config.siteKeyV3,{action:config.action}).then((function(token){resolve(token)})).catch((function(error){reject(error)}))}))}))).then((function(recaptchaToken){return sendPaymentIntentRequest(accountId,venueId,paymentintentGC,recaptchaToken)})).catch((function(error){console.error("Error:",error)}));var config;return sendPaymentIntentRequest(accountId,venueId,paymentintentGC)},vm.logFailedGCPaymentDetails=function(accountId,venueId,logDetails){$http.post("api/gift-cards/accounts/"+accountId+"/venues/"+venueId+"/log-failed-GC-payment/",logDetails,{cache:!0}).then((function(){console.log("details logged")}))}}Service.$inject=["$http","appValues","appData"],angular.module("giftCardsWidget").service("client",Service)}();
!function(){"use strict";function Service($interpolate,appValues){var messages,messageVariables;function updateMessageVariables(obj,ignore){for(var key in obj){if(key===ignore)break;"string"!=typeof obj[key]&&"number"!=typeof obj[key]||(appValues.TO_DECIMAL_FIELDS.indexOf(key)>=0?messageVariables[key]=Math.precisionRound(+obj[key],2):messageVariables[key]=obj[key].toString()),"object"!=typeof obj[key]||Array.isArray(obj[key])||updateMessageVariables(obj[key],ignore)}}function updateMessages(obj,ignore){for(var key in obj){if(key===ignore)break;"string"!=typeof obj[key]&&"number"!=typeof obj[key]||(messages[key]=Mustache.render(obj[key].toString(),messageVariables)),"object"!=typeof obj[key]||Array.isArray(obj[key])||updateMessages(obj[key],ignore)}}this.getMessages=function(obj,ignore){return messages={},messageVariables={},updateMessageVariables(obj,ignore),updateMessages(obj,ignore),messages}}Service.$inject=["$interpolate","appValues"],angular.module("giftCardsWidget").service("appMessages",Service)}();
!function(){"use strict";function Service($sessionStorage){this.gcw={}}Service.$inject=["$sessionStorage"],angular.module("giftCardsWidget").service("appData",Service)}();
!function(){"use strict";function Service($rootScope,$window){var vm=this,reporters=[];function gtag(){console.log("gtag",arguments),dataLayer.push(arguments)}function pageView(pageName,url){isActive("countly")&&countlyEvent("Page view",{page:pageName}),isActive("facebook")&&function(pageName){fbq("trackCustom",pageName,{content_category:vm.venue.venueName})}(pageName),(isActive("googleAnalytics")||isActive("googleTagManager"))&&function(pageName,url){var data={event_category:"Page View",event_label:vm.venue.venueName};addGA4Info(data),gtag("event",pageName,data),gtag("config",vm.venue.analytics.googleApi,{page_title:pageName,page_path:url,event_label:vm.venue.venueName})}(pageName,url)}function countlyEvent(eventName,values){values||(values={});var event=function(name,values){return values.accountId=vm.accountId,values.venueName=vm.venue&&vm.venue.venueName?vm.venue.venueName:null,values.venueId=vm.venue&&vm.venue.id?vm.venue.id:null,{key:name,segmentation:values}}(eventName,values);Countly.add_event(event)}function addGA4Info(data){isGA4()&&(data.venue_name=data.event_label)}function isActive(key){return-1!==reporters.indexOf(key)}function isGA4(){return!!vm.googleApiKey&&0===vm.googleApiKey.indexOf("G-")}vm.init=function(accountId,venue){if(vm.accountId=accountId,function(){if(isActive("pageListener"))return;reporters.push("pageListener"),$rootScope.$on("$stateChangeSuccess",(function(evt,page){page.analyticsName&&pageView(page.analyticsName,page.url)}))}(),!venue)return;vm.venue=venue,function(id){if(!id||isActive("facebook"))return;reporters.push("facebook"),f=window,b=document,e="script",v="https://connect.facebook.net/en_US/fbevents.js",f.fbq||(n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)},f._fbq||(f._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[],(t=b.createElement(e)).async=!0,t.src=v,(s=b.getElementsByTagName(e)[0]).parentNode.insertBefore(t,s)),fbq("init",id),fbq("track","PageView");var f,b,e,v,n,t,s}(venue&&venue.analytics&&venue.analytics.facebook&&venue.analytics.facebook.apiKey?venue.analytics.facebook.apiKey:null);var googleApiKey=venue&&venue.analytics&&venue.analytics.google&&venue.analytics.google.apiKey?venue.analytics.google.apiKey:null;if(vm.googleApiKey=googleApiKey,!googleApiKey)return;0===googleApiKey.indexOf("GTM-")&&function(id){if(!id||isActive("googleTagManager"))return;reporters.push("googleTagManager"),function(w,d,s,l,i){w[l]=w[l]||[],w[l].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl="dataLayer"!=l?"&l="+l:"";j.async=!0,j.src="https://www.googletagmanager.com/gtm.js?id="+i+dl,f.parentNode.insertBefore(j,f)}(window,document,"script","dataLayer",id)}(googleApiKey);(0===googleApiKey.indexOf("UA-")||isGA4())&&function(id){if(!id||isActive("googleAnalytics"))return;reporters.push("googleAnalytics");var s=document.createElement("script");s.async=!0,s.src="https://www.googletagmanager.com/gtag/js?id="+id,document.getElementsByTagName("body")[0].appendChild(s),window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config",id,{send_page_view:!1})}(googleApiKey)},vm.event=function(category,name,values){isActive("countly")&&countlyEvent(name,values);isActive("facebook")&&function(category,name){fbq("trackCustom",name,{content_category:vm.venue.venueName})}(0,name);(isActive("googleAnalytics")||isActive("googleTagManager"))&&function(category,name){var data={event_category:category,event_label:vm.venue.venueName};addGA4Info(data),gtag("event",name,data)}(category,name)},vm.pageView=pageView,vm.accountId=null,vm.venue=null,vm.googleApiKey=null}Service.$inject=["$rootScope","$window"],angular.module("giftCardsWidget").service("analytics",Service)}();
!function(){"use strict";function Controller($rootScope,$state,$log,appData,appMessages,client){var vm=this;vm.appData=appData.gcw,vm.account=appData.gcw.account,vm.selectVenue=function(venue){$rootScope.$broadcast("route-status-change",{route:"venues",isComplete:!0}),$rootScope.$broadcast("update-venue",{venue:venue}),$rootScope.$broadcast("navigate-to",{name:"next"})},vm.appData.venue||$rootScope.$broadcast("route-status-change",{route:"venues",isComplete:!1})}Controller.$inject=["$rootScope","$state","$log","appData","appMessages","client"],angular.module("giftCardsWidget").controller("VenuesCtrl",Controller)}();
!function(){"use strict";function Controller($scope){}Controller.$inject=["$scope"],angular.module("giftCardsWidget").directive("summary",(function(){var directive={bindToController:!0,controller:Controller,templateUrl:"app/widget/summaryDetails/summary.html",controllerAs:"vm",replace:!0,link:function($scope,element,attrs){},restrict:"E",scope:{}};return directive}))}();
!function(){"use strict";function Controller($rootScope,$scope,$log,$timeout,$sce,$state,appData,appValues,client,$http,languageService,$i18next){var cardie,stripie,venue,vm=this;vm.appData=appData.gcw,vm.venue=appData.gcw.venue,vm.order=appData.gcw.order,vm.payment=vm.appData.payment,vm.messages=appData.gcw.messages.venue,vm.busy,vm.language=languageService.selectedLanguage,vm.pay=function(){if(vm.isSubmitted=!0,!vm.form.$valid)return;if(vm.isButtonDisabled=!0,"eway"===vm.payment.provider)return vm.busy=!0,void client.preCompletionCheck(vm.appData.account.id,vm.appData.venue.id,vm.appData.payment.purchaseOrderId).then((function(data){var element=document.getElementById("gcw-payment-form");element.action=vm.payment.formActionUrl,function(element){vm.busy=!0,eWAY.process(element,{autoRedirect:!1,onComplete:ewayOnComplete,onError:ewayOnError,onTimeout:ewayOnTimeout})}(element)})).catch((function(err){vm.busy=!1,$rootScope.$broadcast("process-error",{error:{status:"Timeout"},message:"Your order timed out."})}));"eway"!==vm.venue.paymentSettings.paymentProvider.toLowerCase()?(vm.busy=!0,stripie.createToken(cardie).then((function(result){if(result.error)processStripeError(result.error.message);else{$scope.tok=result.token,vm.loading=!1,vm.enteringDetails=!1;var paymentDetails=Object.assign({},vm.order);paymentDetails&&vm.order&&vm.venue&&(paymentDetails.Amount=vm.order.grandTotal,paymentDetails.Currency=vm.venue.currency,paymentDetails.venueId=vm.venue.id,null!=vm.order.orders&&vm.order.orders.length>0&&(paymentDetails.GiftCardId=vm.order.orders[0].id,paymentDetails.orders=vm.order.orders,paymentDetails.discountCode=vm.order.discountCode)),paymentDetails.recaptchaV2Token=vm.recaptchaV2Token,client.paymentIntentGC(vm.appData.account.id,vm.venue.id,paymentDetails).then((function(response){stripie.confirmCardPayment(response.toString(),{payment_method:{card:{token:$scope.tok.id}}}).then((function(result){if(result.error){if(null!=result.error.decline_code)return vm.busy=!1,void processStripeError(result.error.decline_code);if(null!=result.error.code)return vm.busy=!1,void processStripeError(result.error.code)}else if("succeeded"===result.paymentIntent.status)vm.appData.order.StripePaymentToken=result.paymentIntent.id,vm.isFormDisabled=!0,vm.loading=!0,client.paynow3D(vm.appData.account.id,vm.appData.venue.id,vm.appData.order).then((function(data){vm.isFormDisabled=!1,vm.loading=!1,vm.busy=!1,$rootScope.$broadcast("navigate-to",{name:"next"})})).catch((function(err){vm.busy=!1,processStripeError(err.message)}));else{var logfailedPaymentDetails='{"transactionId":"'+result.paymentIntent.id+'","status":"'+result.paymentIntent.status+'","confirmationMethod":"'+result.paymentIntent.confirmation_method+'", "description":"'+result.paymentIntent.description+'","lastPaymentError" : "'+result.paymentIntent.last_payment_error+'"}';client.logFailedGCPaymentDetails(vm.appData.account.id,vm.venue.id,logfailedPaymentDetails)}}))}),(function(response){console.log("error 3"),$rootScope.$broadcast("process-error",err)})).catch((function(err){console.log("error 1"),$rootScope.$broadcast("process-error",err)}))}})).catch((function(err){console.log("error 2"),$rootScope.$broadcast("process-error",err)}))):(vm.busy=!0,Stripe.card.createToken({number:vm.paymentDTO.EWAY_CARDNUMBER,cvc:vm.paymentDTO.EWAY_CARDCVN,exp_month:vm.paymentDTO.EWAY_CARDEXPIRYMONTH,exp_year:vm.paymentDTO.EWAY_CARDEXPIRYYEAR},processStripe))},vm.requestDiscount=function(){if(vm.isDiscountRequested=!0,!vm.form.$valid)return;vm.busy=!0,client.getOrderTotals(vm.appData.account.id,vm.appData.venue.id,vm.appData.order).then((function(data){vm.busy=!1,vm.isDiscountValid=!0,vm.order=orderSummary.getOrderSummary(vm.appData.venue,data)})).catch((function(err){vm.isDiscountValid=!1}))},vm.cancel=function(){$rootScope.$emit("refresh-app")},vm.back=function(){$rootScope.$on("app-busy"),$rootScope.$broadcast("navigate-to",{name:"back"})},(venue=vm.venue).giftCardSettings.enableGiftCardRecaptchaV2&&grecaptcha&&venue.captchaConfig.siteKeyV2&&setTimeout((function(){grecaptcha.enterprise.render("g-recaptcha-v2",{sitekey:venue.captchaConfig.siteKeyV2,action:venue.captchaConfig.action,callback:function(response){vm.recaptchaV2Token=response},lang:vm.language,hl:vm.language})}),1e3);var listeners=[];function processStripe(status,response){response.error?processStripeError($i18next.t(response.error.message,{lng:vm.language})):function(token){vm.appData.order.stripePaymentToken=token,client.paynow(vm.appData.account.id,vm.appData.venue.id,vm.appData.order).then((function(data){data.success?$rootScope.$broadcast("navigate-to",{name:"next"}):$rootScope.$broadcast("process-error",data.errorMessage)})).catch((function(err){$rootScope.$broadcast("process-error",err)}))}(response.id)}function processStripeError(message){var modal={};modal.heading=$i18next.t("Payment Error",{lng:vm.language}),modal.message=message,vm.busy=!1,$rootScope.$broadcast("show-modal",modal),$rootScope.$apply(),vm.isButtonDisabled=!1}function ewayOnComplete(data){data.Errors&&data.Errors.length?function(error){var modal={};modal.heading="Payment Error: "+error,modal.message="Payment rejected by provider.",error.indexOf(",")>=0&&(error=error.split(","));"string"==typeof error&&(modal.message=appValues.EWAY_CODES[error]);if(Array.isArray(error)){for(var messages=[],i=0;i<error.length;i++){var message=error[i];messages.push(appValues.EWAY_CODES[message])}modal.message=messages.join(", ")+"."}vm.busy=!1,$rootScope.$broadcast("show-modal",modal),$rootScope.$apply(),vm.isButtonDisabled=!1,$timeout((function(){vm.isFormDisabled=!0,client.paynow(vm.appData.account.id,vm.appData.venue.id,vm.appData.order).then((function(data){vm.appData.payment.accessCode=data.accessCode,vm.appData.payment.formActionUrl=data.formActionUrl,vm.appData.payment.purchaseOrderId=data.purchaseOrderId,vm.isFormDisabled=!1})).catch((function(err){$rootScope.$broadcast("process-error",err)}))}),1e3)}(data.Errors):$rootScope.$broadcast("navigate-to",{name:"next"})}function ewayOnError(err){Raven&&Raven.captureException(err),$rootScope.$broadcast("process-error",err)}function ewayOnTimeout(err){Raven&&Raven.captureException(err);$rootScope.$broadcast("process-error",err)}listeners.push($rootScope.$on("language-changed",(function(){vm.language=languageService.selectedLanguage}))),$scope.$on("$destroy",(function(){listeners.forEach((function(deregister){deregister()}))})),setTimeout((function(){!function(){if("eway"!==vm.venue.paymentSettings.paymentProvider.toLowerCase()){var elements=(stripie=Stripe(vm.venue.paymentSettings.stripe.publishableKey)).elements(),style={base:{color:"#32325d",fontFamily:'"Helvetica Neue", Helvetica, sans-serif',fontSmoothing:"antialiased",border:"1px solid green",fontSize:"16px","::placeholder":{color:"#aab7c4"}},invalid:{color:"#fa755a",iconColor:"#fa755a"}};(cardie=elements.create("card",{hidePostalCode:!0,style:style})).mount("#card-element")}}()}),500)}Controller.$inject=["$rootScope","$scope","$log","$timeout","$sce","$state","appData","appValues","client","$http","languageService","$i18next"],angular.module("giftCardsWidget").controller("PaymentCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,$state,$location,$interpolate,appData,$i18next,languageService,appValues,$scope){var vm=this;vm.language=languageService.selectedLanguage,vm.enableLangSettings=window.config.enableLanguageSelector,vm.appData=appData.gcw,vm.reset=function(){location.reload()};var listeners=[];listeners.push($rootScope.$on("language-changed",(function(){vm.language=languageService.selectedLanguage,window.setTimeout((function(){var oopsMessage=$i18next.t("Oops...  something has gone wrong.",{lng:vm.language}),errorMsg=$i18next.t(vm.appData.error.message?vm.appData.error.message:"",{lng:vm.language}),errorHeading=$i18next.t("Error",{lng:vm.language});$scope.$apply((function(){vm.message=oopsMessage+"<br>"+errorMsg,vm.heading=errorHeading+(vm.appData.error.status?": "+vm.appData.error.status:"")}))}),500)}))),$scope.$on("$destroy",(function(){listeners.forEach((function(deregister){deregister()}))})),function(){var errorHeading=$i18next.t("Error",{lng:vm.language});vm.heading=errorHeading+(vm.appData.error.status?": "+vm.appData.error.status:"");var oopsMessage=$i18next.t("Oops...  something has gone wrong.",{lng:vm.language}),errorMsg=$i18next.t(vm.appData.error.message?vm.appData.error.message:"",{lng:vm.language});vm.message=oopsMessage+"<br>"+errorMsg,$rootScope.$emit("reset-routes")}()}Controller.$inject=["$rootScope","$state","$location","$interpolate","appData","$i18next","languageService","appValues","$scope"],angular.module("giftCardsWidget").controller("ErrorCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,$scope,$timeout,appData){var vm=this;vm.venue=appData.gcw.venue,vm.order=appData.gcw.order,vm.messages=appData.gcw.messages.venue,vm.isBillingDetailsSame=!1,vm.address;var addressFieldMap={receiverAddress:["address","address2"],receiverCity:"city",receiverCountry:"country",receiverPostcode:"postcode",receiverSuburb:"suburb",receiverFormattedAddress:"formattedAddress",receiverState:"state"};vm.next=function(){if(vm.isSubmitted=!0,$rootScope.$emit("form-submitted"),!vm.form.$valid)return;$rootScope.$on("app-busy"),$rootScope.$broadcast("navigate-to",{name:"next"})},vm.back=function(){$rootScope.$on("app-busy"),$rootScope.$broadcast("navigate-to",{name:"back"})},$scope.$watch("vm.form.$valid",(function(value,oldValue){$rootScope.$broadcast("route-status-change",{route:"customer",isComplete:value})})),$scope.$watch("vm.order.address",(function(value){for(var key in addressFieldMap)if(value&&Object.keys(value).length){var lookupValue=addressFieldMap[key];if(Array.isArray(lookupValue)){for(var myArr=[],i=0;i<lookupValue.length;i++){var lookupKey=lookupValue[i];value[lookupKey]&&myArr.push(value[lookupKey])}vm.order[key]=myArr.join(", ")}else vm.order[key]=value[lookupValue]}else delete vm.order[key]})),vm.order||(vm.order={})}Controller.$inject=["$rootScope","$scope","$timeout","appData"],angular.module("giftCardsWidget").controller("CustomerCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,appData){this.messages=appData.gcw.messages.venue,this.complete=appData.gcw.complete,$rootScope.$emit("session-timer-cancel")}Controller.$inject=["$rootScope","appData"],angular.module("giftCardsWidget").controller("CompleteCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,$scope,appData,client,appValues,analytics,$i18next,languageService){var vm=this;function getQuantity(id){if(!vm.order.orders.length)return 0;for(var i=0;i<vm.order.orders.length;i++){var order=vm.order.orders[i];if(order.id===id)return order.quantity}return 0}function addListener(key){switch(key){case appValues.EGIFT_CARD_KEY:$scope.$watch((function($scope){return vm.cards.eGiftCard.map((function(card){return card.quantity}))}),updateOrderAmounts,!0);break;case appValues.PHYSICAL_CARD_KEY:$scope.$watch((function($scope){return vm.cards.physicalCard.map((function(card){return card.quantity}))}),updateOrderAmounts,!0)}}function updateOrderAmounts(){if(vm.cardTypes&&vm.cardTypes.length&&vm.cardType&&vm.cards[vm.cardType.id]){for(var typeId=vm.cardType.id,cardsInOrderMap=vm.order.orders.map((function(card){return card.id})),i=0;i<vm.cards[typeId].length;i++){var card=vm.cards[typeId][i],indexInOrder=cardsInOrderMap.indexOf(card.id);(!card.quantity||card.quantity<0)&&(card.quantity=0),vm.order.orders[indexInOrder]&&card.quantity>0&&indexInOrder>=0&&(vm.order.orders[indexInOrder].quantity=card.quantity),card.quantity>0&&indexInOrder<0&&vm.order.orders.push(card),0===card.quantity&&indexInOrder>=0&&vm.order.orders.splice(indexInOrder,1)}vm.order.orders.length?$rootScope.$emit("update-order"):$rootScope.$broadcast("route-status-change",{route:"cards",isComplete:!1})}}function selectCardType(cardType){if(vm.cardType!==cardType){if(analytics.event("User Input",cardType.id),vm.order&&vm.order.orders.length)return(modal={heading:"Warning",message:"Only one card type is allowed for each transaction. If you proceed you will lose your current order."}).data=cardType,modal.actions=["Cancel","Proceed"],void $rootScope.$broadcast("show-modal",modal);var modal;vm.order.isAddressRequired="physicalCard"===cardType.id,vm.cardType=cardType}}vm.appData=appData.gcw,vm.venue=appData.gcw.venue,vm.order=appData.gcw.order,vm.messages=appData.gcw.messages.venue,vm.cards,vm.cardTypes=[],vm.eGiftCards=[],vm.experienceGiftCards=[],vm.errors=[],vm.cardType,vm.activeKeys=[],vm.next=function(){if(vm.errors.length)return;$rootScope.$broadcast("navigate-to",{name:"next"})},vm.selectCardType=selectCardType,vm.language=languageService.selectedLanguage,$rootScope.$on("modal-response",(function(event,args){if("Proceed"!==args.action)return;(function(){vm.order.orders=[];for(var i=0;i<vm.activeKeys.length;i++)for(var key=vm.activeKeys[i],j=0;j<vm.cards[key].length;j++){vm.cards[key][j].quantity=0}$rootScope.$emit("reset-order-summary")})(),selectCardType(args.data)})),$scope.$on("item-delete",(function(event,args){!function(target){var type="".firstCharToLowercase(target.cardFormat);"experienceGiftCard"===type&&(type="eGiftCard");for(var i=0;i<vm.cards[type].length;i++){var card=vm.cards[type][i];card.id===target.id&&(card.quantity=0)}}(args.target)})),$rootScope.$on("language-changed",(function(){vm.language=languageService.selectedLanguage})),function(){if(vm.isBusy=!0,!vm.messages)return void $rootScope.$emit("refresh-app");client.getCards(vm.appData.account.id,vm.appData.venue.id).then((function(data){data.length?function(cards){var cardsAndActiveKeys=function(cards){for(var filteredCards={eGiftCard:[]},keys=[],i=0;i<cards.length;i++){var card=cards[i],key="".firstCharToLowercase(card.cardFormat);if(key===appValues.PHYSICAL_CARD_KEY||key===appValues.EGIFT_CARD_KEY||key===appValues.EXPERIENCE_GIFT_CARD_KEY){if(keys.indexOf(key)<0&&key!==appValues.EXPERIENCE_GIFT_CARD_KEY&&keys.push(key),keys.indexOf(appValues.EGIFT_CARD_KEY)<0&&key===appValues.EXPERIENCE_GIFT_CARD_KEY&&keys.push(appValues.EGIFT_CARD_KEY),card.quantity=getQuantity(card.id),key===appValues.PHYSICAL_CARD_KEY)card.displayName="Physical Card";else{if(key!==appValues.EGIFT_CARD_KEY&&key!==appValues.EXPERIENCE_GIFT_CARD_KEY)throw new Error("Unrecognized card type.");card.displayName="eGift Card"}filteredCards[key]||(filteredCards[key]=[]),key===appValues.EXPERIENCE_GIFT_CARD_KEY&&filteredCards[key]?(filteredCards.eGiftCard.push(card),delete filteredCards[key]):filteredCards[key].push(card)}}return{cards:filteredCards,keys:keys}}(cards);vm.activeKeys=cardsAndActiveKeys.keys;cards=cardsAndActiveKeys.cards;vm.appData.cards=cards,vm.cards=vm.appData.cards,vm.eGiftCards=cards.eGiftCard.filter((function(card){return"EGiftCard"===card.cardFormat})),vm.experienceGiftCards=cards.eGiftCard.filter((function(card){return"ExperienceGiftCard"===card.cardFormat})),vm.hasExperienceCards=!0===vm.appData.venue.giftCardSettings.willPostExperienceCards&&vm.experienceGiftCards.length>0;for(var cardTypesMap=appValues.CARD_TYPES.map((function(item){return item.id})),i=0;i<vm.activeKeys.length;i++){var key=vm.activeKeys[i],card=appValues.CARD_TYPES[cardTypesMap.indexOf(key)];vm.cardTypes.push(card),addListener(key)}!1===vm.appData.venue.giftCardSettings.willPostPhysicalCards&&(vm.cardTypes=vm.cardTypes.filter((function(cardType){return"physicalCard"!==cardType.id})),vm.activeKeys=vm.activeKeys.filter((function(activeKey){return"physicalCard"!==activeKey})));0==vm.cardTypes.length&&0==vm.activeKeys.length&&$rootScope.$broadcast("process-error",{error:{status:"Not found"},message:"This restaurant has no gift cards."});1==vm.cardTypes.length&&(vm.cardType=function(keys,cardTypes){if(1===keys.length)return cardTypes[0];if(vm.order&&vm.order.orders&&vm.order.orders.length)return cardTypes.find((function(type){return type.id==="".firstCharToLowercase(vm.order.orders[0].cardFormat)}));return}(vm.activeKeys,vm.cardTypes));vm.isBusy=!1,updateOrderAmounts()}(data):$rootScope.$broadcast("process-error",{error:{status:"Not found"},message:"This restaurant has no gift cards."})})).catch((function(){$rootScope.$broadcast("process-error",{error:{status:"Not found"},message:"Gift cards not found."})}))}()}Controller.$inject=["$rootScope","$scope","appData","client","appValues","analytics","$i18next","languageService"],angular.module("giftCardsWidget").controller("CardsCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,$scope,$timeout,appData){var vm=this;vm.venue=appData.gcw.venue,vm.phoneCountry=null,vm.theme=appData.gcw.params.theme,vm.order=appData.gcw.order,vm.messages=appData.gcw.messages.venue,vm.isValidNumber=!0,vm.isBillingDetailsSame=!1;var autofillMap={purchaserFirstName:"receiverFirstName",purchaserLastName:"receiverLastName",purchaserEmail:"receiverEmail",purchaserEmailConfirmation:"receiverEmail"};function checkPhoneNumber(){if(window.libphonenumber&&vm.order.purchaserPhone&&vm.phoneCountry){var tempString=vm.order.purchaserPhone;0!==tempString.indexOf("+")&&(tempString="+"+tempString),vm.isValidNumber=window.libphonenumber.isValidPhoneNumber(tempString,vm.phoneCountry)}}function getClassName(htmlElement){return htmlElement.className.replace("is-invalid","")+(htmlElement.className.indexOf("is-dirty")>=0?"":" is-dirty")}vm.phoneInputFocus=!1,vm.next=function(){if(vm.isSubmitted=!0,$rootScope.$emit("form-submitted"),!vm.form.$valid)return;if(checkPhoneNumber(),!vm.isValidNumber)return;0!==vm.order.purchaserPhone.indexOf("+")&&(vm.order.purchaserPhone="+"+vm.order.purchaserPhone);$rootScope.$broadcast("navigate-to",{name:"next"})},vm.back=function(){$rootScope.$broadcast("navigate-to",{name:"back"})},vm.phoneUpdate=function(e){vm.order&&(vm.order.purchaserPhone=e,checkPhoneNumber())},vm.phoneCountryUpdate=function(e){vm.phoneCountry=e},vm.updatePhoneInputFocus=function(inputStatus){inputStatus||vm.order.purchaserPhone?inputStatus&&(vm.phoneInputFocus=inputStatus):vm.phoneInputFocus=inputStatus},vm.checkPrefix=function(phone,countryCode){if(!phone||!countryCode)return!1;0!==phone.indexOf("+")&&(phone="+"+phone);return window.libphonenumber.isValidPhoneNumber(phone,countryCode)},$scope.$watch("vm.form.$valid",(function(value,oldValue){if($rootScope.$broadcast("route-status-change",{route:"billing",isComplete:value}),value&&window.phoneUtils)try{vm.order.phoneNational=window.phoneUtils.formatInternational(vm.order.phone,vm.venue.country)}catch(e){vm.order.phoneNational=null}else vm.order.phoneNational=null})),vm.updateBillingDetails=function(){for(var field in autofillMap)if(vm.order[autofillMap[field]]){var htmlElement=document.getElementById(field);htmlElement&&(htmlElement.className=getClassName(htmlElement)),vm.order[field]=vm.order[autofillMap[field]]}else vm.order[field]===vm.order[autofillMap[field]]&&(vm.order[field]=void 0)},function(){vm.order||(vm.order={});phoneLib=document.createElement("script"),phoneLib.src="additional-scripts/libphonenumber/libphonenumber-max.js",document.body.appendChild(phoneLib);var phoneLib}()}Controller.$inject=["$rootScope","$scope","$timeout","appData"],angular.module("giftCardsWidget").controller("BillingCtrl",Controller)}();
!function(){"use strict";function Controller($rootScope,$scope,$state,$location,$log,$sce,appData,client,stateService,appMessages,appValues,analytics,languageService,$window){var analyticsSetup,vm=this,ROUTES=appValues.ROUTES;function init(){if(appData.params){if(vm.enableLangSettings){var defaultLanguage=languageService.getDefaultLanguageFromBrowser($window.navigator.language);languageService.loadi18Next(defaultLanguage)}var id;id=appData.params.accountid,client.getAccount(id).then((function(data){!function(data){appData.account=data,vm.account=appData.account,appData.messages={},appData.messages.account=appMessages.getMessages(data,"giftCardEnabledVenues"),setupVenues()}(data)})).catch((function(err){processError(err,"Account not found.")})),analytics.init(appData.params.accountid)}else processError({status:400},"Your URL is missing params")}function getNextRoute(name,num){var index=ROUTES.findIndex((function(route){return route.name===name}));return ROUTES[index+num].name}function setupVenues(){var venue,route;if(appData.venue&&appData.complete&&(delete appData.venue,delete appData.complete),appData.account.giftCardEnabledVenues.length){if(appData.params.venueid)return(venue=appData.account.giftCardEnabledVenues.find((function(venue){return venue.id===+appData.params.venueid})))?void setupVenue(venue):void processError({status:"",message:"We are currently experiencing technical difficulties, please try again later..."});if(1!==appData.account.giftCardEnabledVenues.length){(route=getRoute("venues")).isDisabled=!1,route.isActive=!0,$rootScope.$emit("widget-details-updated",{source:appData.account});var params=$location.search();$state.go("venues"),$rootScope.$emit("app-ready"),$location.search(params)}else setupVenue(venue=appData.account.giftCardEnabledVenues[0])}else processError({status:"",message:"We are currently experiencing technical difficulties, please try again later.."})}function setupVenue(venue){var route;appData.venue=venue,(route=getRoute("venues")).isDeactivated=!0,route.isActive=!0,$rootScope.$emit("widget-details-updated",{source:venue}),setupCards()}function loadRecaptchaScript(src){return new Promise((function(resolve,reject){var script=document.createElement("script");script.src=src,script.async=!0,script.defer=!0,script.onload=function(){resolve()},script.onerror=function(error){reject(error)},document.head.appendChild(script)}))}function setupCards(){var route;appData.messages.venue=appMessages.getMessages(appData.venue),function(venue){try{venue.giftCardSettings.enableGiftCardRecaptchaV2&&venue.captchaConfig.siteKeyV2&&loadRecaptchaScript("https://www.google.com/recaptcha/enterprise.js"),venue.giftCardSettings.enableGiftCardRecaptchaV3&&venue.captchaConfig.siteKeyV3&&loadRecaptchaScript("https://www.google.com/recaptcha/enterprise.js?render="+venue.captchaConfig.siteKeyV3)}catch(error){console.error("Error loading reCAPTCHA scripts:",error)}}(appData.venue),$rootScope.$emit("widget-details-updated",{source:appData.messages.venue}),getCardType("physicalCard").description=appData.messages.venue.physicalCardWidgetDescription,getCardType("eGiftCard").description=appData.messages.venue.eGiftCardWidgetDescription,appData.order=appData.order?appData.order:{},appData.order.orders=appData.order.orders?appData.order.orders:[],(route=getRoute("cards")).isDisabled=!1,route.isActive=!0,analyticsSetup||(analytics.init(appData.account.id,appData.venue),analyticsSetup=!0);var params=$location.search();$rootScope.$emit("app-ready"),$state.go("cards"),$location.search(params)}function resetRoutes(){for(var isFirstRouteEnabled=!1,i=0;i<appValues.ROUTES.length;i++){var route=appValues.ROUTES[i];isFirstRouteEnabled||route.isDeactivated?route.isDisabled=!0:(route.isDisabled=!1,isFirstRouteEnabled=!0),route.isActive=!1}}function getRoute(name){return appValues.ROUTES.find((function(route){return route.name===name}))}function getCardType(id){return appValues.CARD_TYPES.find((function(card){return card.id===id}))}function processErrorInit(event,args){processError(args.error||{},args.message||"")}function processError(err,message){$log.error(err),appData.error=err,appData.error.message=message||function(err){if(err.message)return err.message;if(err.data&&err.data.message)return err.data.message;return err.statusText}(err),getRoute("error").isDisabled=!1,delete appData.payment,delete appData.order,$rootScope.$emit("app-ready"),$state.go("error")}appData=appData.gcw,vm.enableLangSettings=window.config.enableLanguageSelector,$rootScope.$on("refresh-app",(function(){delete appData.payment,delete appData.order,delete appData.venue,delete appData.account,delete appData.messages,resetRoutes(),init()})),$rootScope.$on("process-error",processErrorInit),$rootScope.$on("reset-routes",resetRoutes),$rootScope.$on("navigate-to",(function(event,args){!function(name){switch(function(name){switch(name){case"next":return getNextRoute(stateService.currState,1);case"back":return getNextRoute(stateService.currState,-1);default:return name}}(name)){case"venues":setupVenues();break;case"cards":setupCards();break;case"customer":!function(){var route;if(!appData.order||!appData.order.orders||!appData.order.orders.length)return void setupCards();var isECard=!appData.order.orders.find((function(order){return"PhysicalCard"===order.cardFormat}));appData.order.isAddressRequired=!isECard,appData.order.isRecipientsEmailVisible=!!isECard,appData.order.isCustomerMessageAllowed=!!isECard||appData.venue.giftCardSettings.allowCustomerMessage,route=getRoute("customer"),route.isDisabled=!1,$rootScope.$emit("app-ready"),$state.go("customer")}();break;case"billing":!function(){var route;if(!appData.order||!appData.order.orders||!appData.order.orders.length)return void setupCards();var isECard=!appData.order.orders.find((function(order){return"PhysicalCard"===order.cardFormat}));appData.order.isAddressRequired=!isECard,route=getRoute("billing"),route.isDisabled=!1,$rootScope.$emit("app-ready"),$state.go("billing")}();break;case"payment":!function(){$rootScope.$emit("app-busy");var provider=appData.venue.paymentSettings.paymentProvider.toLowerCase();if("stripe"===provider)return void function(){var route,publishableKey=appData.venue.paymentSettings.stripe.publishableKey;if(!publishableKey)return void processError({status:400},"Payment Provider: Publishable key missing");Stripe.setPublishableKey(publishableKey),appData.payment={},appData.payment.provider="stripe",route=getRoute("payment"),route.isDisabled=!1,$rootScope.$emit("app-ready"),$state.go("payment")}();if("eway"===provider)return void client.paynow(appData.account.id,appData.venue.id,appData.order).then((function(data){appData.payment={},appData.payment.provider="eway",appData.payment.accessCode=data.accessCode,appData.payment.formActionUrl=data.formActionUrl,appData.payment.purchaseOrderId=data.purchaseOrderId,getRoute("payment").isDisabled=!1,$rootScope.$emit("app-ready"),$rootScope.$emit("session-timer-start"),$state.go("payment")})).catch((function(err){processError(err)}));processErrorInit("No Payment Provider",{message:"A payment provider does not exist for this venue"})}();break;case"complete":!function(){var route;if(route=getRoute("complete"),route.isDisabled=!1,appData.order&&appData.payment)return appData.complete={},appData.complete.order=appData.order,appData.complete.payment=appData.payment,"eway"===appData.payment.provider?(transactionDetails={purchaseOrderId:appData.payment.purchaseOrderId,accessCode:appData.payment.accessCode},delete appData.payment,delete appData.order,void client.complete(appData.account.id,appData.venue.id,transactionDetails).then((function(data){$rootScope.$emit("app-ready"),$state.go("complete")})).catch((function(err){processError(err)}))):(delete appData.payment,delete appData.order,$rootScope.$emit("app-ready"),void $state.go("complete"));var transactionDetails;$state.go("complete")}();break;default:init()}}(args.name)})),$rootScope.$on("update-venue",(function(event,args){var venue;venue=args.venue,appData.venue=venue,delete appData.order,delete appData.payments,resetRoutes()})),init()}Controller.$inject=["$rootScope","$scope","$state","$location","$log","$sce","appData","client","stateService","appMessages","appValues","analytics","languageService","$window"],angular.module("giftCardsWidget").controller("AppCtrl",Controller)}();
!function(){"use strict";function Controller($scope){}Controller.$inject=["$scope"],angular.module("giftCardsWidget").directive("overlay",(function(){var directive={bindToController:!0,controller:Controller,controllerAs:"vm",templateUrl:"app/overlay/overlay.html",link:function(scope,element,attrs){},restrict:"E",scope:{heading:"@",content:"@",isVisible:"="}};return directive}))}();
!function(){"use strict";function Controller($rootScope,$scope,appValues,appData,client,$timeout,languageService,$i18next){var vm=this;vm.appData=appData.gcw,vm.venue=appData.gcw.venue,vm.language=languageService.selectedLanguage,vm.enableLangSettings=window.config.enableLanguageSelector,vm.remove=function(target){for(var i=vm.order.orders.length-1;i>=0;i--){vm.order.orders[i]===target&&vm.order.orders.splice(i,1)}$rootScope.$broadcast("item-delete",{target:target})},vm.requestDiscount=function(){if(vm.isDiscountRequested=!0,vm.errors.length)return;updateTotals()};var listeners=[];function updateTotals(){vm.timer&&$timeout.cancel(vm.timer),vm.isCalculating=!0;for(var parsedOrders=[],expectedSubtotal=0,discountCode=vm.order.discountCode,i=0;i<vm.order.orders.length;i++){var order=vm.order.orders[i];parsedOrders.push({id:order.id,quantity:order.quantity}),expectedSubtotal+=order.amount*order.quantity}vm.timer=$timeout((function(){getOrderTotals(parsedOrders,expectedSubtotal,discountCode)}),200)}function getOrderTotals(orders,expectedSubtotal,discountCode){vm.isCalculating=!0,client.getOrderTotals(vm.appData.account.id,vm.appData.venue.id,{orders:orders,discountCode:discountCode}).then((function(data){data.subTotal===expectedSubtotal?(updateOrderSummary(data),updateErrors(),vm.isCalculating=!1):getOrderTotals(orders,expectedSubtotal)})).catch((function(err){updateOrderSummary({}),updateErrors(),$rootScope.$broadcast("process-error",err)}))}function updateOrderSummary(data){for(var key in appValues.ORDER_TOTALS)if("processingFee"===key){var total1=data.nbiFee&&!vm.venue.isNbiFeeIncluded?data.nbiFee:0,total2=data.venueFee?data.venueFee:0;vm.order[key]=+total1+ +total2>0?Math.precisionRound(+total1+ +total2,2):0}else if("displaySubTotal"===key){var discount=data.discount?+data.discount:0;vm.order[key]=Math.precisionRound(+data.subTotal-discount,2)}else if("experienceFee"===key&&vm.order.orders.length){var total3=data.experienceFee?data.experienceFee:0;vm.order[key]=total3>0?Math.precisionRound(total3,2):0}else vm.order[key]=data[key]?Math.precisionRound(+data[key],2):0;!function(){var baseHeight=112;vm.order.postageFee>0&&(baseHeight+=28);vm.order.processingFee>0&&(baseHeight+=28);vm.taxNotificationMessage&&vm.taxNotificationMessage.length&&(baseHeight+=28);vm.summaryHeight=baseHeight+"px"}()}function updateErrors(){vm.errors=[];var messages={overMaxAmountPerTransaction:getExceededMaxAmountPerTransactionMessage(),exceededMaxPerTransactionMessage:getExceededMaxPerTransactionMessage(),outOfStock:getOutOfStockMessage()};for(var key in messages)messages[key]&&vm.errors.push({text:messages[key]});$rootScope.$broadcast("route-status-change",{route:"cards",isComplete:0===vm.errors.length})}function getExceededMaxAmountPerTransactionMessage(){if(null!=vm.venue.giftCardSettings.maxAmountPerTransaction&&vm.venue.giftCardSettings.maxAmountPerTransaction<+vm.order.subTotal)return vm.enableLangSettings?languageService.localizeWithAmount(vm.messages.exceededMaxAmountPerTransactionMessage):vm.messages.exceededMaxAmountPerTransactionMessage}function getExceededMaxPerTransactionMessage(){for(var totalCards=0,i=0;i<vm.order.orders.length;i++){totalCards+=vm.order.orders[i].quantity}if(null!=vm.venue.giftCardSettings.maxSoldPerTransaction&&vm.venue.giftCardSettings.maxSoldPerTransaction<totalCards)return vm.enableLangSettings?languageService.localizeWithCount(vm.messages.exceededMaxPerTransactionMessage):vm.messages.exceededMaxPerTransactionMessage}function getOutOfStockMessage(){for(var messages=[],i=0;i<vm.order.orders.length;i++){var card=vm.order.orders[i],id=card.id,qty=card.quantity,availability=vm.venue.giftCardAvailability.find((function(item){if(item.typeId===id&&null!=item.quantityRemaining&&item.quantityRemaining<qty)return item.quantityRemaining}));if(availability)if(vm.enableLangSettings){var availableMsg=$i18next.t("Sorry, there are only {{count}} ${{amt}} cards remaining",{count:availability.quantityRemaining,amt:card.amount});messages.push(availableMsg)}else messages.push("Sorry, there are only "+availability.quantityRemaining+" $"+card.amount+" cards remaining")}if(messages.length)return messages.join(",")}listeners.push($rootScope.$on("update-order",updateTotals)),listeners.push($rootScope.$on("reset-order-summary",(function(){updateOrderSummary({})}))),listeners.push($rootScope.$on("language-changed",(function(){vm.language=languageService.selectedLanguage}))),$scope.$on("$destroy",(function(){listeners.forEach((function(deregister){deregister()}))}))}Controller.$inject=["$rootScope","$scope","appValues","appData","client","$timeout","languageService","$i18next"],angular.module("giftCardsWidget").directive("orderSummary",(function(){return{bindToController:!0,controller:Controller,controllerAs:"vm",restrict:"E",require:"?ngModel",templateUrl:"app/order-summary/order-summary.html",scope:{order:"=",errors:"=",messages:"=",discountEnabled:"="}}}))}();
!function(){"use strict";function directive($rootScope,appValues){return{bindToController:!0,controller:Controller,templateUrl:"app/nav-bar/nav-bar.html",controllerAs:"vm",replace:!0,restrict:"E",scope:{routes:"="}}}function Controller($rootScope,$state){this.navigateTo=function(name){$rootScope.$broadcast("navigate-to",{name:name})}}directive.$inject=["$rootScope","appValues"],Controller.$inject=["$rootScope","$state"],angular.module("giftCardsWidget").directive("navBar",directive)}();
!function(){"use strict";function Controller($rootScope,$scope){var vm=this;vm.close=function(action){action&&$rootScope.$broadcast("modal-response",{data:vm.data,action:action});$scope.$emit("modal-close")}}Controller.$inject=["$rootScope","$scope"],angular.module("giftCardsWidget").directive("modal",(function(){var directive={bindToController:!0,controller:Controller,templateUrl:"app/modal/modal.html",controllerAs:"vm",replace:!0,restrict:"E",scope:{heading:"=",message:"=",actions:"=",data:"="}};return directive}))}();
!function(){"use strict";function Controller($rootScope,$state,languageService,appData,appValues){var vm=this;vm.toggleDropdown=function(){vm.showDropdown=!vm.showDropdown},vm.hideDropdown=function(){vm.showDropdown=!1},vm.flagsPath=appValues.FLAG_PATH,vm.enableLangSettings=window.config.enableLanguageSelector,vm.theme=appData.gcw.params.theme||appValues.THEME.LIGHT,vm.theme===appValues.THEME.BLUEGREY&&(vm.theme=appValues.THEME.DARK),vm.languageData=appValues.LANG_SELECTOR,$rootScope.$on("app-ready",(function(){vm.isReady=!0})),vm.selectLanguage=function(lang){vm.selectedLanguage=lang,languageService.loadi18Next(lang).then((function(){})),vm.showDropdown=!1,$rootScope.$emit("language-changed")}}Controller.$inject=["$rootScope","$state","languageService","appData","appValues"],angular.module("giftCardsWidget").directive("headerWrap",(function(){var directive={bindToController:!0,controller:Controller,templateUrl:"app/header/header.html",controllerAs:"vm",replace:!0,restrict:"E",scope:{title:"=",imgUrl:"=",version:"=",selectedLanguage:"="}};return directive}))}();
!function(){"use strict";function Controller(){}angular.module("giftCardsWidget").directive("footerWrap",(function(){var directive={bindToController:!0,controller:Controller,templateUrl:"app/footer/footer.html",controllerAs:"vm",replace:!0,link:function($scope,element,attrs){},restrict:"E",scope:{links:"="}};return directive}))}();
!function(){"use strict";function filter(appData,appValues){return function(params,langVal){var _a,enableLangSettings=window.config.enableLanguageSelector,value=+params;if(!isNaN(value)){if(enableLangSettings){var selectedCurrencyFormat=null===(_a=appValues.LANG_SELECTOR.find((function(lang){return lang.id===langVal})))||void 0===_a?void 0:_a.currencyFormat,currency=appData.gcw.venue.currency;return value.toCurrency(value,selectedCurrencyFormat,currency)}return"GBP"===appData.gcw.venue.currency?value.toCurrency(value,"en-GB","GBP"):value.toCurrency(value,"en-AU","AUD")}return params}}filter.$inject=["appData","appValues"],Number.prototype.toCurrency=function(value,locale,currency){return new Intl.NumberFormat(locale,{style:"currency",currency:currency}).format(value)},angular.module("giftCardsWidget").filter("countryCurrency",filter)}();
!function(){"use strict";angular.module("giftCardsWidget").filter("camelCase",(function(){return function(params){return params=params.replace(/([A-Z])/g," $1")}}))}();
!function(){"use strict";function Controller($rootScope,$window,$scope,$interval,analytics){var interval,vm=this,remainingTime=108e4,isDev=-1!==$window.location.href.indexOf("localhost")||-1!==$window.location.href.indexOf("dev");$rootScope.$on("session-timer-start",(function(){vm.orderStartTime=moment().millisecond(0),vm.isActive=isDev,interval=$interval((function(){var ms,endTime=vm.orderStartTime.clone().add(18,"m");if((remainingTime=endTime.diff(moment().millisecond(0)))<1e3)return $interval.cancel(interval),remainingTime=108e4,vm.isActive=!1,$rootScope.$broadcast("process-error",{error:{status:"Timeout"},message:"Your order timed out."}),void analytics.event("Timeout","Payment Timeout");remainingTime<18e4&&(vm.isActive=!0),vm.displayTime=((ms=remainingTime)/1e3/60<<0)+":"+ms/1e3%60+" Minutes"}),1e3)})),$rootScope.$on("session-timer-cancel",(function(){$interval.cancel(interval),remainingTime=108e4,vm.isActive=!1}))}Controller.$inject=["$rootScope","$window","$scope","$interval","analytics"],angular.module("giftCardsWidget").directive("sessionTimeout",(function(){var directive={bindToController:!0,controller:Controller,controllerAs:"vm",restrict:"E",templateUrl:"app/directives/sessionTimeout.html",scope:{message:"="}};return directive}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("phoneVaild",(function(){return{require:"ngModel",link:function(scope,element,attrs,ngModel){function validatePhone(value){var parsedPhoneNumber,isValidNumber,libPhonenumber=getPhoneLib(),country=attrs.country;attrs.state;if(!libPhonenumber||!ngModel.$viewValue)return console.warn("Library 'libphonenumber' has not loaded yet."),ngModel.$setValidity("phoneValid",!0),value;try{isValidNumber=(parsedPhoneNumber=libphonenumber.parsePhoneNumberFromString(value,country))&&parsedPhoneNumber.isValid()}catch(e){isValidNumber=!1}return ngModel.$setValidity("phoneValid",isValidNumber),isValidNumber&&(value=parsedPhoneNumber.number,ngModel.$setViewValue(value),ngModel.$render()),value}function getPhoneLib(){return window.libphonenumber}ngModel.$parsers.push(validatePhone)},restrict:"A"}}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("noCacheSrc",(function(){var directive={restrict:"AE",link:function(scope,element,attrs){attrs.$observe("noCacheSrc",(function(noCacheSrc){noCacheSrc+="?"+(new Date).getTime(),attrs.$set("src",noCacheSrc)}))},scope:{}};return directive}))}();
!function(){"use strict";function Controller($scope){}Controller.$inject=["$scope"],angular.module("giftCardsWidget").directive("markdownContent",(function(){var directive={bindToController:!0,controller:Controller,controllerAs:"vm",template:'<span ng-bind-html="vm.message | markdown"></span>',link:function(scope,element,attrs){},restrict:"E",scope:{message:"="}};return directive}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("loading",(function(){return{restrict:"AE",require:"?ngModel",templateUrl:"app/directives/loading.html",scope:{label:"@",inline:"@"}}}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("isEqualTo",(function(){return{require:"ngModel",link:function(scope,element,attrs,ngModel){function validate(viewValue){var valid=!1;attrs.isEqualTo;return viewValue===attrs.isEqualTo&&(valid=!0),ngModel.$setValidity("is-equal-to",valid),viewValue}ngModel.$parsers.unshift(validate),ngModel.$formatters.push(validate),attrs.$observe("isEqualTo",(function(comparisonModel){validate(ngModel.$viewValue)}))},restrict:"A"}}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("isDiscountValid",(function(){return{require:"ngModel",link:function(scope,element,attrs,ngModel){function validate(viewValue){var valid=!1;return ngModel.$setValidity("is-discount-valid",valid),viewValue}ngModel.$parsers.unshift(validate),ngModel.$formatters.push(validate),attrs.$observe("isDiscountValid",(function(){validate(ngModel.$viewValue)}))},restrict:"A"}}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("dateValid",(function(){var directive={link:function($scope,element,attrs,ngModel){function datePastCheck(value,timezoneTime){return value>=timezoneTime}function dateExceedsParams(value,timezoneTime){return!$scope.allowedDays||value<timezoneTime.setDate(timezoneTime.getDate()+$scope.allowedDays)}function getTimezoneDateJs(){var a=moment.tz(getLocalDate(),$scope.timezone).format().split(/[^0-9]/);return new Date(a[0],a[1]-1,a[2],a[3],a[4],a[5])}function getLocalDate(){return moment().format()}ngModel.$formatters.push((function(modelValue){var value,timezoneTime;return value=modelValue._d?modelValue.toDate():new Date(modelValue),(value=new Date(modelValue)).setHours(0),value.setMinutes(1),(timezoneTime=getTimezoneDateJs()).setHours(0),timezoneTime.setMinutes(0),ngModel.$setValidity("datePast",datePastCheck(value,timezoneTime)),ngModel.$setValidity("dateExceedsParams",dateExceedsParams(value,timezoneTime)),value}))},restrict:"AE",require:"?ngModel",scope:{allowedDays:"=allowedDays",timezone:"=timezone"}};return directive}))}();
!function(){"use strict";angular.module("giftCardsWidget").directive("csvValidation",(function(){var directive={link:function($scope,element,attrs,ngModel){function setValidators(fieldValue,otherValue){var valueLength=fieldValue.toString().length,otherValueAsString=otherValue.toString(),cardType=(otherValueAsString.length,"3"===otherValueAsString[0]?"amex":"other");ngModel.$setValidity("tooShort",tooShortCheck(valueLength,cardType)),ngModel.$setValidity("tooLong",tooLongCheck(valueLength,cardType))}function tooShortCheck(valueLength,cardType){return"amex"===cardType?!(valueLength<4):!(valueLength<3)}function tooLongCheck(valueLength,cardType){return"amex"===cardType?!(valueLength>4):!(valueLength>3)}ngModel.$parsers.unshift((function(value){if(value)return setValidators(value,$scope.csvValidation?$scope.csvValidation:"4"),value})),$scope.$watch("csvValidation",(function(otherValue){var value=$scope.ngModel;otherValue&&value&&setValidators(value,otherValue)}))},restrict:"AE",require:"?ngModel",scope:{csvValidation:"=csvValidation",ngModel:"=ngModel"}};return directive}))}();
!function(){"use strict";function directive($document){return{link:function(scope,el,attr){$document.on("click",(function(e){el===e.target||el[0].contains(e.target)||scope.$apply((function(){scope.$eval(scope.clickOutside)}))}))},restrict:"A",scope:{clickOutside:"&"}}}directive.$inject=["$document"],angular.module("giftCardsWidget").directive("clickOutside",directive)}();
!function(){"use strict";angular.module("giftCardsWidget").directive("cardValidation",(function(){var directive={link:function($scope,element,attrs,ngModel){function tooShortCheck(valueLength,cardType){return"amex"===cardType?!(valueLength<15):!(valueLength<16)}function tooLongCheck(valueLength,cardType){return"amex"===cardType?!(valueLength>15):!(valueLength>16)}ngModel.$parsers.unshift((function(value){var valueAsString=value.toString(),valueLength=valueAsString.length,cardType="3"===valueAsString[0]?"amex":"other";return ngModel.$setValidity("tooShort",tooShortCheck(valueLength,cardType)),ngModel.$setValidity("tooLong",tooLongCheck(valueLength,cardType)),value}))},restrict:"AE",require:"ngModel",scope:{}};return directive}))}();
!function(){"use strict";function Controller($rootScope,$scope,$window,appData,appValues,languageService){var vm=this;function openOverlay(id){"termsAndConditions"===id&&(vm.overlayHeading="Terms and Conditions",vm.overlayContent=vm.appData.messages.venue.giftCardTermsAndConditions||""),vm.isOverlayVisible=!vm.isOverlayVisible}vm.appData=appData.gcw,vm.isVersionVisible=-1!==$window.location.href.indexOf("localhost")||-1!==$window.location.href.indexOf("dev")||-1!==$window.location.href.indexOf("uat"),vm.routes=appValues.ROUTES,vm.selectedLanguage=languageService.selectedLanguage,vm.title,vm.imgURL,vm.version,vm.isModalActive=!1,vm.modal={},vm.isReady,$rootScope.$on("widget-details-updated",(function(event,args){if(!args.source)return vm.title=void 0,vm.imgURL=void 0,void(vm.link=void 0);vm.title=args.source.venueName?args.source.venueName:args.source.businessName,vm.imgURL=function(url){if(!url)return;if(-1===url.indexOf("https"))return"api"+url;if(url.indexOf("https")>=0&&(url.indexOf(".jpg")>=0||url.indexOf(".png")))return url+"?h=80";return}(args.source.logoUrl),vm.version=vm.isVersionVisible?appValues.VERSION:void 0,vm.links=args.source.giftCardEnabledVenues?void 0:[{id:"termsAndConditions",action:openOverlay,name:"Terms and Conditions"}]})),$rootScope.$on("app-busy",(function(){vm.isReady=!1})),$rootScope.$on("app-ready",(function(){vm.isReady=!0})),$scope.$on("modal-close",(function(){vm.isModalActive=!1})),$rootScope.$on("show-modal",(function(event,args){vm.modal.heading=args.heading,vm.modal.message=args.message,vm.modal.actions=args.actions?args.actions:void 0,vm.modal.data=args.data?args.data:void 0,vm.isModalActive=!0}))}Controller.$inject=["$rootScope","$scope","$window","appData","appValues","languageService"],angular.module("giftCardsWidget").controller("WidgetCtrl",Controller)}();
!function(){"use strict";function runBlock($rootScope,$window,$location,customMethods,appData,stateService,appValues){var params=$location.search();params.accountid||$window.location.replace("https://www.nowbookit.com/"),$rootScope.$on("$stateChangeSuccess",(function(e,fromState,toState){console.log("fromState",fromState.name," params",params),$location.search(params)})),customMethods.init(),stateService.init()}runBlock.$inject=["$rootScope","$window","$location","customMethods","appData","stateService","appValues"],angular.module("giftCardsWidget").run(runBlock)}();
!function(){"use strict";function routeConfig($stateProvider,$urlRouterProvider){$stateProvider.state("app",{url:"/cards",controller:"AppCtrl as vm",templateUrl:"app/pages/app.html"}).state("error",{parent:"app",url:"/error",controller:"ErrorCtrl as vm",templateUrl:"app/pages/error.html",analyticsName:"Error"}).state("venues",{parent:"app",url:"/venues",controller:"VenuesCtrl as vm",templateUrl:"app/pages/venues.html",analyticsName:"Venue Selection"}).state("cards",{parent:"app",url:"/card-selection",controller:"CardsCtrl as vm",templateUrl:"app/pages/cards.html",analyticsName:"Card Selection"}).state("customer",{parent:"app",url:"/customer",controller:"CustomerCtrl as vm",templateUrl:"app/pages/customer.html",analyticsName:"Recipient Details"}).state("billing",{parent:"app",url:"/billing",controller:"BillingCtrl as vm",templateUrl:"app/pages/billing.html",analyticsName:"Customer Details"}).state("payment",{parent:"app",url:"/payment",controller:"PaymentCtrl as vm",templateUrl:"app/pages/payment.html",analyticsName:"Payment Details"}).state("complete",{parent:"app",url:"/complete",controller:"CompleteCtrl as vm",templateUrl:"app/pages/complete.html",analyticsName:"Order Complete"}),$urlRouterProvider.otherwise("/cards")}routeConfig.$inject=["$stateProvider","$urlRouterProvider"],angular.module("giftCardsWidget").config(routeConfig)}();
!function(){"use strict";angular.module("giftCardsWidget").factory("httpNbiApiInterceptor",["appValues",function(appValues){var reApiRoot=new RegExp("^\\/?"+appValues.APIBASE.replace(/^\/|\/$/g,"")+"\\/");return{request:function(config){return reApiRoot.test(config.url)&&(config.url=config.url.replace(reApiRoot,appValues.API_BASEURL+"/")),config}}}]).config(["$httpProvider",function($httpProvider){$httpProvider.interceptors.push("httpNbiApiInterceptor")}])}();
!function(){"use strict";angular.module("giftCardsWidget").constant("appValues",{VERSION:window.VERSION||"",APIBASE:"/api",SUPPORTED_LANGUAGE:["en","fr"],API_BASEURL:window.config.apiBaseUrl,DEFAULT_CURRENCY:window.DEFAULT_CURRENCY||"AUD",DEFAULT_CURRENCY_UNIT:window.DEFAULT_CURRENCY_UNIT||"dollar",LANG_SELECTOR:JSON.parse(window.LANG_SELECTOR.replace(/'/g,'"')),THEME:{DARK:"dark",LIGHT:"light",BLUEGREY:"blueGrey"},FLAG_PATH:"../../assets/svg/language/flags/",ROUTES:[{name:"venues",displayName:"Restaurants",isDisabled:!1,isDeactivated:!1,isActive:!1,hasNavigation:!0},{name:"cards",displayName:"Gift Card",isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!0},{name:"customer",displayName:"Details",isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!0},{name:"billing",displayName:"Billing",isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!0},{name:"payment",displayName:"Pay",isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!0},{name:"complete",displayName:void 0,isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!1},{name:"error",displayName:void 0,isDisabled:!0,isDeactivated:!1,isActive:!1,hasNavigation:!1}],CARD_TYPES:[{id:"physicalCard",imgURL:"../../scripts/assets/svg/physical-card-icon.svg",name:"Physical Card",description:"",isDeactivated:!1},{id:"eGiftCard",imgURL:"../../scripts/assets/svg/e-card-icon.svg",name:"eGift Card",description:"",isDeactivated:!1}],PHYSICAL_CARD_KEY:"physicalCard",EGIFT_CARD_KEY:"eGiftCard",EXPERIENCE_GIFT_CARD_KEY:"experienceGiftCard",ORDER_TOTALS:{grandTotal:0,nbiFee:0,postageFee:0,subTotal:0,displaySubTotal:0,venueFee:0,processingFee:0,experienceFee:0,discount:void 0},EWAY_CODES:{V6011:"Invalid payment total amount",V6015:"Invalid Payment CurrencyCode",V6021:"Card holder name required",V6022:"Card number required",V6153:"Card type not support by merchant",V6101:"Invalid credit card expiry month",V6102:"Invalid credit card expiry year",V6106:"Invalid credit card cvn",V6110:"Invalid credit card number",S9990:"Invalid endpoint error",S9991:"Invalid credential error",S9992:"Communication error",S9993:"Authentication error",S9995:"Internal sdk error",D4406:"Unknown error",D4412:"Invalid transaction",D4413:"Invalid amount",D4414:"Invalid card number",D4433:"Expired card, capture",D4441:"Lost card",D4443:"Stolen card",D4451:"Insufficient funds",D4454:"Expired card",D4462:"Restricted card",D4482:"CVV validation error",D4494:"Duplicate transaction",D4495:"Amex declined",D4496:"System error"},TO_DECIMAL_FIELDS:["transactionFee","postageFee","maxAmountPerTransaction"]})}();
!function(){"use strict";function config($logProvider,$locationProvider){$logProvider.debugEnabled(!0),$locationProvider.html5Mode(!0)}config.$inject=["$logProvider","$locationProvider"],angular.module("giftCardsWidget").config(config)}();
}