1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1782cf16-c9d1-5768-8b38-0dd932a577ec")}catch(e){}}(); 3import{s as O,t as ee}from"./react.DV6_eVDT.min.js";import{c as te}from"./auth.-To66sjS.min.js";import{i as ne,u as ie}from"./api.BiMiMY5t.min.js";import{h as ae,m as re,t as oe}from"./dist.DMGjdrqP.min.js";import{n as de}from"./http.DDKEEI-O.min.js";import{b as m,f as w,h as g,m as k,u as y,x as l}from"./grpc.qgvKf2ZU.min.js";import{O as D,b as v,k as se,x as N}from"./utils.DJXLqB_G.min.js";import{n as s,r as u,t as le}from"./emotion-react-jsx-runtime.browser.esm.DAIxDqBb.min.js";import{t as G}from"./Button.CGlnNnHA.min.js";import{t as ce}from"./TextField.7wMud59P.min.js";import{n as $,t as B}from"./pagination.EEK9XCq4.min.js";import{Rn as pe,Xn as me}from"./main.pmPWxjBM.min.js";import{t as ue}from"./protected.D_j8Hx00.min.js";var x=O(ee(),1),f=function(e){return e[e.GiftCodeErrorNone=0]="GiftCodeErrorNone",e[e.GiftCodeErrorNotFound=1]="GiftCodeErrorNotFound",e[e.GiftCodeErrorDisabled=2]="GiftCodeErrorDisabled",e[e.GiftCodeErrorNotYetValid=3]="GiftCodeErrorNotYetValid",e[e.GiftCodeErrorExpired=4]="GiftCodeErrorExpired",e[e.GiftCodeErrorFullyRedeemed=5]="GiftCodeErrorFullyRedeemed",e[e.GiftCodeErrorNotAssignedToUser=6]="GiftCodeErrorNotAssignedToUser",e[e.GiftCodeErrorUserLimitReached=7]="GiftCodeErrorUserLimitReached",e[e.GiftCodeErrorAlreadyOwned=8]="GiftCodeErrorAlreadyOwned",e[e.GiftCodeErrorActivePaidSubscription=9]="GiftCodeErrorActivePaidSubscription",e[e.GiftCodeErrorIneligible=10]="GiftCodeErrorIneligible",e[e.GiftCodeErrorRateLimited=11]="GiftCodeErrorRateLimited",e}({}),S=function(e){return e[e.GiftCodeEntitlementTypeNone=0]="GiftCodeEntitlementTypeNone",e[e.GiftCodeEntitlementTypeProduct=1]="GiftCodeEntitlementTypeProduct",e[e.GiftCodeEntitlementTypeKarma=2]="GiftCodeEntitlementTypeKarma",e[e.GiftCodeEntitlementTypeChapterVoucher=3]="GiftCodeEntitlementTypeChapterVoucher",e[e.GiftCodeEntitlementTypeSiteCredit=4]="GiftCodeEntitlementTypeSiteCredit",e}({}),fe=class extends k{constructor(){super("wuxiaworld.api.v2.GiftCodeEntitlementItem",[{no:1,name:"entitlementId",kind:"scalar",T:5},{no:2,name:"type",kind:"enum",T:()=>["wuxiaworld.api.v2.GiftCodeEntitlementType",S]},{no:3,name:"description",kind:"scalar",T:9},{no:4,name:"productId",kind:"message",T:()=>y},{no:5,name:"quantity",kind:"scalar",T:5},{no:6,name:"amount",kind:"message",T:()=>v},{no:7,name:"durationDays",kind:"message",T:()=>y},{no:8,name:"isGrantable",kind:"scalar",T:8},{no:9,name:"blockedBy",kind:"enum",T:()=>["wuxiaworld.api.v2.GiftCodeError",f]},{no:10,name:"blockedReason",kind:"message",T:()=>w}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.entitlementId=0,t.type=0,t.description="",t.quantity=0,t.isGrantable=!1,t.blockedBy=0,e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.entitlementId=e.int32();break;case 2:n.type=e.int32();break;case 3:n.description=e.string();break;case 4:n.productId=y.internalBinaryRead(e,e.uint32(),i,n.productId);break;case 5:n.quantity=e.int32();break;case 6:n.amount=v.internalBinaryRead(e,e.uint32(),i,n.amount);break;case 7:n.durationDays=y.internalBinaryRead(e,e.uint32(),i,n.durationDays);break;case 8:n.isGrantable=e.bool();break;case 9:n.blockedBy=e.int32();break;case 10:n.blockedReason=w.internalBinaryRead(e,e.uint32(),i,n.blockedReason);break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.entitlementId!==0&&t.tag(1,l.Varint).int32(e.entitlementId),e.type!==0&&t.tag(2,l.Varint).int32(e.type),e.description!==""&&t.tag(3,l.LengthDelimited).string(e.description),e.productId&&y.internalBinaryWrite(e.productId,t.tag(4,l.LengthDelimited).fork(),i).join(),e.quantity!==0&&t.tag(5,l.Varint).int32(e.quantity),e.amount&&v.internalBinaryWrite(e.amount,t.tag(6,l.LengthDelimited).fork(),i).join(),e.durationDays&&y.internalBinaryWrite(e.durationDays,t.tag(7,l.LengthDelimited).fork(),i).join(),e.isGrantable!==!1&&t.tag(8,l.Varint).bool(e.isGrantable),e.blockedBy!==0&&t.tag(9,l.Varint).int32(e.blockedBy),e.blockedReason&&w.internalBinaryWrite(e.blockedReason,t.tag(10,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},R=new fe,he=class extends k{constructor(){super("wuxiaworld.api.v2.GiftCodeGrantItem",[{no:1,name:"type",kind:"enum",T:()=>["wuxiaworld.api.v2.GiftCodeEntitlementType",S]},{no:2,name:"description",kind:"scalar",T:9},{no:3,name:"quantity",kind:"scalar",T:5},{no:4,name:"amount",kind:"message",T:()=>v},{no:5,name:"expiresAt",kind:"message",T:()=>N},{no:6,name:"orderId",kind:"message",T:()=>y}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.type=0,t.description="",t.quantity=0,e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.type=e.int32();break;case 2:n.description=e.string();break;case 3:n.quantity=e.int32();break;case 4:n.amount=v.internalBinaryRead(e,e.uint32(),i,n.amount);break;case 5:n.expiresAt=N.internalBinaryRead(e,e.uint32(),i,n.expiresAt);break;case 6:n.orderId=y.internalBinaryRead(e,e.uint32(),i,n.orderId);break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.type!==0&&t.tag(1,l.Varint).int32(e.type),e.description!==""&&t.tag(2,l.LengthDelimited).string(e.description),e.quantity!==0&&t.tag(3,l.Varint).int32(e.quantity),e.amount&&v.internalBinaryWrite(e.amount,t.tag(4,l.LengthDelimited).fork(),i).join(),e.expiresAt&&N.internalBinaryWrite(e.expiresAt,t.tag(5,l.LengthDelimited).fork(),i).join(),e.orderId&&y.internalBinaryWrite(e.orderId,t.tag(6,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},T=new he,ye=class extends k{constructor(){super("wuxiaworld.api.v2.PreviewGiftCodeRequest",[{no:1,name:"code",kind:"scalar",T:9,options:{"wuxiaworld.api.v2.required":{value:!0}}}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.code="",e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.code=e.string();break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.code!==""&&t.tag(1,l.LengthDelimited).string(e.code);let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},V=new ye,ge=class extends k{constructor(){super("wuxiaworld.api.v2.PreviewGiftCodeResponse",[{no:1,name:"code",kind:"scalar",T:9},{no:2,name:"batchName",kind:"scalar",T:9},{no:3,name:"description",kind:"message",T:()=>w},{no:4,name:"entitlements",kind:"message",repeat:2,T:()=>R}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.code="",t.batchName="",t.entitlements=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.code=e.string();break;case 2:n.batchName=e.string();break;case 3:n.description=w.internalBinaryRead(e,e.uint32(),i,n.description);break;case 4:n.entitlements.push(R.internalBinaryRead(e,e.uint32(),i));break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.code!==""&&t.tag(1,l.LengthDelimited).string(e.code),e.batchName!==""&&t.tag(2,l.LengthDelimited).string(e.batchName),e.description&&w.internalBinaryWrite(e.description,t.tag(3,l.LengthDelimited).fork(),i).join();for(let n=0;n<e.entitlements.length;n++)R.internalBinaryWrite(e.entitlements[n],t.tag(4,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},ke=new ge,xe=class extends k{constructor(){super("wuxiaworld.api.v2.RedeemGiftCodeRequest",[{no:1,name:"code",kind:"scalar",T:9,options:{"wuxiaworld.api.v2.required":{value:!0}}}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.code="",e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.code=e.string();break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.code!==""&&t.tag(1,l.LengthDelimited).string(e.code);let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},M=new xe,be=class extends k{constructor(){super("wuxiaworld.api.v2.RedeemGiftCodeResponse",[{no:1,name:"redemptionId",kind:"scalar",T:5},{no:2,name:"code",kind:"scalar",T:9},{no:3,name:"grants",kind:"message",repeat:2,T:()=>T},{no:4,name:"skipped",kind:"message",repeat:2,T:()=>R}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.redemptionId=0,t.code="",t.grants=[],t.skipped=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.redemptionId=e.int32();break;case 2:n.code=e.string();break;case 3:n.grants.push(T.internalBinaryRead(e,e.uint32(),i));break;case 4:n.skipped.push(R.internalBinaryRead(e,e.uint32(),i));break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.redemptionId!==0&&t.tag(1,l.Varint).int32(e.redemptionId),e.code!==""&&t.tag(2,l.LengthDelimited).string(e.code);for(let n=0;n<e.grants.length;n++)T.internalBinaryWrite(e.grants[n],t.tag(3,l.LengthDelimited).fork(),i).join();for(let n=0;n<e.skipped.length;n++)R.internalBinaryWrite(e.skipped[n],t.tag(4,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},we=new be,ve=class extends k{constructor(){super("wuxiaworld.api.v2.GiftCodeRedemptionItem",[{no:1,name:"id",kind:"scalar",T:5},{no:2,name:"code",kind:"scalar",T:9},{no:3,name:"batchName",kind:"scalar",T:9},{no:4,name:"redeemedAt",kind:"message",T:()=>N},{no:5,name:"grants",kind:"message",repeat:2,T:()=>T}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.id=0,t.code="",t.batchName="",t.grants=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.id=e.int32();break;case 2:n.code=e.string();break;case 3:n.batchName=e.string();break;case 4:n.redeemedAt=N.internalBinaryRead(e,e.uint32(),i,n.redeemedAt);break;case 5:n.grants.push(T.internalBinaryRead(e,e.uint32(),i));break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}
3internalBinaryWrite(e,t,i){e.id!==0&&t.tag(1,l.Varint).int32(e.id),e.code!==""&&t.tag(2,l.LengthDelimited).string(e.code),e.batchName!==""&&t.tag(3,l.LengthDelimited).string(e.batchName),e.redeemedAt&&N.internalBinaryWrite(e.redeemedAt,t.tag(4,l.LengthDelimited).fork(),i).join();for(let n=0;n<e.grants.length;n++)T.internalBinaryWrite(e.grants[n],t.tag(5,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},P=new ve,Ne=class extends k{constructor(){super("wuxiaworld.api.v2.GetGiftCodeRedemptionsRequest",[{no:1,name:"pageInfo",kind:"message",T:()=>B,options:{"wuxiaworld.api.v2.required":{value:!0}}}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.pageInfo=B.internalBinaryRead(e,e.uint32(),i,n.pageInfo);break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){e.pageInfo&&B.internalBinaryWrite(e.pageInfo,t.tag(1,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},X=new Ne,Re=class extends k{constructor(){super("wuxiaworld.api.v2.GetGiftCodeRedemptionsResponse",[{no:1,name:"items",kind:"message",repeat:2,T:()=>P},{no:2,name:"pageInfo",kind:"message",T:()=>$}])}create(e){const t=globalThis.Object.create(this.messagePrototype);return t.items=[],e!==void 0&&g(this,t,e),t}internalBinaryRead(e,t,i,a){let n=a??this.create(),c=e.pos+t;for(;e.pos<c;){let[o,d]=e.tag();switch(o){case 1:n.items.push(P.internalBinaryRead(e,e.uint32(),i));break;case 2:n.pageInfo=$.internalBinaryRead(e,e.uint32(),i,n.pageInfo);break;default:let r=i.readUnknownField;if(r==="throw")throw new globalThis.Error(`Unknown field ${o} (wire type ${d}) for ${this.typeName}`);let p=e.skip(d);r!==!1&&(r===!0?m.onRead:r)(this.typeName,n,o,d,p)}}return n}internalBinaryWrite(e,t,i){for(let n=0;n<e.items.length;n++)P.internalBinaryWrite(e.items[n],t.tag(1,l.LengthDelimited).fork(),i).join();e.pageInfo&&$.internalBinaryWrite(e.pageInfo,t.tag(2,l.LengthDelimited).fork(),i).join();let a=i.writeUnknownFields;return a!==!1&&(a==!0?m.onWrite:a)(this.typeName,e,t),t}},Te=new Re,L=new se("wuxiaworld.api.v2.GiftCodes",[{name:"PreviewGiftCode",options:{},I:V,O:ke},{name:"RedeemGiftCode",options:{},I:M,O:we},{name:"GetGiftCodeRedemptions",options:{},I:X,O:Te}]),U=class{constructor(e){this._transport=e,this.typeName=L.typeName,this.methods=L.methods,this.options=L.options}previewGiftCode(e,t){const i=this.methods[0],a=this._transport.mergeOptions(t);return D("unary",this._transport,i,a,e)}redeemGiftCode(e,t){const i=this.methods[1],a=this._transport.mergeOptions(t);return D("unary",this._transport,i,a,e)}getGiftCodeRedemptions(e,t){const i=this.methods[2],a=this._transport.mergeOptions(t);return D("unary",this._transport,i,a,e)}},Y=O(ie(),1);function H(e){if(e)return new Date(Number(e.seconds)*1e3)}var W=4;var Ge=64+Math.ceil(64/W)-1;function j(e){return e.split("").filter(t=>/[a-z0-9]/i.test(t)).join("").toUpperCase().slice(0,64)}function q(e){const t=j(e);return t.length<=W?t:(t.match(new RegExp(`.{1,${W}}`,"g"))??[]).join("-")}function Ce(e){const t=e?.response?.metadata?.giftCodeError;if(t===void 0)return null;const i=Number(t);return Number.isNaN(i)?null:i}function _(e){switch(Ce(e)){case f.GiftCodeErrorNotFound:return"That code isn't valid. Check for typos and try again.";case f.GiftCodeErrorDisabled:return"This code is no longer available.";case f.GiftCodeErrorNotYetValid:return"This code can't be redeemed yet.";case f.GiftCodeErrorExpired:return"This code has expired.";case f.GiftCodeErrorFullyRedeemed:return"This code has already been fully redeemed.";case f.GiftCodeErrorNotAssignedToUser:return"This code is reserved for another account.";case f.GiftCodeErrorUserLimitReached:return"You've already redeemed this offer.";case f.GiftCodeErrorAlreadyOwned:return"You already own everything this code unlocks.";case f.GiftCodeErrorActivePaidSubscription:return"You already have an active paid subscription. Cancel it first, then redeem this code.";case f.GiftCodeErrorRateLimited:return"Too many attempts. Please wait a few minutes and try again.";default:return e?.message||"Something went wrong. Please try again."}}function Be({item:e}){const t=e.kind==="entitlement"&&!e.value.isGrantable,i=e.kind==="grant"?H(e.value.expiresAt):void 0;return u("li",{className:`flex items-start gap-[12px] py-[12px] ${t?"text-[#999] dark:text-[#777]":"text-[#333] dark:text-[#ddd]"}
3`,children:[s("span",{"aria-hidden":!0,className:"mt-[2px] text-[16px] leading-none",children:t?"â":"â"}),u("span",{className:"flex-1",children:[s("span",{className:`block text-[15px] leading-[20px] ${t?"line-through":"font-semibold"}`,children:e.value.description}),t&&e.value.blockedReason?.value&&s("span",{className:"mt-[2px] block text-[13px] leading-[18px]",children:e.value.blockedReason.value}),i&&u("span",{className:"mt-[2px] block text-[13px] leading-[18px] text-[#666] dark:text-[#999]",children:["Expires ",(0,Y.default)(i).format("D MMMM YYYY")]})]})]})}function I({entitlements:e=[],grants:t=[]}){const i=[...t.map(a=>({kind:"grant",value:a})),...e.map(a=>({kind:"entitlement",value:a}))];return i.length===0?null:s("ul",{className:"divide-y divide-[#eee] dark:divide-[#333]",children:i.map(a=>s(Be,{item:a},`${a.kind}-${a.kind==="entitlement"?a.value.entitlementId:a.value.description}`))})}var Ie=20;function Ee({refreshKey:e}){const{user:t}=te(),{data:i}=ne(U,n=>n.getGiftCodeRedemptions,X.create({pageInfo:B.create({page:1,count:Ie})}),["gift-code-redemptions",t?.id,e],{enabled:!!t,cacheTime:0,keepPreviousData:!0}),a=i?.items??[];return a.length===0?null:u("div",{className:"mt-[40px]",children:[s("h2",{className:"text-[17px] font-semibold leading-[22px] text-[#333] dark:text-[#eee]",children:"Previously redeemed"}),s("ul",{className:"mt-[12px] flex flex-col gap-[12px]",children:a.map(n=>u("li",{className:"rounded-[8px] border border-[#eee] px-[16px] py-[12px] dark:border-[#333]",children:[u("div",{className:"flex flex-wrap items-baseline justify-between gap-[8px]",children:[s("span",{className:"text-[15px] font-semibold text-[#333] dark:text-[#ddd]",children:n.batchName}),s("span",{className:"text-[13px] text-[#999]",children:n.redeemedAt&&(0,Y.default)(H(n.redeemedAt)).format("D MMMM YYYY")})]}),s("span",{className:"font-mono mt-[2px] block text-[13px] text-[#999]",children:n.code}),s(I,{grants:n.grants})]},n.id))})]})}function De(){const{code:e}=ae(),t=re(),{grpcRequest:i}=de(),[a,n]=(0,x.useState)(()=>e?q(e):""),[c,o]=(0,x.useState)({name:"input"}),[d,r]=(0,x.useState)(null),[p,C]=(0,x.useState)(!1),[z,K]=(0,x.useState)(0),F=(0,x.useCallback)(async h=>{const b=j(h);if(!b){r("Enter a code to continue.");return}C(!0),r(null);try{const E=await i(U,J=>J.previewGiftCode,V.create({code:b}));o({name:"preview",preview:E})}catch(E){r(_(E)),o({name:"input"})}finally{C(!1)}},[i]);(0,x.useEffect)(()=>{e&&F(e)},[e]);const Q=h=>{h.preventDefault(),F(a)},Z=async()=>{C(!0),r(null);try{const h=await i(U,b=>b.redeemGiftCode,M.create({code:j(a)}));o({name:"redeemed",result:h}),K(b=>b+1)}catch(h){r(_(h))}finally{C(!1)}},A=()=>{n(""),r(null),o({name:"input"}),e&&t("/redeem",{replace:!0})};return u("div",{className:"m-auto max-w-[640px] px-[20px] pb-[60px] pt-[24px] sm:px-[30px] sm:pt-[40px]",children:[s(me,{defer:!1,children:s("title",{children:"Redeem a code"})}),s(pe,{className:"m-0 text-[21px] leading-[25px] sm:text-[32px] sm:leading-[36px]",children:"Redeem a code"}),c.name!=="redeemed"&&s("p",{className:"mt-[12px] text-[15px] leading-[22px] text-[#666] dark:text-[#999]",children:"Enter your gift code below to add it to your account."}),d&&s("div",{role:"alert",className:"mt-[20px] rounded-[6px] border border-[#f5c2c0] bg-[#fdecea] px-[16px] py-[12px] text-[14px] leading-[20px] text-[#8b1f18] dark:border-[#5c2a27] dark:bg-[#2b1614] dark:text-[#f2b8b5]",children:d}),c.name==="input"&&u("form",{onSubmit:Q,className:"mt-[24px] flex flex-col gap-[16px]",children:[s(ce,{label:"Gift code",value:a,autoComplete:"off",spellCheck:!1,placeholder:"XXXX-XXXX-XXXX",onChange:h=>n(q(h.target.value)),slotProps:{htmlInput:{maxLength:Ge}}}),s("div",{children:s(G,{type:"submit",variant:"contained",color:"secondary",disabled:p||!a,children:p?"Checkingâ¦":"Continue"})})]}),c.name==="preview"&&u("div",{className:"mt-[24px]",children:[u("div",{className:"rounded-[8px] border border-[#eee] px-[20px] py-[16px] dark:border-[#333]",children:[s("h2",{className:"text-[17px] font-semibold leading-[22px] text-[#333] dark:text-[#eee]",children:c.preview.batchName}),c.preview.description&&s("p",{className:"mt-[4px] text-[14px] leading-[20px] text-[#666] dark:text-[#999]",children:c.preview.description.value}),s("p",{className:"mt-[16px] text-[13px] font-semibold uppercase tracking-wide text-[#999]",children:"This code unlocks"}),s(I,{entitlements:c.preview.entitlements})]}),u("div",{className:"mt-[20px] flex gap-[12px]",children:[s(G,{variant:"contained",color:"secondary",disabled:p,onClick:Z,children:p?"Redeemingâ¦":"Redeem"}),s(G,{variant:"outlined",color:"secondary",disabled:p,onClick:A,children:"Use a different c
3ode"})]})]}),c.name==="redeemed"&&u("div",{className:"mt-[24px]",children:[u("div",{className:"rounded-[8px] border border-[#cfe8d4] bg-[#f2faf4] px-[20px] py-[16px] dark:border-[#2b4a33] dark:bg-[#16241a]",children:[s("h2",{className:"text-[17px] font-semibold leading-[22px] text-[#1f6b33] dark:text-[#8fd6a1]",children:"Code redeemed"}),s("p",{className:"mt-[4px] text-[14px] leading-[20px] text-[#3d7a4c] dark:text-[#7fbf90]",children:"The following has been added to your account."}),s(I,{grants:c.result.grants}),c.result.skipped.length>0&&u(le,{children:[s("p",{className:"mt-[16px] text-[13px] font-semibold uppercase tracking-wide text-[#999]",children:"Not added"}),s(I,{entitlements:c.result.skipped})]})]}),u("div",{className:"mt-[20px] flex gap-[12px]",children:[s(oe,{to:"/manage/subscriptions/karma",children:s(G,{variant:"contained",color:"secondary",children:"Go to my account"})}),s(G,{variant:"outlined",color:"secondary",onClick:A,children:"Redeem another code"})]})]}),s(Ee,{refreshKey:z})]})}var Me=ue(De);export{Me as default}; 4 5//# sourceMappingURL=redeem.v8qCYMNy.min.js.map 6//# debugId=1782cf16-c9d1-5768-8b38-0dd932a577ec
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.