Edit file File name : eventTicketsBlock.js Content :(()=>{"use strict";const e=JSON.parse('{"name":"givewp/event-tickets","title":"Event Tickets","description":"Sell event tickets for your cause","category":"input","icon":"yes","supports":{"multiple":false},"attributes":{"eventId":{"type":"number"}}}'),t=window.React,n=window.wp.element,a=(0,n.forwardRef)((function({icon:e,size:t=24,...a},r){return(0,n.cloneElement)(e,{width:t,height:t,...a,ref:r})})),r=window.wp.components,i=window.wp.blockEditor,o=window.wp.i18n;function u(){return(0,t.createElement)("div",{className:"givewp-event-tickets-block__create-event-notice"},(0,t.createElement)(r.Notice,{isDismissible:!1,status:"warning"},(0,t.createElement)("h4",null,(0,o.__)("No event created yet","give")),(0,t.createElement)("p",null,(0,o.__)("Donors will not be able to see any event on this form","give")),(0,t.createElement)("p",null,(0,n.createInterpolateElement)((0,o.__)("<a>Create an event</a>","give"),{a:(0,t.createElement)("a",{href:window.eventTicketsBlockSettings.createEventUrl,target:"_blank"})}))))}function l({attributes:e,setAttributes:a}){var l;const{events:c}=window.eventTicketsBlockSettings,{eventId:s}=e,d=null!==(l=c.map((e=>({label:e.title,value:`${e.id}`}))))&&void 0!==l?l:[];return(0,t.createElement)(i.InspectorControls,null,(0,t.createElement)(r.PanelBody,{title:(0,o.__)("Event","give"),initialOpen:!0},0===c.length?(0,t.createElement)(u,null):(0,t.createElement)(r.PanelRow,null,(0,t.createElement)(r.SelectControl,{label:(0,o.__)("Event Name","give"),help:(0,n.createInterpolateElement)((0,o.__)("Add or edit an event in the <a>events page</a>.","give"),{a:(0,t.createElement)("a",{href:window.eventTicketsBlockSettings.listEventsUrl,target:"_blank"})}),value:`${s}`,options:[{label:"Select",value:""},...d],onChange:e=>a({eventId:Number(e)})}))))}function c(){return(0,t.createElement)("div",{className:"givewp-event-tickets-block__placeholder--no-events"},(0,t.createElement)("p",null,(0,n.createInterpolateElement)((0,o.__)("No events created yet. Go to the <a>events page</a> to create and manage your own event.","give"),{a:(0,t.createElement)("a",{href:window.eventTicketsBlockSettings.listEventsUrl,target:"_blank"})})))}function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function d(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function m(e){d(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===s(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn((new Error).stack)),new Date(NaN))}function h(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function f(e){d(1,arguments);var t=m(e),n=t.getUTCDay(),a=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-a),t.setUTCHours(0,0,0,0),t}function v(e){d(1,arguments);var t=m(e),n=t.getUTCFullYear(),a=new Date(0);a.setUTCFullYear(n+1,0,4),a.setUTCHours(0,0,0,0);var r=f(a),i=new Date(0);i.setUTCFullYear(n,0,4),i.setUTCHours(0,0,0,0);var o=f(i);return t.getTime()>=r.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}var g={};function w(){return g}function b(e,t){var n,a,r,i,o,u,l,c;d(1,arguments);var s=w(),f=h(null!==(n=null!==(a=null!==(r=null!==(i=null==t?void 0:t.weekStartsOn)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.weekStartsOn)&&void 0!==r?r:s.weekStartsOn)&&void 0!==a?a:null===(l=s.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.weekStartsOn)&&void 0!==n?n:0);if(!(f>=0&&f<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var v=m(e),g=v.getUTCDay(),b=(g<f?7:0)+g-f;return v.setUTCDate(v.getUTCDate()-b),v.setUTCHours(0,0,0,0),v}function p(e,t){var n,a,r,i,o,u,l,c;d(1,arguments);var s=m(e),f=s.getUTCFullYear(),v=w(),g=h(null!==(n=null!==(a=null!==(r=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==r?r:v.firstWeekContainsDate)&&void 0!==a?a:null===(l=v.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1);if(!(g>=1&&g<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var p=new Date(0);p.setUTCFullYear(f+1,0,g),p.setUTCHours(0,0,0,0);var y=b(p,t),k=new Date(0);k.setUTCFullYear(f,0,g),k.setUTCHours(0,0,0,0);var T=b(k,t);return s.getTime()>=y.getTime()?f+1:s.getTime()>=T.getTime()?f:f-1}function y(e,t){for(var n=e<0?"-":"",a=Math.abs(e).toString();a.length<t;)a="0"+a;return n+a}const k=function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return y("yy"===t?a%100:a,t.length)},T=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):y(n+1,2)},E=function(e,t){return y(e.getUTCDate(),t.length)},M=function(e,t){return y(e.getUTCHours()%12||12,t.length)},C=function(e,t){return y(e.getUTCHours(),t.length)},_=function(e,t){return y(e.getUTCMinutes(),t.length)},S=function(e,t){return y(e.getUTCSeconds(),t.length)},D=function(e,t){var n=t.length,a=e.getUTCMilliseconds();return y(Math.floor(a*Math.pow(10,n-3)),t.length)};var x={G:function(e,t,n){var a=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if("yo"===t){var a=e.getUTCFullYear(),r=a>0?a:1-a;return n.ordinalNumber(r,{unit:"year"})}return k(e,t)},Y:function(e,t,n,a){var r=p(e,a),i=r>0?r:1-r;return"YY"===t?y(i%100,2):"Yo"===t?n.ordinalNumber(i,{unit:"year"}):y(i,t.length)},R:function(e,t){return y(v(e),t.length)},u:function(e,t){return y(e.getUTCFullYear(),t.length)},Q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return y(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){var a=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return y(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){var a=e.getUTCMonth();switch(t){case"M":case"MM":return T(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){var a=e.getUTCMonth();switch(t){case"L":return String(a+1);case"LL":return y(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){var r=function(e,t){d(1,arguments);var n=m(e),a=b(n,t).getTime()-function(e,t){var n,a,r,i,o,u,l,c;d(1,arguments);var s=w(),m=h(null!==(n=null!==(a=null!==(r=null!==(i=null==t?void 0:t.firstWeekContainsDate)&&void 0!==i?i:null==t||null===(o=t.locale)||void 0===o||null===(u=o.options)||void 0===u?void 0:u.firstWeekContainsDate)&&void 0!==r?r:s.firstWeekContainsDate)&&void 0!==a?a:null===(l=s.locale)||void 0===l||null===(c=l.options)||void 0===c?void 0:c.firstWeekContainsDate)&&void 0!==n?n:1),f=p(e,t),v=new Date(0);return v.setUTCFullYear(f,0,m),v.setUTCHours(0,0,0,0),b(v,t)}(n,t).getTime();return Math.round(a/6048e5)+1}(e,a);return"wo"===t?n.ordinalNumber(r,{unit:"week"}):y(r,t.length)},I:function(e,t,n){var a=function(e){d(1,arguments);var t=m(e),n=f(t).getTime()-function(e){d(1,arguments);var t=v(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),f(n)}(t).getTime();return Math.round(n/6048e5)+1}(e);return"Io"===t?n.ordinalNumber(a,{unit:"week"}):y(a,t.length)},d:function(e,t,n){return"do"===t?n.ordinalNumber(e.getUTCDate(),{unit:"date"}):E(e,t)},D:function(e,t,n){var a=function(e){d(1,arguments);var t=m(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var a=n-t.getTime();return Math.floor(a/864e5)+1}(e);return"Do"===t?n.ordinalNumber(a,{unit:"dayOfYear"}):y(a,t.length)},E:function(e,t,n){var a=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return y(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(r,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(r,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){var r=e.getUTCDay(),i=(r-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return y(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(r,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(r,{width:"narrow",context:"standalone"});case"cccccc":return n.day(r,{width:"short",context:"standalone"});default:return n.day(r,{width:"wide",context:"standalone"})}},i:function(e,t,n){var a=e.getUTCDay(),r=0===a?7:a;switch(t){case"i":return String(r);case"ii":return y(r,t.length);case"io":return n.ordinalNumber(r,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){var a=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){var a,r=e.getUTCHours();switch(a=12===r?"noon":0===r?"midnight":r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){var a,r=e.getUTCHours();switch(a=r>=17?"evening":r>=12?"afternoon":r>=4?"morning":"night",t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if("ho"===t){var a=e.getUTCHours()%12;return 0===a&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return M(e,t)},H:function(e,t,n){return"Ho"===t?n.ordinalNumber(e.getUTCHours(),{unit:"hour"}):C(e,t)},K:function(e,t,n){var a=e.getUTCHours()%12;return"Ko"===t?n.ordinalNumber(a,{unit:"hour"}):y(a,t.length)},k:function(e,t,n){var a=e.getUTCHours();return 0===a&&(a=24),"ko"===t?n.ordinalNumber(a,{unit:"hour"}):y(a,t.length)},m:function(e,t,n){return"mo"===t?n.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):_(e,t)},s:function(e,t,n){return"so"===t?n.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):S(e,t)},S:function(e,t){return D(e,t)},X:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();if(0===r)return"Z";switch(t){case"X":return U(r);case"XXXX":case"XX":return N(r);default:return N(r,":")}},x:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"x":return U(r);case"xxxx":case"xx":return N(r);default:return N(r,":")}},O:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+P(r,":");default:return"GMT"+N(r,":")}},z:function(e,t,n,a){var r=(a._originalDate||e).getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+P(r,":");default:return"GMT"+N(r,":")}},t:function(e,t,n,a){var r=a._originalDate||e;return y(Math.floor(r.getTime()/1e3),t.length)},T:function(e,t,n,a){return y((a._originalDate||e).getTime(),t.length)}};function P(e,t){var n=e>0?"-":"+",a=Math.abs(e),r=Math.floor(a/60),i=a%60;if(0===i)return n+String(r);var o=t||"";return n+String(r)+o+y(i,2)}function U(e,t){return e%60==0?(e>0?"-":"+")+y(Math.abs(e)/60,2):N(e,t)}function N(e,t){var n=t||"",a=e>0?"-":"+",r=Math.abs(e);return a+y(Math.floor(r/60),2)+n+y(r%60,2)}const W=x;var Y=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},O=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},q={p:O,P:function(e,t){var n,a=e.match(/(P+)(p+)?/)||[],r=a[1],i=a[2];if(!i)return Y(e,t);switch(r){case"P":n=t.dateTime({width:"short"});break;case"PP":n=t.dateTime({width:"medium"});break;case"PPP":n=t.dateTime({width:"long"});break;default:n=t.dateTime({width:"full"})}return n.replace("{{date}}",Y(r,t)).replace("{{time}}",O(i,t))}};const L=q;var H=["D","DD"],F=["YY","YYYY"];function z(e,t,n){if("YYYY"===e)throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("YY"===e)throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("D"===e)throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if("DD"===e)throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var B={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function j(e){return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var A,G={date:j({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:j({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:j({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},R={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function I(e){return function(t,n){var a;if("formatting"===(null!=n&&n.context?String(n.context):"standalone")&&e.formattingValues){var r=e.defaultFormattingWidth||e.defaultWidth,i=null!=n&&n.width?String(n.width):r;a=e.formattingValues[i]||e.formattingValues[r]}else{var o=e.defaultWidth,u=null!=n&&n.width?String(n.width):e.defaultWidth;a=e.values[u]||e.values[o]}return a[e.argumentCallback?e.argumentCallback(t):t]}}function Q(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.width,r=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],i=t.match(r);if(!i)return null;var o,u=i[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].test(u))return n}(l):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&e[n].test(u))return n}(l);return o=e.valueCallback?e.valueCallback(c):c,{value:o=n.valueCallback?n.valueCallback(o):o,rest:t.slice(u.length)}}}const X={code:"en-US",formatDistance:function(e,t,n){var a,r=B[e];return a="string"==typeof r?r:1===t?r.one:r.other.replace("{{count}}",t.toString()),null!=n&&n.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a},formatLong:G,formatRelative:function(e,t,n,a){return R[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:I({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:I({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:I({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:I({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:I({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(A={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(A.matchPattern);if(!n)return null;var a=n[0],r=e.match(A.parsePattern);if(!r)return null;var i=A.valueCallback?A.valueCallback(r[0]):r[0];return{value:i=t.valueCallback?t.valueCallback(i):i,rest:e.slice(a.length)}}),era:Q({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:Q({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Q({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:Q({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:Q({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};var V=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,J=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$=/^'([^]*?)'?$/,K=/''/g,Z=/[a-zA-Z]/;function ee(e,t,n){var a,r,i,o,u,l,c,f,v,g,b,p,y,k,T,E,M,C;d(2,arguments);var _=String(t),S=w(),D=null!==(a=null!==(r=null==n?void 0:n.locale)&&void 0!==r?r:S.locale)&&void 0!==a?a:X,x=h(null!==(i=null!==(o=null!==(u=null!==(l=null==n?void 0:n.firstWeekContainsDate)&&void 0!==l?l:null==n||null===(c=n.locale)||void 0===c||null===(f=c.options)||void 0===f?void 0:f.firstWeekContainsDate)&&void 0!==u?u:S.firstWeekContainsDate)&&void 0!==o?o:null===(v=S.locale)||void 0===v||null===(g=v.options)||void 0===g?void 0:g.firstWeekContainsDate)&&void 0!==i?i:1);if(!(x>=1&&x<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var P=h(null!==(b=null!==(p=null!==(y=null!==(k=null==n?void 0:n.weekStartsOn)&&void 0!==k?k:null==n||null===(T=n.locale)||void 0===T||null===(E=T.options)||void 0===E?void 0:E.weekStartsOn)&&void 0!==y?y:S.weekStartsOn)&&void 0!==p?p:null===(M=S.locale)||void 0===M||null===(C=M.options)||void 0===C?void 0:C.weekStartsOn)&&void 0!==b?b:0);if(!(P>=0&&P<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!D.localize)throw new RangeError("locale must contain localize property");if(!D.formatLong)throw new RangeError("locale must contain formatLong property");var U=m(e);if(!function(e){if(d(1,arguments),!function(e){return d(1,arguments),e instanceof Date||"object"===s(e)&&"[object Date]"===Object.prototype.toString.call(e)}(e)&&"number"!=typeof e)return!1;var t=m(e);return!isNaN(Number(t))}(U))throw new RangeError("Invalid time value");var N=function(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}(U),Y=function(e,t){return d(2,arguments),function(e,t){d(2,arguments);var n=m(e).getTime(),a=h(t);return new Date(n+a)}(e,-h(t))}(U,N),O={firstWeekContainsDate:x,weekStartsOn:P,locale:D,_originalDate:U};return _.match(J).map((function(e){var t=e[0];return"p"===t||"P"===t?(0,L[t])(e,D.formatLong):e})).join("").match(V).map((function(a){if("''"===a)return"'";var r,i,o=a[0];if("'"===o)return(i=(r=a).match($))?i[1].replace(K,"'"):r;var u,l=W[o];if(l)return null!=n&&n.useAdditionalWeekYearTokens||(u=a,-1===F.indexOf(u))||z(a,t,String(e)),null!=n&&n.useAdditionalDayOfYearTokens||!function(e){return-1!==H.indexOf(e)}(a)||z(a,t,String(e)),l(Y,a,D.localize,O);if(o.match(Z))throw new RangeError("Format string contains an unescaped latin alphabet character `"+o+"`");return a})).join("")}function te({title:e,startDateTime:n}){const a=ee(n,"EEEE, MMMM do, hh:mmaaa"),r=ee(n,"dd"),i=ee(n,"MMM");return(0,t.createElement)("div",{className:"givewp-event-tickets__header"},(0,t.createElement)("div",{className:"givewp-event-tickets__header__date"},r," ",(0,t.createElement)("span",null,i)),(0,t.createElement)("h4",{className:"givewp-event-tickets__header__title"},e),(0,t.createElement)("p",{className:"givewp-event-tickets__header__full-date"},a))}function ne({description:e}){return(0,t.createElement)("div",{className:"givewp-event-tickets__description"},(0,t.createElement)("p",null,e))}const ae=window.wp.primitives,re=(0,t.createElement)(ae.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(ae.Path,{d:"M7 11.5h10V13H7z"})),ie=(0,t.createElement)(ae.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(ae.Path,{d:"M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z"}));function oe({ticketType:e,currency:n,currencyRate:a,selectedTickets:i,handleSelect:u}){const l=function(e,n){return(0,t.useMemo)((()=>function(e,t){return new Intl.NumberFormat(navigator.language,{style:"currency",currency:e,...t})}(e,n)),[e,navigator.language])}(n),c=e.price>0?l.format(Number(e.price)*a/100):(0,o.__)("Free","give"),s=e.ticketsAvailable-i,d=e=>t=>{t.preventDefault(),u(e)};return(0,t.createElement)("div",{className:"givewp-event-tickets__tickets__ticket",key:e.id},(0,t.createElement)("div",{className:"givewp-event-tickets__tickets__ticket__description"},(0,t.createElement)("h5",null,e.title),(0,t.createElement)("p",null,c),(0,t.createElement)("p",null,e.description)),(0,t.createElement)("div",{className:"givewp-event-tickets__tickets__ticket__quantity"},s>0?(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"givewp-event-tickets__tickets__ticket__quantity__input"},(0,t.createElement)("button",{onClick:d(i-1)},(0,t.createElement)(r.Icon,{icon:re})),(0,t.createElement)("input",{type:"text",value:i}),(0,t.createElement)("button",{onClick:d(i+1)},(0,t.createElement)(r.Icon,{icon:ie}))),(0,t.createElement)("p",{className:"givewp-event-tickets__tickets__ticket__quantity__availability"},s," ",(0,o.__)("remaining","give"))):(0,t.createElement)("span",null,(0,o.__)("Sold out","give"))))}function ue({ticketTypes:e,ticketsLabel:n,currency:a,currencyRate:r,selectedTickets:i=[],handleSelect:o=null}){return e?.length?(0,t.createElement)("div",{className:"givewp-event-tickets__tickets"},(0,t.createElement)("h4",null,n),e.map((e=>{var n;return(0,t.createElement)(oe,{ticketType:e,selectedTickets:null!==(n=i[e.id]?.quantity)&&void 0!==n?n:0,handleSelect:o?o(e.id,e.ticketsAvailable,e.price):()=>null,currency:a,currencyRate:r})}))):null}function le({attributes:e}){const{events:n,ticketsLabel:a,soldOutMessage:r}=window.eventTicketsBlockSettings,i=n.find((t=>t.id===e.eventId)),{currency:o}=window.giveStorageData;return i?(0,t.createElement)("div",{className:"givewp-event-tickets-block__placeholder"},(0,t.createElement)("div",{className:"givewp-event-tickets"},(0,t.createElement)(te,{title:i.title,startDateTime:new Date(i.startDateTime)}),i.description&&(0,t.createElement)(ne,{description:i.description}),(0,t.createElement)(ue,{ticketTypes:i.ticketTypes,ticketsLabel:a,currency:o,currencyRate:1}))):null}function ce({attributes:e,setAttributes:n}){var a;const{events:i}=window.eventTicketsBlockSettings,u=null!==(a=i.map((e=>({label:e.title,value:`${e.id}`}))))&&void 0!==a?a:[];return(0,t.createElement)("div",{className:"givewp-event-tickets-block__placeholder--select-event"},(0,t.createElement)("p",null,(0,t.createElement)("strong",null,(0,o.__)("No event selected yet","give"))),(0,t.createElement)(r.SelectControl,{label:(0,o.__)("Select your preferred event for this donation form","give"),value:`${e.eventId}`,options:[{label:"Select",value:""},...u],onChange:e=>n({eventId:Number(e)})}))}window.giveStorageData,window.jQuery;const se={...e,icon:function(){return(0,t.createElement)(a,{icon:(0,t.createElement)(r.SVG,{width:"24",height:"24",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(r.Path,{d:"M10 6a1 1 0 01.993.883l.007.116v1a1 1 0 01-1.993.117L9 7.999V7a1 1 0 011-1zM10 10.5a1 1 0 01.993.883l.007.116v1a1 1 0 01-1.993.117L9 12.499v-1a1 1 0 011-1zM10 15a1 1 0 01.993.883l.007.116v1a1 1 0 01-1.993.117L9 16.999v-1a1 1 0 011-1z",fill:"currentColor"}),(0,t.createElement)(r.Path,{d:"M4.753 3l-.441.006-.375.014c-.576.034-.925.116-1.299.306a3 3 0 00-1.311 1.311c-.19.374-.273.724-.306 1.298l-.015.374-.005.439L1 8.499a1 1 0 001 1 2.5 2.5 0 01.164 4.995L2 14.499a1 1 0 00-1 1v1.748l.006.44.015.375c.033.576.116.926.306 1.3a3 3 0 001.311 1.31l.178.085c.263.115.514.176.905.208l.283.018.334.01L5.2 21h14.067l.57-.01.307-.014a4.47 4.47 0 00.485-.052l.198-.042c.094-.024.182-.053.27-.087l.175-.077.09-.045a3 3 0 001.311-1.31l.085-.18c.051-.116.092-.23.124-.356l.041-.198a3.97 3.97 0 00.043-.35l.017-.282.01-.334.007-.863v-1.3a1 1 0 00-.883-.993L22 14.5a2.5 2.5 0 110-5 1 1 0 001-1l-.001-1.766-.01-.57-.013-.307c-.026-.424-.078-.691-.182-.953l-.076-.175a3 3 0 00-1.356-1.401c-.374-.191-.723-.273-1.298-.307l-.373-.014L19.25 3H4.754zm-.169 2.001H19.42l.295.006.333.017.16.018.12.022.09.028a1 1 0 01.472.453l.015.031.026.074.02.095.01.058.014.141.01.183.01.367L21 7.2v.411l-.032.008A4.502 4.502 0 0017.5 12l.005.212a4.503 4.503 0 003.26 4.117l.235.06-.004 1.117-.01.367-.011.183-.015.141-.018.109-.023.083-.028.065a1 1 0 01-.437.437l-.031.015-.073.025-.095.02a1.572 1.572 0 01-.058.01l-.142.014-.182.01-.368.011-.705.004-14.154-.002-.41-.008-.206-.01-.227-.02-.108-.018-.083-.023-.066-.028a1 1 0 01-.437-.437l-.016-.035-.028-.09-.023-.12-.017-.162-.017-.334-.006-.297L3 16.387l.032-.006A4.502 4.502 0 006.5 11.999l-.005-.211a4.503 4.503 0 00-3.26-4.117L3 7.611l.002-1.031.006-.295.017-.333.017-.16.023-.122.028-.09a1 1 0 01.453-.473l.036-.015.09-.028.12-.022.161-.018.334-.017.297-.006z",fill:"currentColor"}))})},edit:function(e){const{events:n}=window.eventTicketsBlockSettings,{attributes:{eventId:a}}=e,r=n.map((e=>e.id));return(0,t.createElement)(t.Fragment,null,0===n.length?(0,t.createElement)(c,null):a&&r.includes(a)?(0,t.createElement)(le,{...e}):(0,t.createElement)(ce,{...e}),(0,t.createElement)(l,{...e}))}},de={name:se.name,settings:se};window.givewp.form.blocks.register(de.name,de.settings)})();Save