\n
\n
\n \n\n
\n \n\n ','
\n\n \n \n '," \n
\n \n "]);return X=function(){return e},e}Object(i.a)([Object(u.e)({type:String})],P.prototype,"sectionBadge",void 0),Object(i.a)([Object(u.e)({type:String})],P.prototype,"headline",void 0),Object(i.a)([Object(u.e)({type:String})],P.prototype,"badgeMode",void 0),P=Object(i.a)([Object(u.c)("donation-form-section")],P),function(e){e.HideNumbers="hidenumbers",e.ShowNumbers="shownumbers"}(A||(A={})),function(e){e.DonationType="donationType",e.Amount="amount"}(x||(x={})),function(e){e.ValidDonationAmount="valid_donation_amount",e.InvalidDonationAmount="invalid_donation_amount",e.DonationTooHigh="donation_too_high",e.DonationTooLow="donation_too_low"}(T||(T={}));var Z=function(e){Object(o.f)(n,u.a);var t=Object(o.g)(n);function n(){var e;return Object(o.b)(this,n),(e=t.apply(this,arguments)).donationInfo=new c.c({donationType:c.g.OneTime,amount:5,coverFees:!1}),e.stepNumberMode=A.ShowNumbers,e.amountOptions=[5,10,25,50,100,500,1e3],e.currencyValidator=new l,e}return Object(o.c)(n,[{key:"render",value:function(){return Object(a.h)(X(),this.formSectionNumberMode,this.frequencyTemplate,this.formSectionNumberMode,this.presetAmountsTemplate,this.customAmountTemplate,this.error,this.coverFeesChecked,this.donationInfo.coverFees,this.coverFeesTextTemplate)}},{key:"updated",value:function(e){e.has("donationInfo")&&this.updateSelectedDonationInfo()}},{key:"updateSelectedDonationInfo",value:function(){var e,t;if(this.customAmountButton&&this.customAmountInput)if(!this.customAmountButton.checked&&this.amountOptions.includes(this.donationInfo.amount))(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('input[type="radio"][name="'.concat(x.Amount,'"][value="').concat(this.donationInfo.amount,'"]'))).checked=!0,this.customAmountButton.checked=!1,this.customAmountInput.value="";else if(this.customAmountButton.checked=!0,(null===(t=this.shadowRoot)||void 0===t?void 0:t.activeElement)!==this.customAmountInput){this.customAmountInput.value="".concat(this.donationInfo.amount);var n=this.getDonationInfoStatus(this.donationInfo.amount);this.handleDonationInfoStatus(n)}}},{key:"getRadioButton",value:function(e){var t="".concat(e.group,"-").concat(e.value,"-option");return Object(a.h)(Q(),e.group,e.value,t,e.checked,this.radioSelected,t,e.displayText)}},{key:"customRadioSelected",value:function(){var e;null===(e=this.customAmountInput)||void 0===e||e.focus()}},{key:"customAmountFocused",value:function(e){var t=e.target;this.customAmountButton&&(this.customAmountButton.checked=!0),this.handleCustomAmountInput(t.value)}},{key:"coverFeesChecked",value:function(e){var t=e.target.checked;this.updateDonationInfo({coverFees:t})}},{key:"customAmountChanged",value:function(e){var t=e.target.value;this.customAmountButton&&(this.customAmountButton.checked=!0),this.handleCustomAmountInput(t)}},{key:"handleCustomAmountInput",value:function(e){var t=parseFloat(e);isNaN(t)?this.dispatchEditDonationError(T.InvalidDonationAmount):this.amountChanged(t)}},{key:"handleDonationInfoStatus",value:function(e){switch(e){case T.ValidDonationAmount:this.error=void 0;break;case T.DonationTooHigh:this.error=Object(a.h)(K()),this.dispatchEditDonationError(e);break;case T.DonationTooLow:this.customAmountInput&&this.customAmountInput.value.length>0&&(this.error=Object(a.h)(Y())),this.dispatchEditDonationError(e);break;case T.InvalidDonationAmount:this.error=Object(a.h)(G()),this.dispatchEditDonationError(e)}}},{key:"amountChanged",value:function(e){var t=this.getDonationInfoStatus(e);this.handleDonationInfoStatus(t),t===T.ValidDonationAmount&&this.updateDonationInfo({amount:e})}},{key:"getDonationInfoStatus",value:function(e){return isNaN(e)?T.InvalidDonationAmount:e>=1e4?T.DonationTooHigh:e<1?T.DonationTooLow:T.ValidDonationAmount}},{key:"radioSelected",value:function(e){var t=e.target,n=t.name,r=t.value;switch(n){case x.Amount:this.presetAmountChanged(parseFloat(r));break;case x.DonationType:this.updateDonationInfo({donationType:r})}}},{key:"dispatchEditDonationError",value:function(e){var t=new CustomEvent("editDonationError",{detail:{error:e}});this.dispatchEvent(t)}},{key:"presetAmountChanged",value:function(e){this.error=void 0,this.customAmountInput&&(this.customAmountInput.value=""),this.updateDonationInfo({amount:e})}},{key:"updateDonationInfo",value:function(e){var t,n,r,o=new c.c({donationType:null!==(t=e.donationType)&&void 0!==t?t:this.donationInfo.donationType,amount:null!==(n=e.amount)&&void 0!==n?n:this.donationInfo.amount,coverFees:null!==(r=e.coverFees)&&void 0!==r?r:this.donationInfo.coverFees});this.donationInfo=o;var i=new CustomEvent("donationInfoChanged",{detail:{donationInfo:o}});this.dispatchEvent(i)}},{key:"formSectionNumberMode",get:function(){switch(this.stepNumberMode){case A.ShowNumbers:return r.ShowBadge;case A.HideNumbers:return r.HideBadge}}},{key:"coverFeesTextTemplate",get:function(){return Object(a.h)(J(),d(this.donationInfo.fee,{symbol:"$"}).format())}},{key:"frequencyTemplate",get:function(){return Object(a.h)(W(),this.getRadioButton({group:x.DonationType,value:c.g.OneTime,displayText:"One time",checked:this.donationInfo.donationType===c.g.OneTime}),this.getRadioButton({group:x.DonationType,value:c.g.Monthly,displayText:"Monthly",checked:this.donationInfo.donationType===c.g.Monthly}))}},{key:"presetAmountsTemplate",get:function(){var e=this;return Object(a.h)(L(),this.amountOptions.map((function(t){var n,r=!(null===(n=e.customAmountButton)||void 0===n?void 0:n.checked)&&t===e.donationInfo.amount;return Object(a.h)(H(),e.getRadioButton({group:x.Amount,value:"".concat(t),displayText:"$".concat(t),checked:r}))})))}},{key:"customAmountTemplate",get:function(){var e=this.amountOptions.includes(this.donationInfo.amount)?"":this.donationInfo.amount;return Object(a.h)(q(),x.Amount,this.customRadioSelected,e,this.customAmountChanged,this.currencyValidator.keydown,this.customAmountFocused)}}],[{key:"styles",get:function(){var e=Object(u.b)(z()),t=Object(u.b)(U()),n=Object(u.b)(V()),r=Object(u.b)(B()),o=Object(u.b)(F()),i=Object(u.b)(R()),a=Object(u.b)($()),s=Object(u.b)(I()),c=Object(u.b)(M()),l=Object(u.b)(D()),d=Object(u.b)(N());return Object(u.b)(E(),t,n,e,i,r,o,a,s,c,l,d)}}]),n}();Object(i.a)([Object(u.e)({type:Object})],Z.prototype,"donationInfo",void 0),Object(i.a)([Object(u.e)({type:String})],Z.prototype,"stepNumberMode",void 0),Object(i.a)([Object(u.e)({type:Array})],Z.prototype,"amountOptions",void 0),Object(i.a)([Object(u.e)({type:Object})],Z.prototype,"error",void 0),Object(i.a)([Object(u.f)("#custom-amount-button")],Z.prototype,"customAmountButton",void 0),Object(i.a)([Object(u.f)("#custom-amount-input")],Z.prototype,"customAmountInput",void 0),Z=Object(i.a)([Object(u.c)("donation-form-edit-donation")],Z)},4:function(e,t,n){"use strict";n.d(t,"a",(function(){return A})),n.d(t,"b",(function(){return _})),n.d(t,"c",(function(){return m})),n.d(t,"d",(function(){return i})),n.d(t,"e",(function(){return g})),n.d(t,"f",(function(){return C})),n.d(t,"g",(function(){return w})),n.d(t,"h",(function(){return B})),n.d(t,"i",(function(){return P})),n.d(t,"j",(function(){return R})),n.d(t,"k",(function(){return h})),n.d(t,"l",(function(){return $})),n.d(t,"m",(function(){return f})),n.d(t,"n",(function(){return a})),n.d(t,"o",(function(){return I})),n.d(t,"p",(function(){return l})),n.d(t,"q",(function(){return u}));var r=n(1),o="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;t!==n;){var o=t.nextSibling;e.insertBefore(t,r),t=o}},a=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t!==n;){var r=t.nextSibling;e.removeChild(t),t=r}},u="{{lit-".concat(String(Math.random()).slice(2),"}}"),s="\x3c!--".concat(u,"--\x3e"),c=new RegExp("".concat(u,"|").concat(s)),l=function e(t,n){Object(r.b)(this,e),this.parts=[],this.element=n;for(var o=[],i=[],a=document.createTreeWalker(n.content,133,null,!1),s=0,l=-1,f=0,v=t.strings,m=t.values.length;f
0;){var j=v[f],w=p.exec(j)[2],k=w.toLowerCase()+"$lit$",S=y.getAttribute(k);y.removeAttribute(k);var C=S.split(c);this.parts.push({type:"attribute",index:l,name:w,strings:C}),f+=C.length-1}}"TEMPLATE"===y.tagName&&(i.push(y),a.currentNode=y.content)}else if(3===y.nodeType){var A=y.data;if(A.indexOf(u)>=0){for(var x=y.parentNode,T=A.split(c),P=T.length-1,E=0;E=0&&e.slice(n)===t},f=function(e){return-1!==e.index},h=function(){return document.createComment("")},p=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/,v=new WeakMap,m=function(e){return function(){var t=e.apply(void 0,arguments);return v.set(t,!0),t}},y=function(e){return"function"==typeof e&&v.has(e)},b={},g={},_=function(){function e(t,n,o){Object(r.b)(this,e),this.__parts=[],this.template=t,this.processor=n,this.options=o}return Object(r.c)(e,[{key:"update",value:function(e){var t,n=0,o=Object(r.d)(this.__parts);try{for(o.s();!(t=o.n()).done;){var i=t.value;void 0!==i&&i.setValue(e[n]),n++}}catch(e){o.e(e)}finally{o.f()}var a,u=Object(r.d)(this.__parts);try{for(u.s();!(a=u.n()).done;){var s=a.value;void 0!==s&&s.commit()}}catch(e){u.e(e)}finally{u.f()}}},{key:"_clone",value:function(){for(var e,t=o?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),n=[],i=this.template.parts,a=document.createTreeWalker(t,133,null,!1),u=0,s=0,c=a.nextNode();u-1||n)&&-1===o.indexOf("--\x3e",i+1);var a=p.exec(o);t+=null===a?o+(n?O:s):o.substr(0,a.index)+a[1]+a[2]+"$lit$"+a[3]+u}return t+this.strings[e]}},{key:"getTemplateElement",value:function(){var e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}]),e}(),w=(function(e){Object(r.f)(n,j);var t=Object(r.g)(n);function n(){return Object(r.b)(this,n),t.apply(this,arguments)}Object(r.c)(n,[{key:"getHTML",value:function(){return"".concat(Object(r.h)(Object(r.i)(n.prototype),"getHTML",this).call(this)," ")}},{key:"getTemplateElement",value:function(){var e=Object(r.h)(Object(r.i)(n.prototype),"getTemplateElement",this).call(this),t=e.content,o=t.firstChild;return t.removeChild(o),i(t,o.firstChild),e}}])}(),function(e){return null===e||!("object"===Object(r.a)(e)||"function"==typeof e)}),k=function(e){return Array.isArray(e)||!(!e||!e[Symbol.iterator])},S=function(){function e(t,n,o){Object(r.b)(this,e),this.dirty=!0,this.element=t,this.name=n,this.strings=o,this.parts=[];for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:this.startNode;a(this.startNode.parentNode,e.nextSibling,this.endNode)}}]),e}(),x=function(){function e(t,n,o){if(Object(r.b)(this,e),this.value=void 0,this.__pendingValue=void 0,2!==o.length||""!==o[0]||""!==o[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=n,this.strings=o}return Object(r.c)(e,[{key:"setValue",value:function(e){this.__pendingValue=e}},{key:"commit",value:function(){for(;y(this.__pendingValue);){var e=this.__pendingValue;this.__pendingValue=b,e(this)}if(this.__pendingValue!==b){var t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=b}}}]),e}(),T=function(e){Object(r.f)(n,S);var t=Object(r.g)(n);function n(e,o,i){var a;return Object(r.b)(this,n),(a=t.call(this,e,o,i)).single=2===i.length&&""===i[0]&&""===i[1],a}return Object(r.c)(n,[{key:"_createPart",value:function(){return new P(this)}},{key:"_getValue",value:function(){return this.single?this.parts[0].value:Object(r.h)(Object(r.i)(n.prototype),"_getValue",this).call(this)}},{key:"commit",value:function(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}]),n}(),P=function(e){Object(r.f)(n,C);var t=Object(r.g)(n);function n(){return Object(r.b)(this,n),t.apply(this,arguments)}return n}(),E=!1;
-/**
- * @license
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at
- * http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at
- * http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at
- * http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at
- * http://polymer.github.io/PATENTS.txt
- */!function(){try{var e={get capture(){return E=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}}();var N=function(){function e(t,n,o){var i=this;Object(r.b)(this,e),this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=n,this.eventContext=o,this.__boundHandleEvent=function(e){return i.handleEvent(e)}}return Object(r.c)(e,[{key:"setValue",value:function(e){this.__pendingValue=e}},{key:"commit",value:function(){for(;y(this.__pendingValue);){var e=this.__pendingValue;this.__pendingValue=b,e(this)}if(this.__pendingValue!==b){var t=this.__pendingValue,n=this.value,r=null==t||null!=n&&(t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive),o=null!=t&&(null==n||r);r&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),o&&(this.__options=D(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=b}}},{key:"handleEvent",value:function(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}]),e}(),D=function(e){return e&&(E?{capture:e.capture,passive:e.passive,once:e.once}:e.capture)};
-/**
- * @license
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at
- * http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at
- * http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at
- * http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at
- * http://polymer.github.io/PATENTS.txt
- */function M(e){var t=I.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},I.set(e.type,t));var n=t.stringsArray.get(e.strings);if(void 0!==n)return n;var r=e.strings.join(u);return void 0===(n=t.keyString.get(r))&&(n=new l(e,e.getTemplateElement()),t.keyString.set(r,n)),t.stringsArray.set(e.strings,n),n}var I=new Map,$=new WeakMap,R=function(e,t,n){var r=$.get(t);void 0===r&&(a(t,t.firstChild),$.set(t,r=new A(Object.assign({templateFactory:M},n))),r.appendInto(t)),r.setValue(e),r.commit()},F=new(function(){function e(){Object(r.b)(this,e)}return Object(r.c)(e,[{key:"handleAttributeExpressions",value:function(e,t,n,r){var o=t[0];return"."===o?new T(e,t.slice(1),n).parts:"@"===o?[new N(e,t.slice(1),r.eventContext)]:"?"===o?[new x(e,t.slice(1),n)]:new S(e,t,n).parts}},{key:"handleTextExpression",value:function(e){return new A(e)}}]),e}());
-/**
- * @license
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at
- * http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at
- * http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at
- * http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at
- * http://polymer.github.io/PATENTS.txt
- */
-/**
- * @license
- * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at
- * http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at
- * http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at
- * http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at
- * http://polymer.github.io/PATENTS.txt
- */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");var B=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:{},r=document.getElementsByTagName("head")[0],o=document.createElement("script");o.src=e,o.type="text/javascript",Object.keys(n).forEach((function(e){return o.setAttribute(e,n[e])})),o.onload=t,o.onreadystatechange=function(){"complete"===o.readyState&&t()},r.appendChild(o)},a=function(e){return{charge_token:e.id,email:e.email,isbn:Object(r.a)().isbn,context:Object(r.a)().context,type:$('input[name="type"]:checked').val(),financial_type:"Book Sponsorship",amount:Donations.getDonationAmount(1),source:Donations.enhancedDonationSource($("#stripeOneTime").attr("data-source")),csrf_token:Donations.csrf_token,address_city:e.card.address_city,address_state:e.card.address_state,address_zip:e.card.address_zip,address_country:e.card.address_country,sponsor_msg:$("#sponsorshipMessage").val(),debug:Object(r.a)().debug,scan_only:Object(r.a)().scan_only,join_waitlist:$('[name="waitlist"]').is(":checked"),sponsor_publicly:$('[name="public"]').is(":checked")}};function u(e,t){for(var n=0;n
')}},{key:"init",value:function(){!function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;"undefined"==typeof jQuery&&setTimeout((function(){e(t,n)}),n),t()}((function(){e.setCSRFToken(),e.setBaseURL(),e.renderModalBackdrop();var t=Object(r.a)()||{};t.type&&"sponsorship"===t.type&&e.setupStripeHandler()}))}},{key:"getDonationAmount",value:function(){var t=e.minimumAmount();if($("#custamt").is(":checked"))return e.getSanitizedCustomAmount();var n,r,o=$("input[name=amount]:checked").val();return null!==(r=(n=/^\$?\s*(\d+\.?\d*)\s*$/).exec(o))&&(r.index===n.lastIndex&&(n.lastIndex+=1),parseFloat(r[1])>=t)?parseFloat(r[1]):null}},{key:"setupUpSellPopUp",value:function(e,t){var n=t;n<=10?n=5:n>10&&n<=25?n=10:n>25&&n<=100?n=25:n>100&&(n=50),$("#customer_id").val(e),$("#upsell_amount").val(n)}},{key:"getFrequency",value:function(){return $("[name=type]:checked").val()}},{key:"isFrequencyOptionSelected",value:function(){return $("[name=type]:checked").length>0}},{key:"isSubscriptionSelected",value:function(){return $("#type_subscription").is(":checked")}},{key:"minimumAmount",value:function(){return this.isSubscriptionSelected()?1:5}},{key:"maximumAmount",value:function(){return 9999}},{key:"showMinimumDonationAlert",value:function(){alert("To help prevent fraud, this page can only accept donations between $5 and $9,999.\n\nTo make a donation of $10,000 or more, please contact our philanthropy department at donations@archive.org")}},{key:"getDonationContext",value:function(){return/donatePage/.test($(document.body).attr("class"))?"page":"banner"}},{key:"getDonationPlatform",value:function(){var e=$(".js-donation-refs");return 0===e.count?"IA":e.first().attr("data-platform")||"IA"}},{key:"upSellYesEvent",value:function(){var t=$("#customer_id").val(),n=e.upsellAmount,r=e.csrf_token;if(t&&n&&!(n<1)){var o=$("#up_sell_yes").prop("disabled",!0),i={up_sell:"true",customer_id:t,amount:n,csrf_token:r,currency:"usd"};$.ajax({url:"".concat(e.baseURL,"/services/stripe-charge.php"),type:"post",data:i,success:function(e){var t=$.parseJSON(e);if(t.status){var r=t.data||{charge_id:"unknown"},i=$("#stripeComplete");i.find('input[name="donation-type"]').val("upsell"),i.find('input[name="upsell-amount"]').val(n),i.find('input[name="upsell-charge-id"]').val(r.charge_id),i.submit()}else alert("We apologize but something went wrong. Will you please try again?"),o.removeAttr("disabled")},error:e.stripeChargeError})}}},{key:"stripeChargeError",value:function(){AJS.modal_add("#stripe-charge-error",{title:"Processing Error",body:"We're sorry, but we've encountered an error in processing your\n donation. You may try again or\n contact us \n for assistance.
"}).modal("show"),e.closeUpSellModal(!0)}},{key:"closeUpSellModal",value:function(e){$("#upsell-popup").add("#upsell-popup + .modal-backdrop").removeClass("in").delay(150).hide(),e||$("#stripeComplete").submit()}},{key:"setDonationCookie",value:function(e){var t=parseInt(e,10);if(t){var n={path:"/",expires:t,domain:".archive.org"};"undefined"!=typeof Cookies&&(Cookies.set("donation","x",n),Cookies.set("donation","x",$.extend(n,{domain:".openlibrary.org"})))}}},{key:"enhancedDonationSource",value:function(e){var t=e;if(t)return e.match(/ctx=page/)?e.match(/;ref=/)||(t+=";ref=".concat(encodeURIComponent(document.referrer))):e.match(/;url=/)||(t+=";url=".concat(encodeURIComponent(location.href))),t}},{key:"sendStripeToken",value:function(t,n){var r=$(".upsell-popup"),i=r.find("#up_sell_yes, .later").hide(),a=r.find("#pending");$.ajax({url:"".concat(e.baseURL,"/services/stripe-charge.php"),type:"post",data:n,success:function(r){var u=$.parseJSON(r),s=t.email,c=n.amount,l=n.type,d=u.status,f=u.data,h=f.charge_id,p=f.customer_id;if(Object(o.a)(u),d)if(void 0!==h&&void 0!==p){var v=$("#stripeComplete");v.find('input[name="email"]').val(s),v.find('input[name="amount"]').val(c),v.find('input[name="charge-id"]').val(h),v.find('input[name="donation-type"]').val(l),e.setDonationCookie(45),"one-time"===l?(e.setupUpSellPopUp(p,c),i.show(),a.hide()):v.submit()}else e.stripeChargeError();else e.stripeChargeError()},error:e.stripeChargeError}),"one-time"===n.type&&e.showUpsellPopup()}},{key:"showUpsellPopup",value:function(){var e=$(".upsell-popup"),t=e.next(".modal-backdrop");e.add(t).removeClass("in").show().addClass("in")}},{key:"collectStripeData",value:function(t){return"sponsorship"===Object(r.a)().type?a(t):{charge_token:t.id,email:t.email,type:$('input[name="type"]:checked').val(),amount:e.getDonationAmount(1),source:e.enhancedDonationSource($("#stripeOneTime").attr("data-source")),csrf_token:e.csrf_token,address_city:t.card.address_city,address_state:t.card.address_state,address_zip:t.card.address_zip,address_country:t.card.address_country}}},{key:"configureStripe",value:function(t){var n=StripeCheckout.configure({key:t,image:"".concat(e.baseURL,"/images/logo_arches.png"),token:function(t){Object(o.a)(t);var n=e.collectStripeData(t);Object(o.a)(n),e.sendStripeToken(t,n)}});e.bindStripeClickEvents(n)}},{key:"bindStripeClickEvents",value:function(t){var n=function(n){var r=e.getDonationAmount(1);if(r){var o=100*r;"undefined"!=typeof archive_analytics&&archive_analytics.send_event_no_sampling("DonatePage","CreditCard".concat(n.data.frequency.replace(/\s/g,"")),window.location.pathname),t.open({image:"".concat(e.baseURL,"/images/logo_arches.png"),name:"Internet Archive",description:"".concat(n.data.frequency," Donation"),amount:o,panelLabel:"Donate {{amount}} ".concat(n.data.frequency),billingAddress:!0}),n.preventDefault()}};$("#stripeMonthly").on("click",{frequency:"Monthly"},n),$("#stripeOneTime").on("click",{frequency:"One Time"},n),$(window).on("popstate",(function(){return t.close()}))}},{key:"setupStripeHandler",value:function(){e.stripSetupStarted||(e.stripSetupStarted=!0,"undefined"!=typeof StripeCheckout?e.configureStripe($("#stripe_public_key").val()):i("https://checkout.stripe.com/checkout.js",(function(){e.configureStripe($("#stripe_public_key").val())})))}},{key:"amountIsValid",value:function(){var t=$("input[type=radio][name=amount]:checked").length>0,n=$("#custamt").is(":checked");if(t&&!n)return!0;var r=this.minimumAmount(),o=e.getSanitizedCustomAmount(),i=parseFloat(o),a=o.length>0&&!isNaN(i)&&i>=r&&i<1e4;return a}},{key:"upsellAmount",get:function(){return $("#upsell_amount").val()}},{key:"fakePaymentNonce",get:function(){return $("#fakePaymentNonce").val()}}],(n=null)&&u(t.prototype,n),s&&u(t,s),e}();window&&window.AJS&&(window.AJS.setDonateBannerSuppressionCookie=s.setDonationCookie),window.Donations=s,$((function(){$(".donate-form-section").length>0&&window.Donations.init()}))},7:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return i}));var r=n(1);
-/*! *****************************************************************************
-Copyright (c) Microsoft Corporation.
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-***************************************************************************** */function o(e,t,n,o){var i,a=arguments.length,u=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"===("undefined"==typeof Reflect?"undefined":Object(r.a)(Reflect))&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(u=(a<3?i(u):a>3?i(t,n,u):i(t,n))||u);return a>3&&u&&Object.defineProperty(t,n,u),u}function i(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function u(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,u)}s((r=r.apply(e,t||[])).next())}))}},97:function(e,t,n){"use strict";n.r(t);var r=n(51),o=n(2);function i(e,t){for(var n=0;n