stripe-pwa-elements 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/dist/cjs/factory-tenFFIul.js +1200 -0
  2. package/dist/cjs/{factory-da3xAKkz.js → i18n-FhEOc8vz.js} +6 -1131
  3. package/dist/cjs/ion-icon_2.cjs.entry.js +723 -0
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/stripe-address-element.cjs.entry.js +12 -4
  6. package/dist/cjs/stripe-card-element-modal.cjs.entry.js +3 -2
  7. package/dist/cjs/{stripe-card-element_2.cjs.entry.js → stripe-card-element.cjs.entry.js} +15 -82
  8. package/dist/cjs/stripe-currency-selector.cjs.entry.js +11 -3
  9. package/dist/cjs/stripe-elements.cjs.js +1 -1
  10. package/dist/cjs/stripe-express-checkout-element.cjs.entry.js +31 -5
  11. package/dist/cjs/stripe-link-authentication-element.cjs.entry.js +11 -3
  12. package/dist/cjs/stripe-payment-element.cjs.entry.js +106 -161
  13. package/dist/cjs/stripe-payment-element.helpers-DukP33RI.js +122 -0
  14. package/dist/cjs/stripe-payment-request-button.cjs.entry.js +23 -16
  15. package/dist/cjs/stripe-payment-sheet.cjs.entry.js +506 -0
  16. package/dist/collection/collection-manifest.json +3 -2
  17. package/dist/collection/components/stripe-address-element/stripe-address-element.js +7 -0
  18. package/dist/collection/components/stripe-card-element/stripe-card-element.js +10 -2
  19. package/dist/collection/components/stripe-card-element-modal/stripe-card-element-modal.js +4 -3
  20. package/dist/collection/components/stripe-currency-selector/stripe-currency-selector.js +7 -0
  21. package/dist/collection/components/stripe-express-checkout-element/stripe-express-checkout-element.js +25 -0
  22. package/dist/collection/components/stripe-link-authentication-element/stripe-link-authentication-element.js +7 -0
  23. package/dist/collection/components/stripe-modal/stripe-modal.css +23 -1
  24. package/dist/collection/components/stripe-modal/stripe-modal.js +147 -6
  25. package/dist/collection/components/stripe-payment-element/stripe-payment-element.js +94 -37
  26. package/dist/collection/components/stripe-payment-request-button/stripe-payment-request-button.js +17 -10
  27. package/dist/collection/components/stripe-payment-sheet/payment-sheet-state.js +179 -0
  28. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.css +68 -0
  29. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.helpers.js +90 -0
  30. package/dist/collection/components/stripe-payment-sheet/stripe-payment-sheet.js +544 -0
  31. package/dist/collection/services/express-checkout-element-manager.js +36 -2
  32. package/dist/collection/services/stripe-service.js +37 -5
  33. package/dist/collection/utils/focus.js +76 -0
  34. package/dist/collection/utils/i18n.js +6 -0
  35. package/dist/components/factory.js +1 -1
  36. package/dist/components/i18n.js +1 -0
  37. package/dist/components/stripe-address-element.js +1 -1
  38. package/dist/components/stripe-card-element-modal.js +1 -1
  39. package/dist/components/stripe-card-element2.js +1 -1
  40. package/dist/components/stripe-currency-selector.js +1 -1
  41. package/dist/components/stripe-express-checkout-element.js +1 -1
  42. package/dist/components/stripe-link-authentication-element.js +1 -1
  43. package/dist/components/stripe-modal2.js +1 -1
  44. package/dist/components/stripe-payment-element.helpers.js +1 -0
  45. package/dist/components/stripe-payment-element.js +1 -1
  46. package/dist/components/stripe-payment-request-button2.js +1 -1
  47. package/dist/components/stripe-payment-sheet.d.ts +11 -0
  48. package/dist/components/stripe-payment-sheet.js +1 -0
  49. package/dist/esm/factory-Cd6OGTWN.js +1198 -0
  50. package/dist/esm/{factory-DeqoYLf_.js → i18n-B6JoQetF.js} +7 -1131
  51. package/dist/esm/ion-icon_2.entry.js +720 -0
  52. package/dist/esm/loader.js +1 -1
  53. package/dist/esm/stripe-address-element.entry.js +9 -1
  54. package/dist/esm/stripe-card-element-modal.entry.js +3 -2
  55. package/dist/esm/{stripe-card-element_2.entry.js → stripe-card-element.entry.js} +13 -79
  56. package/dist/esm/stripe-currency-selector.entry.js +9 -1
  57. package/dist/esm/stripe-elements.js +1 -1
  58. package/dist/esm/stripe-express-checkout-element.entry.js +27 -1
  59. package/dist/esm/stripe-link-authentication-element.entry.js +9 -1
  60. package/dist/esm/stripe-payment-element.entry.js +98 -153
  61. package/dist/esm/stripe-payment-element.helpers-CipV87b8.js +117 -0
  62. package/dist/esm/stripe-payment-request-button.entry.js +18 -11
  63. package/dist/esm/stripe-payment-sheet.entry.js +504 -0
  64. package/dist/stripe-elements/{p-38e7b187.entry.js → p-4891edf0.entry.js} +1 -1
  65. package/dist/stripe-elements/p-5338bc5e.entry.js +1 -0
  66. package/dist/stripe-elements/p-6a9c8b7a.entry.js +1 -0
  67. package/dist/stripe-elements/p-7fe4a287.entry.js +1 -0
  68. package/dist/stripe-elements/p-915b86ed.entry.js +1 -0
  69. package/dist/stripe-elements/p-B6JoQetF.js +1 -0
  70. package/dist/stripe-elements/p-C7MQk9FK.js +1 -0
  71. package/dist/stripe-elements/p-DFAhQS0n.js +1 -0
  72. package/dist/stripe-elements/p-b06a254f.entry.js +1 -0
  73. package/dist/stripe-elements/p-b91c4fa7.entry.js +1 -0
  74. package/dist/stripe-elements/p-ba791c8f.entry.js +1 -0
  75. package/dist/stripe-elements/p-e7372ca7.entry.js +1 -0
  76. package/dist/stripe-elements/p-f892e375.entry.js +1 -0
  77. package/dist/stripe-elements/stripe-elements.esm.js +1 -1
  78. package/dist/types/components/stripe-address-element/stripe-address-element.d.ts +6 -0
  79. package/dist/types/components/stripe-card-element/stripe-card-element.d.ts +8 -1
  80. package/dist/types/components/stripe-card-element-modal/stripe-card-element-modal.d.ts +2 -1
  81. package/dist/types/components/stripe-currency-selector/stripe-currency-selector.d.ts +6 -0
  82. package/dist/types/components/stripe-express-checkout-element/stripe-express-checkout-element.d.ts +11 -0
  83. package/dist/types/components/stripe-link-authentication-element/stripe-link-authentication-element.d.ts +6 -0
  84. package/dist/types/components/stripe-modal/stripe-modal.d.ts +44 -0
  85. package/dist/types/components/stripe-payment-element/stripe-payment-element.d.ts +18 -0
  86. package/dist/types/components/stripe-payment-request-button/stripe-payment-request-button.d.ts +7 -2
  87. package/dist/types/components/stripe-payment-sheet/payment-sheet-state.d.ts +104 -0
  88. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.d.ts +112 -0
  89. package/dist/types/components/stripe-payment-sheet/stripe-payment-sheet.helpers.d.ts +95 -0
  90. package/dist/types/components.d.ts +169 -10
  91. package/dist/types/index.d.ts +2 -0
  92. package/dist/types/services/interfaces.d.ts +2 -0
  93. package/dist/types/services/stripe-service.d.ts +12 -3
  94. package/dist/types/utils/focus.d.ts +15 -0
  95. package/package.json +5 -3
  96. package/readme.md +46 -10
  97. package/dist/cjs/ion-icon.cjs.entry.js +0 -431
  98. package/dist/components/utils.js +0 -1
  99. package/dist/esm/ion-icon.entry.js +0 -429
  100. package/dist/stripe-elements/p--sA2m1ad.js +0 -1
  101. package/dist/stripe-elements/p-44495284.entry.js +0 -1
  102. package/dist/stripe-elements/p-4ba675fa.entry.js +0 -1
  103. package/dist/stripe-elements/p-5cf62945.entry.js +0 -1
  104. package/dist/stripe-elements/p-c24ae181.entry.js +0 -1
  105. package/dist/stripe-elements/p-d9e86451.entry.js +0 -1
  106. package/dist/stripe-elements/p-f09c86a0.entry.js +0 -1
  107. package/dist/stripe-elements/p-f64f394d.entry.js +0 -1
  108. package/dist/stripe-elements/p-f6d2425e.entry.js +0 -1
@@ -0,0 +1 @@
1
+ const t=t=>Object.keys(c).filter((i=>c[i](t))),i=t=>!!a(t,/iPad/i)||!(!a(t,/Macintosh/i)||!s(t)),e=t=>a(t,/android|sink/i),s=t=>h(t,"(any-pointer:coarse)"),n=t=>o(t)||r(t),o=t=>!!(t.cordova||t.phonegap||t.PhoneGap),r=t=>{const i=t.Capacitor;return!(!i||!i.isNative)},a=(t,i)=>i.test(t.navigator.userAgent),h=(t,i)=>t.matchMedia(i).matches,c={ipad:i,iphone:t=>a(t,/iPhone/i),ios:t=>a(t,/iPhone|iPod/i)||i(t),android:e,phablet:t=>{const i=t.innerWidth,e=t.innerHeight,s=Math.min(i,e),n=Math.max(i,e);return s>390&&s<520&&n>620&&n<800},tablet:t=>{const s=t.innerWidth,n=t.innerHeight,o=Math.min(s,n),r=Math.max(s,n);return i(t)||(t=>e(t)&&!a(t,/mobile/i))(t)||o>460&&o<820&&r>780&&r<1400},cordova:o,capacitor:r,electron:t=>a(t,/electron/i),pwa:t=>!(!t.matchMedia("(display-mode: standalone)").matches&&!t.navigator.standalone),mobile:s,mobileweb:t=>s(t)&&!n(t),desktop:t=>!s(t),hybrid:n},l=()=>{const i=((i=window)=>{if(void 0===i)return[];i.Ionic=i.Ionic||{};let e=i.Ionic.platforms;return null==e&&(e=i.Ionic.platforms=t(i),e.forEach((t=>i.document.documentElement.classList.add(`plt-${t}`)))),e})(undefined);return i.includes("ios")?"ios":i.includes("android")?"android":void 0},u=t=>"string"==typeof t,d=()=>{let t,i;const e=new Promise(((e,s)=>{t=e,i=s}));return e.resolve=t,e.reject=i,e},f=t=>null==t?"":""+t,p=/###/g,g=t=>t&&t.indexOf("###")>-1?t.replace(p,"."):t,y=t=>!t||u(t),m=(t,i,e)=>{const s=u(i)?i.split("."):i;let n=0;for(;n<s.length-1;){if(y(t))return{};const i=g(s[n]);!t[i]&&e&&(t[i]=new e),t=Object.prototype.hasOwnProperty.call(t,i)?t[i]:{},++n}return y(t)?{}:{obj:t,k:g(s[n])}},v=(t,i,e)=>{const{obj:s,k:n}=m(t,i,Object);if(void 0!==s||1===i.length)return void(s[n]=e);let o=i[i.length-1],r=i.slice(0,i.length-1),a=m(t,r,Object);for(;void 0===a.obj&&r.length;)o=`${r[r.length-1]}.${o}`,r=r.slice(0,r.length-1),a=m(t,r,Object),a?.obj&&void 0!==a.obj[`${a.k}.${o}`]&&(a.obj=void 0);a.obj[`${a.k}.${o}`]=e},w=(t,i)=>{const{obj:e,k:s}=m(t,i);if(e&&Object.prototype.hasOwnProperty.call(e,s))return e[s]},b=(t,i,e)=>{for(const s in i)"__proto__"!==s&&"constructor"!==s&&(s in t?u(t[s])||t[s]instanceof String||u(i[s])||i[s]instanceof String?e&&(t[s]=i[s]):b(t[s],i[s],e):t[s]=i[s]);return t},$=t=>t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var x={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const k=t=>u(t)?t.replace(/[&<>"'\/]/g,(t=>x[t])):t,S=[" ",",","?","!",";"],j=new class{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const i=this.regExpMap.get(t);if(void 0!==i)return i;const e=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,e),this.regExpQueue.push(t),e}}(20),O=(t,i,e=".")=>{if(!t)return;if(t[i]){if(!Object.prototype.hasOwnProperty.call(t,i))return;return t[i]}const s=i.split(e);let n=t;for(let t=0;t<s.length;){if(!n||"object"!=typeof n)return;let i,o="";for(let r=t;r<s.length;++r)if(r!==t&&(o+=e),o+=s[r],i=n[o],void 0!==i){if(["string","number","boolean"].indexOf(typeof i)>-1&&r<s.length-1)continue;t+=r-t+1;break}n=i}return n},L=t=>t?.replace(/_/g,"-"),N={type:"logger",log(t){this.output("log",t)},warn(t){this.output("warn",t)},error(t){this.output("error",t)},output(t,i){console?.[t]?.apply?.(console,i)}};class C{constructor(t,i={}){this.init(t,i)}init(t,i={}){this.prefix=i.prefix||"i18next:",this.logger=t||N,this.options=i,this.debug=i.debug}log(...t){return this.forward(t,"log","",!0)}warn(...t){return this.forward(t,"warn","",!0)}error(...t){return this.forward(t,"error","")}deprecate(...t){return this.forward(t,"warn","WARNING DEPRECATED: ",!0)}forward(t,i,e,s){return s&&!this.debug?null:(u(t[0])&&(t[0]=`${e}${this.prefix} ${t[0]}`),this.logger[i](t))}create(t){return new C(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return(t=t||this.options).prefix=t.prefix||this.prefix,new C(this.logger,t)}}var P=new C;class A{constructor(){this.observers={}}on(t,i){return t.split(" ").forEach((t=>{this.observers[t]||(this.observers[t]=new Map);const e=this.observers[t].get(i)||0;this.observers[t].set(i,e+1)})),this}off(t,i){this.observers[t]&&(i?this.observers[t].delete(i):delete this.observers[t])}emit(t,...i){this.observers[t]&&Array.from(this.observers[t].entries()).forEach((([t,e])=>{for(let s=0;s<e;s++)t(...i)})),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach((([e,s])=>{for(let n=0;n<s;n++)e.apply(e,[t,...i])}))}}class R extends A{constructor(t,i={ns:["translation"],defaultNS:"translation"}){super(),this.data=t||{},this.options=i,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const i=this.options.ns.indexOf(t);i>-1&&this.options.ns.splice(i,1)}getResource(t,i,e,s={}){const n=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,o=void 0!==s.ignoreJSONStructure?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let r;t.indexOf(".")>-1?r=t.split("."):(r=[t,i],e&&(Array.isArray(e)?r.push(...e):u(e)&&n?r.push(...e.split(n)):r.push(e)));const a=w(this.data,r);return!a&&!i&&!e&&t.indexOf(".")>-1&&(t=r[0],i=r[1],e=r.slice(2).join(".")),!a&&o&&u(e)?O(this.data?.[t]?.[i],e,n):a}addResource(t,i,e,s,n={silent:!1}){const o=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator;let r=[t,i];e&&(r=r.concat(o?e.split(o):e)),t.indexOf(".")>-1&&(r=t.split("."),s=i,i=r[1]),this.addNamespaces(i),v(this.data,r,s),n.silent||this.emit("added",t,i,e,s)}addResources(t,i,e,s={silent:!1}){for(const s in e)(u(e[s])||Array.isArray(e[s]))&&this.addResource(t,i,s,e[s],{silent:!0});s.silent||this.emit("added",t,i,e)}addResourceBundle(t,i,e,s,n,o={silent:!1,skipCopy:!1}){let r=[t,i];t.indexOf(".")>-1&&(r=t.split("."),s=e,e=i,i=r[1]),this.addNamespaces(i);let a=w(this.data,r)||{};o.skipCopy||(e=JSON.parse(JSON.stringify(e))),s?b(a,e,n):a={...a,...e},v(this.data,r,a),o.silent||this.emit("added",t,i,e)}removeResourceBundle(t,i){this.hasResourceBundle(t,i)&&delete this.data[t][i],this.removeNamespaces(i),this.emit("removed",t,i)}hasResourceBundle(t,i){return void 0!==this.getResource(t,i)}getResourceBundle(t,i){return i||(i=this.options.defaultNS),this.getResource(t,i)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const i=this.getDataByLanguage(t);return!!(i&&Object.keys(i)||[]).find((t=>i[t]&&Object.keys(i[t]).length>0))}toJSON(){return this.data}}var I={processors:{},addPostProcessor(t){this.processors[t.name]=t},handle(t,i,e,s,n){return t.forEach((t=>{i=this.processors[t]?.process(i,e,s,n)??i})),i}};const E=Symbol("i18next/PATH_KEY");function T(t,i){const{[E]:e}=t(function(){const t=[],i=Object.create(null);let e;return i.get=(s,n)=>(e?.revoke?.(),n===E?t:(t.push(n),e=Proxy.revocable(s,i),e.proxy)),Proxy.revocable(Object.create(null),i).proxy}()),s=i?.keySeparator??".",n=i?.nsSeparator??":";if(e.length>1&&n){const t=i?.ns,o=Array.isArray(t)?t:null;if(o&&o.length>1&&o.slice(1).includes(e[0]))return`${e[0]}${n}${e.slice(1).join(s)}`}return e.join(s)}const M={},z=t=>!u(t)&&"boolean"!=typeof t&&"number"!=typeof t;class F extends A{constructor(t,i={}){var e,s;super(),e=t,s=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach((t=>{e[t]&&(s[t]=e[t])})),this.options=i,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=P.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t,i={interpolation:{}}){const e={...i};if(null==t)return!1;const s=this.resolve(t,e);if(void 0===s?.res)return!1;const n=z(s.res);return!1!==e.returnObjects||!n}extractFromKey(t,i){let e=void 0!==i.nsSeparator?i.nsSeparator:this.options.nsSeparator;void 0===e&&(e=":");const s=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let n=i.ns||this.options.defaultNS||[];const o=e&&t.indexOf(e)>-1,r=!(this.options.userDefinedKeySeparator||i.keySeparator||this.options.userDefinedNsSeparator||i.nsSeparator||((t,i,e)=>{i=i||"",e=e||"";const s=S.filter((t=>i.indexOf(t)<0&&e.indexOf(t)<0));if(0===s.length)return!0;const n=j.getRegExp(`(${s.map((t=>"?"===t?"\\?":t)).join("|")})`);let o=!n.test(t);if(!o){const i=t.indexOf(e);i>0&&!n.test(t.substring(0,i))&&(o=!0)}return o})(t,e,s));if(o&&!r){const i=t.match(this.interpolator.nestingRegexp);if(i&&i.length>0)return{key:t,namespaces:u(n)?[n]:n};const o=t.split(e);(e!==s||e===s&&this.options.ns.indexOf(o[0])>-1)&&(n=o.shift()),t=o.join(s)}return{key:t,namespaces:u(n)?[n]:n}}translate(t,i,e){let s="object"==typeof i?{...i}:i;if("object"!=typeof s&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof s&&(s={...s}),s||(s={}),null==t)return"";"function"==typeof t&&(t=T(t,{...this.options,...s})),Array.isArray(t)||(t=[String(t)]),t=t.map((t=>"function"==typeof t?T(t,{...this.options,...s}):String(t)));const n=void 0!==s.returnDetails?s.returnDetails:this.options.returnDetails,o=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator,{key:r,namespaces:a}=this.extractFromKey(t[t.length-1],s),h=a[a.length-1];let c=void 0!==s.nsSeparator?s.nsSeparator:this.options.nsSeparator;void 0===c&&(c=":");const l=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===l?.toLowerCase())return d?n?{res:`${h}${c}${r}`,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:h,usedParams:this.getUsedParamsDetails(s)}:`${h}${c}${r}`:n?{res:r,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:h,usedParams:this.getUsedParamsDetails(s)}:r;const f=this.resolve(t,s);let p=f?.res;const g=f?.usedKey||r,y=f?.exactUsedKey||r,m=void 0!==s.joinArrays?s.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=void 0!==s.count&&!u(s.count),b=F.hasDefaultValue(s),$=w?this.pluralResolver.getSuffix(l,s.count,s):"",x=s.ordinal&&w?this.pluralResolver.getSuffix(l,s.count,{ordinal:!1}):"",k=w&&!s.ordinal&&0===s.count,S=k&&s[`defaultValue${this.options.pluralSeparator}zero`]||s[`defaultValue${$}`]||s[`defaultValue${x}`]||s.defaultValue;let j=p;v&&!p&&b&&(j=S);const O=z(j),L=Object.prototype.toString.apply(j);if(!(v&&j&&O&&["[object Number]","[object Function]","[object RegExp]"].indexOf(L)<0)||u(m)&&Array.isArray(j))if(v&&u(m)&&Array.isArray(p))p=p.join(m),p&&(p=this.extendTranslation(p,t,s,e));else{let i=!1,n=!1;!this.isValidLookup(p)&&b&&(i=!0,p=S),this.isValidLookup(p)||(n=!0,p=r);const a=(s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:p,u=b&&S!==p&&this.options.updateMissing;if(n||i||u){if(this.logger.log(u?"updateKey":"missingKey",l,h,r,u?S:p),o){const t=this.resolve(r,{...s,keySeparator:!1});t&&t.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let t=[];const i=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if("fallback"===this.options.saveMissingTo&&i&&i[0])for(let e=0;e<i.length;e++)t.push(i[e]);else"all"===this.options.saveMissingTo?t=this.languageUtils.toResolveHierarchy(s.lng||this.language):t.push(s.lng||this.language);const e=(t,i,e)=>{const n=b&&e!==p?e:a;this.options.missingKeyHandler?this.options.missingKeyHandler(t,h,i,n,u,s):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(t,h,i,n,u,s),this.emit("missingKey",t,h,i,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&w?t.forEach((t=>{const i=this.pluralResolver.getSuffixes(t,s);k&&s[`defaultValue${this.options.pluralSeparator}zero`]&&i.indexOf(`${this.options.pluralSeparator}zero`)<0&&i.push(`${this.options.pluralSeparator}zero`),i.forEach((i=>{e([t],r+i,s[`defaultValue${i}`]||S)}))})):e(t,r,S))}p=this.extendTranslation(p,t,s,f,e),n&&p===r&&this.options.appendNamespaceToMissingKey&&(p=`${h}${c}${r}`),(n||i)&&this.options.parseMissingKeyHandler&&(p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${h}${c}${r}`:r,i?p:void 0,s))}else{if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const t=this.options.returnedObjectHandler?this.options.returnedObjectHandler(g,j,{...s,ns:a}):`key '${r} (${this.language})' returned an object instead of string.`;return n?(f.res=t,f.usedParams=this.getUsedParamsDetails(s),f):t}if(o){const t=Array.isArray(j),i=t?[]:{},e=t?y:g;for(const t in j)if(Object.prototype.hasOwnProperty.call(j,t)){const n=`${e}${o}${t}`;i[t]=this.translate(n,b&&!p?{...s,defaultValue:z(S)?S[t]:void 0,joinArrays:!1,ns:a}:{...s,joinArrays:!1,ns:a}),i[t]===n&&(i[t]=j[t])}p=i}}return n?(f.res=p,f.usedParams=this.getUsedParamsDetails(s),f):p}extendTranslation(t,i,e,s,n){if(this.i18nFormat?.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...e},e.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!e.skipInterpolation){e.interpolation&&this.interpolator.init({...e,interpolation:{...this.options.interpolation,...e.interpolation}});const o=u(t)&&(void 0!==e?.interpolation?.skipOnVariables?e.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let r;if(o){const i=t.match(this.interpolator.nestingRegexp);r=i&&i.length}let a=e.replace&&!u(e.replace)?e.replace:e;if(this.options.interpolation.defaultVariables&&(a={...this.options.interpolation.defaultVariables,...a}),t=this.interpolator.interpolate(t,a,e.lng||this.language||s.usedLng,e),o){const i=t.match(this.interpolator.nestingRegexp);r<(i&&i.length)&&(e.nest=!1)}!e.lng&&s&&s.res&&(e.lng=this.language||s.usedLng),!1!==e.nest&&(t=this.interpolator.nest(t,((...t)=>n?.[0]!==t[0]||e.context?this.translate(...t,i):(this.logger.warn(`It seems you are nesting recursively key: ${t[0]} in key: ${i[0]}`),null)),e)),e.interpolation&&this.interpolator.reset()}const o=e.postProcess||this.options.postProcess,r=u(o)?[o]:o;return null!=t&&r?.length&&!1!==e.applyPostProcessor&&(t=I.handle(r,t,i,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(e)},...e}:e,this)),t}resolve(t,i={}){let e,s,n,o,r;return u(t)&&(t=[t]),Array.isArray(t)&&(t=t.map((t=>"function"==typeof t?T(t,{...this.options,...i}):t))),t.forEach((t=>{if(this.isValidLookup(e))return;const a=this.extractFromKey(t,i),h=a.key;s=h;let c=a.namespaces;this.options.fallbackNS&&(c=c.concat(this.options.fallbackNS));const l=void 0!==i.count&&!u(i.count),d=l&&!i.ordinal&&0===i.count,f=void 0!==i.context&&(u(i.context)||"number"==typeof i.context)&&""!==i.context,p=i.lngs?i.lngs:this.languageUtils.toResolveHierarchy(i.lng||this.language,i.fallbackLng);c.forEach((t=>{this.isValidLookup(e)||(r=t,M[`${p[0]}-${t}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(r)||(M[`${p[0]}-${t}`]=!0,this.logger.warn(`key "${s}" for languages "${p.join(", ")}" won't get resolved as namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((s=>{if(this.isValidLookup(e))return;o=s;const r=[h];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(r,h,s,t,i);else{let t;l&&(t=this.pluralResolver.getSuffix(s,i.count,i));const e=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(l&&(i.ordinal&&0===t.indexOf(n)&&r.push(h+t.replace(n,this.options.pluralSeparator)),r.push(h+t),d&&r.push(h+e)),f){const s=`${h}${this.options.contextSeparator||"_"}${i.context}`;r.push(s),l&&(i.ordinal&&0===t.indexOf(n)&&r.push(s+t.replace(n,this.options.pluralSeparator)),r.push(s+t),d&&r.push(s+e))}}let a;for(;a=r.pop();)this.isValidLookup(e)||(n=a,e=this.getResource(s,t,a,i))})))}))})),{res:e,usedKey:s,exactUsedKey:n,usedLng:o,usedNS:r}}isValidLookup(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)}getResource(t,i,e,s={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(t,i,e,s):this.resourceStore.getResource(t,i,e,s)}getUsedParamsDetails(t={}){const i=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],e=t.replace&&!u(t.replace);let s=e?t.replace:t;if(e&&void 0!==t.count&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!e){s={...s};for(const t of i)delete s[t]}return s}static hasDefaultValue(t){for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)&&"defaultValue"===i.substring(0,12)&&void 0!==t[i])return!0;return!1}}class V{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=P.create("languageUtils")}getScriptPartFromCode(t){if(!(t=L(t))||t.indexOf("-")<0)return null;const i=t.split("-");return 2===i.length?null:(i.pop(),"x"===i[i.length-1].toLowerCase()?null:this.formatLanguageCode(i.join("-")))}getLanguagePartFromCode(t){if(!(t=L(t))||t.indexOf("-")<0)return t;const i=t.split("-");return this.formatLanguageCode(i[0])}formatLanguageCode(t){if(u(t)&&t.indexOf("-")>-1){let i;try{i=Intl.getCanonicalLocales(t)[0]}catch(t){}return i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i||(this.options.lowerCaseLng?t.toLowerCase():t)}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let i;return t.forEach((t=>{if(i)return;const e=this.formatLanguageCode(t);this.options.supportedLngs&&!this.isSupportedCode(e)||(i=e)})),!i&&this.options.supportedLngs&&t.forEach((t=>{if(i)return;const e=this.getScriptPartFromCode(t);if(this.isSupportedCode(e))return i=e;const s=this.getLanguagePartFromCode(t);if(this.isSupportedCode(s))return i=s;i=this.options.supportedLngs.find((t=>t===s?t:t.indexOf("-")<0&&s.indexOf("-")<0?void 0:t.indexOf("-")>0&&s.indexOf("-")<0&&t.substring(0,t.indexOf("-"))===s||0===t.indexOf(s)&&s.length>1?t:void 0))})),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}getFallbackCodes(t,i){if(!t)return[];if("function"==typeof t&&(t=t(i)),u(t)&&(t=[t]),Array.isArray(t))return t;if(!i)return t.default||[];let e=t[i];return e||(e=t[this.getScriptPartFromCode(i)]),e||(e=t[this.formatLanguageCode(i)]),e||(e=t[this.getLanguagePartFromCode(i)]),e||(e=t.default),e||[]}toResolveHierarchy(t,i){const e=this.getFallbackCodes((!1===i?[]:i)||this.options.fallbackLng||[],t),s=[],n=t=>{t&&(this.isSupportedCode(t)?s.push(t):this.logger.warn(`rejecting language code not found in supportedLngs: ${t}`))};return u(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?("languageOnly"!==this.options.load&&n(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&n(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&n(this.getLanguagePartFromCode(t))):u(t)&&n(this.formatLanguageCode(t)),e.forEach((t=>{s.indexOf(t)<0&&n(this.formatLanguageCode(t))})),s}}const D={zero:0,one:1,two:2,few:3,many:4,other:5},B={select:t=>1===t?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class K{constructor(t,i={}){this.languageUtils=t,this.options=i,this.logger=P.create("pluralResolver"),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(t,i={}){const e=L("dev"===t?"en":t),s=i.ordinal?"ordinal":"cardinal",n=JSON.stringify({cleanedCode:e,type:s});if(n in this.pluralRulesCache)return this.pluralRulesCache[n];let o;try{o=new Intl.PluralRules(e,{type:s})}catch(e){if("undefined"==typeof Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),B;if(!t.match(/-|_/))return B;const s=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(s,i)}return this.pluralRulesCache[n]=o,o}needsPlural(t,i={}){let e=this.getRule(t,i);return e||(e=this.getRule("dev",i)),e?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(t,i,e={}){return this.getSuffixes(t,e).map((t=>`${i}${t}`))}getSuffixes(t,i={}){let e=this.getRule(t,i);return e||(e=this.getRule("dev",i)),e?e.resolvedOptions().pluralCategories.sort(((t,i)=>D[t]-D[i])).map((t=>`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${t}`)):[]}getSuffix(t,i,e={}){const s=this.getRule(t,e);return s?`${this.options.prepend}${e.ordinal?`ordinal${this.options.prepend}`:""}${s.select(i)}`:(this.logger.warn(`no plural rule found for: ${t}`),this.getSuffix("dev",i,e))}}const _=(t,i,e,s=".",n=!0)=>{let o=((t,i,e)=>{const s=w(t,e);return void 0!==s?s:w(i,e)})(t,i,e);return!o&&n&&u(e)&&(o=O(t,e,s),void 0===o&&(o=O(i,e,s))),o},U=t=>t.replace(/\$/g,"$$$$");class H{constructor(t={}){this.logger=P.create("interpolator"),this.options=t,this.format=t?.interpolation?.format||(t=>t),this.init(t)}init(t={}){t.interpolation||(t.interpolation={escapeValue:!0});const{escape:i,escapeValue:e,useRawValueToEscape:s,prefix:n,prefixEscaped:o,suffix:r,suffixEscaped:a,formatSeparator:h,unescapeSuffix:c,unescapePrefix:l,nestingPrefix:u,nestingPrefixEscaped:d,nestingSuffix:f,nestingSuffixEscaped:p,nestingOptionsSeparator:g,maxReplaces:y,alwaysFormat:m}=t.interpolation;this.escape=void 0!==i?i:k,this.escapeValue=void 0===e||e,this.useRawValueToEscape=void 0!==s&&s,this.prefix=n?$(n):o||"{{",this.suffix=r?$(r):a||"}}",this.formatSeparator=h||",",this.unescapePrefix=c?"":l||"-",this.unescapeSuffix=this.unescapePrefix?"":c||"",this.nestingPrefix=u?$(u):d||$("$t("),this.nestingSuffix=f?$(f):p||$(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=y||1e3,this.alwaysFormat=void 0!==m&&m,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(t,i)=>t?.source===i?(t.lastIndex=0,t):new RegExp(i,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(t,i,e,s){let n,o,r;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},h=t=>{if(t.indexOf(this.formatSeparator)<0){const n=_(i,a,t,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(n,void 0,e,{...s,...i,interpolationkey:t}):n}const n=t.split(this.formatSeparator),o=n.shift().trim(),r=n.join(this.formatSeparator).trim();return this.format(_(i,a,o,this.options.keySeparator,this.options.ignoreJSONStructure),r,e,{...s,...i,interpolationkey:o})};this.resetRegExp();const c=s?.missingInterpolationHandler||this.options.missingInterpolationHandler,l=void 0!==s?.interpolation?.skipOnVariables?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:t=>U(t)},{regex:this.regexp,safeValue:t=>U(this.escapeValue?this.escape(t):t)}].forEach((i=>{for(r=0;n=i.regex.exec(t);){const e=n[1].trim();if(o=h(e),void 0===o)if("function"==typeof c){const i=c(t,n,s);o=u(i)?i:""}else if(s&&Object.prototype.hasOwnProperty.call(s,e))o="";else{if(l){o=n[0];continue}this.logger.warn(`missed to pass in variable ${e} for interpolating ${t}`),o=""}else u(o)||this.useRawValueToEscape||(o=f(o));const a=i.safeValue(o);if(t=t.replace(n[0],a),l?(i.regex.lastIndex+=o.length,i.regex.lastIndex-=n[0].length):i.regex.lastIndex=0,r++,r>=this.maxReplaces)break}})),t}nest(t,i,e={}){let s,n,o;const r=(t,i)=>{const e=this.nestingOptionsSeparator;if(t.indexOf(e)<0)return t;const s=t.split(new RegExp(`${$(e)}[ ]*{`));let n=`{${s[1]}`;t=s[0],n=this.interpolate(n,o);const r=n.match(/'/g),a=n.match(/"/g);((r?.length??0)%2==0&&!a||(a?.length??0)%2!=0)&&(n=n.replace(/'/g,'"'));try{o=JSON.parse(n),i&&(o={...i,...o})}catch(i){return this.logger.warn(`failed parsing options string in nesting for key ${t}`,i),`${t}${e}${n}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,t};for(;s=this.nestingRegexp.exec(t);){let a=[];o={...e},o=o.replace&&!u(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;const h=/{.*}/.test(s[1])?s[1].lastIndexOf("}")+1:s[1].indexOf(this.formatSeparator);if(-1!==h&&(a=s[1].slice(h).split(this.formatSeparator).map((t=>t.trim())).filter(Boolean),s[1]=s[1].slice(0,h)),n=i(r.call(this,s[1].trim(),o),o),n&&s[0]===t&&!u(n))return n;u(n)||(n=f(n)),n||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),n=""),a.length&&(n=a.reduce(((t,i)=>this.format(t,i,e.lng,{...e,interpolationkey:s[1].trim()})),n.trim())),t=t.replace(s[0],n),this.regexp.lastIndex=0}return t}}const Y=t=>{const i={};return(e,s,n)=>{let o=n;n&&n.interpolationkey&&n.formatParams&&n.formatParams[n.interpolationkey]&&n[n.interpolationkey]&&(o={...o,[n.interpolationkey]:void 0});const r=s+JSON.stringify(o);let a=i[r];return a||(a=t(L(s),n),i[r]=a),a(e)}},J=t=>(i,e,s)=>t(L(e),s)(i);class q{constructor(t={}){this.logger=P.create("formatter"),this.options=t,this.init(t)}init(t,i={interpolation:{}}){this.formatSeparator=i.interpolation.formatSeparator||",";const e=i.cacheInBuiltFormats?Y:J;this.formats={number:e(((t,i)=>{const e=new Intl.NumberFormat(t,{...i});return t=>e.format(t)})),currency:e(((t,i)=>{const e=new Intl.NumberFormat(t,{...i,style:"currency"});return t=>e.format(t)})),datetime:e(((t,i)=>{const e=new Intl.DateTimeFormat(t,{...i});return t=>e.format(t)})),relativetime:e(((t,i)=>{const e=new Intl.RelativeTimeFormat(t,{...i});return t=>e.format(t,i.range||"day")})),list:e(((t,i)=>{const e=new Intl.ListFormat(t,{...i});return t=>e.format(t)}))}}add(t,i){this.formats[t.toLowerCase().trim()]=i}addCached(t,i){this.formats[t.toLowerCase().trim()]=Y(i)}format(t,i,e,s={}){const n=i.split(this.formatSeparator);if(n.length>1&&n[0].indexOf("(")>1&&n[0].indexOf(")")<0&&n.find((t=>t.indexOf(")")>-1))){const t=n.findIndex((t=>t.indexOf(")")>-1));n[0]=[n[0],...n.splice(1,t)].join(this.formatSeparator)}return n.reduce(((t,i)=>{const{formatName:n,formatOptions:o}=(t=>{let i=t.toLowerCase().trim();const e={};if(t.indexOf("(")>-1){const s=t.split("(");i=s[0].toLowerCase().trim();const n=s[1].substring(0,s[1].length-1);"currency"===i&&n.indexOf(":")<0?e.currency||(e.currency=n.trim()):"relativetime"===i&&n.indexOf(":")<0?e.range||(e.range=n.trim()):n.split(";").forEach((t=>{if(t){const[i,...s]=t.split(":"),n=s.join(":").trim().replace(/^'+|'+$/g,""),o=i.trim();e[o]||(e[o]=n),"false"===n&&(e[o]=!1),"true"===n&&(e[o]=!0),isNaN(n)||(e[o]=parseInt(n,10))}}))}return{formatName:i,formatOptions:e}})(i);if(this.formats[n]){let i=t;try{const r=s?.formatParams?.[s.interpolationkey]||{};i=this.formats[n](t,r.locale||r.lng||s.locale||s.lng||e,{...o,...s,...r})}catch(t){this.logger.warn(t)}return i}return this.logger.warn(`there was no format function for ${n}`),t}),t)}}class W extends A{constructor(t,i,e,s={}){super(),this.backend=t,this.store=i,this.services=e,this.languageUtils=e.languageUtils,this.options=s,this.logger=P.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(e,s.backend,s)}queueLoad(t,i,e,s){const n={},o={},r={},a={};return t.forEach((t=>{let s=!0;i.forEach((i=>{const r=`${t}|${i}`;!e.reload&&this.store.hasResourceBundle(t,i)?this.state[r]=2:this.state[r]<0||(1===this.state[r]?void 0===o[r]&&(o[r]=!0):(this.state[r]=1,s=!1,void 0===o[r]&&(o[r]=!0),void 0===n[r]&&(n[r]=!0),void 0===a[i]&&(a[i]=!0)))})),s||(r[t]=!0)})),(Object.keys(n).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(n),pending:Object.keys(o),toLoadLanguages:Object.keys(r),toLoadNamespaces:Object.keys(a)}}loaded(t,i,e){const s=t.split("|"),n=s[0],o=s[1];i&&this.emit("failedLoading",n,o,i),!i&&e&&this.store.addResourceBundle(n,o,e,void 0,void 0,{skipCopy:!0}),this.state[t]=i?-1:2,i&&e&&(this.state[t]=0);const r={};this.queue.forEach((e=>{((t,i,e)=>{const{obj:s,k:n}=m(t,i,Object);s[n]=s[n]||[],s[n].push(e)})(e.loaded,[n],o),((t,i)=>{void 0!==t.pending[i]&&(delete t.pending[i],t.pendingCount--)})(e,t),i&&e.errors.push(i),0!==e.pendingCount||e.done||(Object.keys(e.loaded).forEach((t=>{r[t]||(r[t]={});const i=e.loaded[t];i.length&&i.forEach((i=>{void 0===r[t][i]&&(r[t][i]=!0)}))})),e.done=!0,e.errors.length?e.callback(e.errors):e.callback())})),this.emit("loaded",r),this.queue=this.queue.filter((t=>!t.done))}read(t,i,e,s=0,n=this.retryTimeout,o){if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:t,ns:i,fcName:e,tried:s,wait:n,callback:o});this.readingCalls++;const r=(r,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const t=this.waitingReads.shift();this.read(t.lng,t.ns,t.fcName,t.tried,t.wait,t.callback)}r&&a&&s<this.maxRetries?setTimeout((()=>{this.read.call(this,t,i,e,s+1,2*n,o)}),n):o(r,a)},a=this.backend[e].bind(this.backend);if(2!==a.length)return a(t,i,r);try{const e=a(t,i);e&&"function"==typeof e.then?e.then((t=>r(null,t))).catch(r):r(null,e)}catch(t){r(t)}}prepareLoading(t,i,e={},s){if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();u(t)&&(t=this.languageUtils.toResolveHierarchy(t)),u(i)&&(i=[i]);const n=this.queueLoad(t,i,e,s);if(!n.toLoad.length)return n.pending.length||s(),null;n.toLoad.forEach((t=>{this.loadOne(t)}))}load(t,i,e){this.prepareLoading(t,i,{},e)}reload(t,i,e){this.prepareLoading(t,i,{reload:!0},e)}loadOne(t,i=""){const e=t.split("|"),s=e[0],n=e[1];this.read(s,n,"read",void 0,void 0,((e,o)=>{e&&this.logger.warn(`${i}loading namespace ${n} for language ${s} failed`,e),!e&&o&&this.logger.log(`${i}loaded namespace ${n} for language ${s}`,o),this.loaded(t,e,o)}))}saveMissing(t,i,e,s,n,o={},r=()=>{}){if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(i)){if(null!=e&&""!==e){if(this.backend?.create){const a={...o,isUpdate:n},h=this.backend.create.bind(this.backend);if(h.length<6)try{let n;n=5===h.length?h(t,i,e,s,a):h(t,i,e,s),n&&"function"==typeof n.then?n.then((t=>r(null,t))).catch(r):r(null,n)}catch(t){r(t)}else h(t,i,e,s,r,a)}t&&t[0]&&this.store.addResource(t[0],i,e,s)}}else this.logger.warn(`did not save key "${e}" as the namespace "${i}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const G=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:t=>{let i={};if("object"==typeof t[1]&&(i=t[1]),u(t[1])&&(i.defaultValue=t[1]),u(t[2])&&(i.tDescription=t[2]),"object"==typeof t[2]||"object"==typeof t[3]){const e=t[3]||t[2];Object.keys(e).forEach((t=>{i[t]=e[t]}))}return i},interpolation:{escapeValue:!0,format:t=>t,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),Q=t=>(u(t.ns)&&(t.ns=[t.ns]),u(t.fallbackLng)&&(t.fallbackLng=[t.fallbackLng]),u(t.fallbackNS)&&(t.fallbackNS=[t.fallbackNS]),t.supportedLngs?.indexOf?.("cimode")<0&&(t.supportedLngs=t.supportedLngs.concat(["cimode"])),"boolean"==typeof t.initImmediate&&(t.initAsync=t.initImmediate),t),Z=()=>{},X="__i18next_supportNoticeShown";class tt extends A{constructor(t={},i){var e;if(super(),this.options=Q(t),this.services={},this.logger=P,this.modules={external:[]},e=this,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t=>{"function"==typeof e[t]&&(e[t]=e[t].bind(e))})),i&&!this.isInitialized&&!t.isClone){if(!this.options.initAsync)return this.init(t,i),this;setTimeout((()=>{this.init(t,i)}),0)}}init(t={},i){this.isInitializing=!0,"function"==typeof t&&(i=t,t={}),null==t.defaultNS&&t.ns&&(u(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const e=G();var s;this.options={...e,...this.options,...Q(t)},this.options.interpolation={...e.interpolation,...this.options.interpolation},void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator),"function"!=typeof this.options.overloadTranslationOptionHandler&&(this.options.overloadTranslationOptionHandler=e.overloadTranslationOptionHandler),!1===this.options.showSupportNotice||(s=this,s?.modules?.backend?.name?.indexOf("Locize")>0||s?.modules?.backend?.constructor?.name?.indexOf("Locize")>0||s?.options?.backend?.backends&&s.options.backend.backends.some((t=>t?.name?.indexOf("Locize")>0||t?.constructor?.name?.indexOf("Locize")>0))||s?.options?.backend?.projectId||s?.options?.backend?.backendOptions&&s.options.backend.backendOptions.some((t=>t?.projectId)))||"undefined"!=typeof globalThis&&globalThis[X]||"undefined"!=typeof process&&process.env&&process.env.I18NEXT_NO_SUPPORT_NOTICE||"undefined"!=typeof process&&process.env||("undefined"!=typeof console&&void 0!==console.info&&console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"),"undefined"!=typeof globalThis&&(globalThis[X]=!0));const n=t=>t?"function"==typeof t?new t:t:null;if(!this.options.isClone){let t;P.init(this.modules.logger?n(this.modules.logger):null,this.options),t=this.modules.formatter?this.modules.formatter:q;const i=new V(this.options);this.store=new R(this.options.resources,this.options);const s=this.services;s.logger=P,s.resourceStore=this.store,s.languageUtils=i,s.pluralResolver=new K(i,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),this.options.interpolation.format&&this.options.interpolation.format!==e.interpolation.format&&this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"),!t||this.options.interpolation.format&&this.options.interpolation.format!==e.interpolation.format||(s.formatter=n(t),s.formatter.init&&s.formatter.init(s,this.options),this.options.interpolation.format=s.formatter.format.bind(s.formatter)),s.interpolator=new H(this.options),s.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},s.backendConnector=new W(n(this.modules.backend),s.resourceStore,s,this.options),s.backendConnector.on("*",((t,...i)=>{this.emit(t,...i)})),this.modules.languageDetector&&(s.languageDetector=n(this.modules.languageDetector),s.languageDetector.init&&s.languageDetector.init(s,this.options.detection,this.options)),this.modules.i18nFormat&&(s.i18nFormat=n(this.modules.i18nFormat),s.i18nFormat.init&&s.i18nFormat.init(this)),this.translator=new F(this.services,this.options),this.translator.on("*",((t,...i)=>{this.emit(t,...i)})),this.modules.external.forEach((t=>{t.init&&t.init(this)}))}if(this.format=this.options.interpolation.format,i||(i=Z),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const t=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);t.length>0&&"dev"!==t[0]&&(this.options.lng=t[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=(...i)=>this.store[t](...i)})),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=(...i)=>(this.store[t](...i),this)}));const o=d(),r=()=>{const t=(t,e)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),o.resolve(e),i(t,e)};if(this.languages&&!this.isInitialized)return t(null,this.t.bind(this));this.changeLanguage(this.options.lng,t)};return this.options.resources||!this.options.initAsync?r():setTimeout(r,0),o}loadResources(t,i=Z){let e=i;const s=u(t)?t:this.language;if("function"==typeof t&&(e=t),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===s?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return e();const t=[],i=i=>{i&&"cimode"!==i&&this.services.languageUtils.toResolveHierarchy(i).forEach((i=>{"cimode"!==i&&t.indexOf(i)<0&&t.push(i)}))};s?i(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((t=>i(t))),this.options.preload?.forEach?.((t=>i(t))),this.services.backendConnector.load(t,this.options.ns,(t=>{t||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),e(t)}))}else e(null)}reloadResources(t,i,e){const s=d();return"function"==typeof t&&(e=t,t=void 0),"function"==typeof i&&(e=i,i=void 0),t||(t=this.languages),i||(i=this.options.ns),e||(e=Z),this.services.backendConnector.reload(t,i,(t=>{s.resolve(),e(t)})),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&I.addPostProcessor(t),"formatter"===t.type&&(this.modules.formatter=t),"3rdParty"===t.type&&this.modules.external.push(t),this}setResolvedLanguage(t){if(t&&this.languages&&!(["cimode","dev"].indexOf(t)>-1)){for(let t=0;t<this.languages.length;t++){const i=this.languages[t];if(!(["cimode","dev"].indexOf(i)>-1)&&this.store.hasLanguageSomeTranslations(i)){this.resolvedLanguage=i;break}}!this.resolvedLanguage&&this.languages.indexOf(t)<0&&this.store.hasLanguageSomeTranslations(t)&&(this.resolvedLanguage=t,this.languages.unshift(t))}}changeLanguage(t,i){this.isLanguageChangingTo=t;const e=d();this.emit("languageChanging",t);const s=t=>{this.language=t,this.languages=this.services.languageUtils.toResolveHierarchy(t),this.resolvedLanguage=void 0,this.setResolvedLanguage(t)},n=(n,o)=>{o?this.isLanguageChangingTo===t&&(s(o),this.translator.changeLanguage(o),this.isLanguageChangingTo=void 0,this.emit("languageChanged",o),this.logger.log("languageChanged",o)):this.isLanguageChangingTo=void 0,e.resolve(((...t)=>this.t(...t))),i&&i(n,((...t)=>this.t(...t)))},o=i=>{t||i||!this.services.languageDetector||(i=[]);const e=u(i)?i:i&&i[0],o=this.store.hasLanguageSomeTranslations(e)?e:this.services.languageUtils.getBestMatchFromCodes(u(i)?[i]:i);o&&(this.language||s(o),this.translator.language||this.translator.changeLanguage(o),this.services.languageDetector?.cacheUserLanguage?.(o)),this.loadResources(o,(t=>{n(t,o)}))};return t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(t):o(this.services.languageDetector.detect()),e}getFixedT(t,i,e){const s=(t,i,...n)=>{let o;o="object"!=typeof i?this.options.overloadTranslationOptionHandler([t,i].concat(n)):{...i},o.lng=o.lng||s.lng,o.lngs=o.lngs||s.lngs,o.ns=o.ns||s.ns,""!==o.keyPrefix&&(o.keyPrefix=o.keyPrefix||e||s.keyPrefix);const r={...this.options,...o};"function"==typeof o.keyPrefix&&(o.keyPrefix=T(o.keyPrefix,r));const a=this.options.keySeparator||".";let h;return o.keyPrefix&&Array.isArray(t)?h=t.map((t=>("function"==typeof t&&(t=T(t,r)),`${o.keyPrefix}${a}${t}`))):("function"==typeof t&&(t=T(t,r)),h=o.keyPrefix?`${o.keyPrefix}${a}${t}`:t),this.t(h,o)};return u(t)?s.lng=t:s.lngs=t,s.ns=i,s.keyPrefix=e,s}t(...t){return this.translator?.translate(...t)}exists(...t){return this.translator?.exists(...t)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t,i={}){if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const e=i.lng||this.resolvedLanguage||this.languages[0],s=!!this.options&&this.options.fallbackLng,n=this.languages[this.languages.length-1];if("cimode"===e.toLowerCase())return!0;const o=(t,i)=>{const e=this.services.backendConnector.state[`${t}|${i}`];return-1===e||0===e||2===e};if(i.precheck){const t=i.precheck(this,o);if(void 0!==t)return t}return!(!this.hasResourceBundle(e,t)&&this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages)&&(!o(e,t)||s&&!o(n,t)))}loadNamespaces(t,i){const e=d();return this.options.ns?(u(t)&&(t=[t]),t.forEach((t=>{this.options.ns.indexOf(t)<0&&this.options.ns.push(t)})),this.loadResources((t=>{e.resolve(),i&&i(t)})),e):(i&&i(),Promise.resolve())}loadLanguages(t,i){const e=d();u(t)&&(t=[t]);const s=this.options.preload||[],n=t.filter((t=>s.indexOf(t)<0&&this.services.languageUtils.isSupportedCode(t)));return n.length?(this.options.preload=s.concat(n),this.loadResources((t=>{e.resolve(),i&&i(t)})),e):(i&&i(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!t)return"rtl";try{const i=new Intl.Locale(t);if(i&&i.getTextInfo){const t=i.getTextInfo();if(t&&t.direction)return t.direction}}catch(t){}const i=this.services?.languageUtils||new V(G());return t.toLowerCase().indexOf("-latn")>1?"ltr":["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(i.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(t={},i){const e=new tt(t,i);return e.createInstance=tt.createInstance,e}cloneInstance(t={},i=Z){const e=t.forkResourceStore;e&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},n=new tt(s);if(void 0===t.debug&&void 0===t.prefix||(n.logger=n.logger.clone(t)),["store","services","language"].forEach((t=>{n[t]=this[t]})),n.services={...this.services},n.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},e){const t=Object.keys(this.store.data).reduce(((t,i)=>(t[i]={...this.store.data[i]},t[i]=Object.keys(t[i]).reduce(((e,s)=>(e[s]={...t[i][s]},e)),t[i]),t)),{});n.store=new R(t,s),n.services.resourceStore=n.store}if(t.interpolation){const i={...G().interpolation,...this.options.interpolation,...t.interpolation},e={...s,interpolation:i};n.services.interpolator=new H(e)}return n.translator=new F(n.services,s),n.translator.on("*",((t,...i)=>{n.emit(t,...i)})),n.init(s,i),n.translator.options=s,n.translator.backendConnector.services.utils={hasLoadedNamespace:n.hasLoadedNamespace.bind(n)},n}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const it=tt.createInstance(),{slice:et,forEach:st}=[],nt=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,ot={create(t,i,e,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{path:"/",sameSite:"strict"};e&&(n.expires=new Date,n.expires.setTime(n.expires.getTime()+60*e*1e3)),s&&(n.domain=s),document.cookie=function(t,i){const e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{path:"/"};let s=`${t}=${encodeURIComponent(i)}`;if(e.maxAge>0){const t=e.maxAge-0;if(Number.isNaN(t))throw new Error("maxAge should be a Number");s+=`; Max-Age=${Math.floor(t)}`}if(e.domain){if(!nt.test(e.domain))throw new TypeError("option domain is invalid");s+=`; Domain=${e.domain}`}if(e.path){if(!nt.test(e.path))throw new TypeError("option path is invalid");s+=`; Path=${e.path}`}if(e.expires){if("function"!=typeof e.expires.toUTCString)throw new TypeError("option expires is invalid");s+=`; Expires=${e.expires.toUTCString()}`}if(e.httpOnly&&(s+="; HttpOnly"),e.secure&&(s+="; Secure"),e.sameSite)switch("string"==typeof e.sameSite?e.sameSite.toLowerCase():e.sameSite){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return e.partitioned&&(s+="; Partitioned"),s}(t,i,n)},read(t){const i=`${t}=`,e=document.cookie.split(";");for(let t=0;t<e.length;t++){let s=e[t];for(;" "===s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return s.substring(i.length,s.length)}return null},remove(t,i){this.create(t,"",-1,i)}};var rt={name:"cookie",lookup(t){let{lookupCookie:i}=t;if(i&&"undefined"!=typeof document)return ot.read(i)||void 0},cacheUserLanguage(t,i){let{lookupCookie:e,cookieMinutes:s,cookieDomain:n,cookieOptions:o}=i;e&&"undefined"!=typeof document&&ot.create(e,t,s,n,o)}},at={name:"querystring",lookup(t){let i,{lookupQuerystring:e}=t;if("undefined"!=typeof window){let{search:t}=window.location;!window.location.search&&window.location.hash?.indexOf("?")>-1&&(t=window.location.hash.substring(window.location.hash.indexOf("?")));const s=t.substring(1).split("&");for(let t=0;t<s.length;t++){const n=s[t].indexOf("=");n>0&&s[t].substring(0,n)===e&&(i=s[t].substring(n+1))}}return i}},ht={name:"hash",lookup(t){let i,{lookupHash:e,lookupFromHashIndex:s}=t;if("undefined"!=typeof window){const{hash:t}=window.location;if(t&&t.length>2){const n=t.substring(1);if(e){const t=n.split("&");for(let s=0;s<t.length;s++){const n=t[s].indexOf("=");n>0&&t[s].substring(0,n)===e&&(i=t[s].substring(n+1))}}if(i)return i;if(!i&&s>-1){const i=t.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(i))return;const e="number"==typeof s?s:0;return i[e]?.replace("/","")}}}return i}};let ct=null;const lt=()=>{if(null!==ct)return ct;try{if(ct="undefined"!=typeof window&&null!==window.localStorage,!ct)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch(t){ct=!1}return ct};var ut={name:"localStorage",lookup(t){let{lookupLocalStorage:i}=t;if(i&&lt())return window.localStorage.getItem(i)||void 0},cacheUserLanguage(t,i){let{lookupLocalStorage:e}=i;e&&lt()&&window.localStorage.setItem(e,t)}};let dt=null;const ft=()=>{if(null!==dt)return dt;try{if(dt="undefined"!=typeof window&&null!==window.sessionStorage,!dt)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch(t){dt=!1}return dt};var pt={name:"sessionStorage",lookup(t){let{lookupSessionStorage:i}=t;if(i&&ft())return window.sessionStorage.getItem(i)||void 0},cacheUserLanguage(t,i){let{lookupSessionStorage:e}=i;e&&ft()&&window.sessionStorage.setItem(e,t)}},gt={name:"navigator",lookup(t){const i=[];if("undefined"!=typeof navigator){const{languages:t,userLanguage:e,language:s}=navigator;if(t)for(let e=0;e<t.length;e++)i.push(t[e]);e&&i.push(e),s&&i.push(s)}return i.length>0?i:void 0}},yt={name:"htmlTag",lookup(t){let i,{htmlTag:e}=t;const s=e||("undefined"!=typeof document?document.documentElement:null);return s&&"function"==typeof s.getAttribute&&(i=s.getAttribute("lang")),i}},mt={name:"path",lookup(t){let{lookupFromPathIndex:i}=t;if("undefined"==typeof window)return;const e=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(!Array.isArray(e))return;const s="number"==typeof i?i:0;return e[s]?.replace("/","")}},vt={name:"subdomain",lookup(t){let{lookupFromSubdomainIndex:i}=t;const e="number"==typeof i?i+1:1,s="undefined"!=typeof window&&window.location?.hostname?.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[e]}};let wt=!1;try{wt=!0}catch(t){}const bt=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];wt||bt.splice(1,1);class $t{constructor(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,i)}init(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.services=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{languageUtils:{}},this.options=function(t){return st.call(et.call(arguments,1),(i=>{if(i)for(const e in i)void 0===t[e]&&(t[e]=i[e])})),t}(t,this.options||{},{order:bt,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t}),"string"==typeof this.options.convertDetectedLanguage&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=t=>t.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(rt),this.addDetector(at),this.addDetector(ut),this.addDetector(pt),this.addDetector(gt),this.addDetector(yt),this.addDetector(mt),this.addDetector(vt),this.addDetector(ht)}addDetector(t){return this.detectors[t.name]=t,this}detect(){let t=[];return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.options.order).forEach((i=>{if(this.detectors[i]){let e=this.detectors[i].lookup(this.options);e&&"string"==typeof e&&(e=[e]),e&&(t=t.concat(e))}})),t=t.filter((t=>{return null!=t&&!("string"==typeof(i=t)&&[/<\s*script.*?>/i,/<\s*\/\s*script\s*>/i,/<\s*img.*?on\w+\s*=/i,/<\s*\w+\s*on\w+\s*=.*?>/i,/javascript\s*:/i,/vbscript\s*:/i,/expression\s*\(/i,/eval\s*\(/i,/alert\s*\(/i,/document\.cookie/i,/document\.write\s*\(/i,/window\.location/i,/innerHTML/i].some((t=>t.test(i))));var i})).map((t=>this.options.convertDetectedLanguage(t))),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?t:t.length>0?t[0]:null}cacheUserLanguage(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.options.caches;i&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||i.forEach((i=>{this.detectors[i]&&this.detectors[i].cacheUserLanguage(t,this.options)})))}}$t.type="languageDetector",it.use($t).init({fallbackLng:"en",debug:!1,resources:{en:{translation:{}},ja:{translation:{Pay:"支払う","Failed to load Stripe":"ライブラリの読み込みに失敗しました。","Add your payment information":"支払情報を追加","Add card":"カードを追加","Add a card":"カードを追加",Add:"追加","Card information":"カード情報","Card Number":"カード番号","MM / YY":"月 / 年",CVC:"セキュリティコード(CVC)","Country or region":"地域","Postal Code":"郵便番号",Close:"閉じる",Loading:"読み込み中","Payment information":"支払情報","Billing address":"請求先住所",Save:"保存"}},"pt-BR":{translation:{Pay:"Pagar","Failed to load Stripe":"Falha ao ler Stripe","Add your payment information":"Informações do seu Pagamento","Add card":"Adicionar Cartão","Add a card":"Adicionar um Cartão",Add:"Adicionar","Card information":"Informações do Cartão","Card Number":"Número do Cartão","MM / YY":"MM / AA",CVC:"Número de Segurança(CVC)","Country or region":"País ou região","Postal Code":"Cep",Close:"Fechar"}}}});const xt=it;export{l as c,xt as i}
@@ -0,0 +1 @@
1
+ import{S as t}from"./p-C6bbmyga.js";import{l as e}from"./p-CBXaOfXU.js";import{i}from"./p-B6JoQetF.js";const r=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys()){const i=t.get(e).filter((t=>{const e=t.deref();return e&&(!("isConnected"in(i=e))||i.isConnected);var i}));t.set(e,i)}})(...e)}),2e3)}})(),s=t.forceUpdate,n=t.getRenderingRef,o=(t,e)=>{const i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],t.length--)},l=(t,e)=>{const i=((t,e=(t,e)=>t!==e)=>{const i=()=>{return("function"==typeof(e=t)?e():e)??{};var e},r=i();let s=new Map(Object.entries(r));const n="undefined"!=typeof Proxy,l=n?null:{},a={dispose:[],get:[],set:[],reset:[]},c=new Map,h=()=>{s=new Map(Object.entries(i())),n||m(),a.reset.forEach((t=>t()))},u=t=>(a.get.forEach((e=>e(t))),s.get(t)),d=(t,i)=>{const r=s.get(t);e(i,r,t)&&(s.set(t,i),n||g(t),a.set.forEach((e=>e(t,i,r))))},v=n?new Proxy(r,{get:(t,e)=>u(e),ownKeys:()=>Array.from(s.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>s.has(e),set:(t,e,i)=>(d(e,i),!0)}):(m(),l),p=(t,e)=>(a[t].push(e),()=>{o(a[t],e)});function g(t){!n&&l&&(Object.prototype.hasOwnProperty.call(l,t)||Object.defineProperty(l,t,{configurable:!0,enumerable:!0,get:()=>u(t),set(e){d(t,e)}}))}function m(){if(n||!l)return;const t=new Set(s.keys());for(const e of Object.keys(l))t.has(e)||delete l[e];for(const e of t)g(e)}return{state:v,get:u,set:d,on:p,onChange:(t,e)=>{const r=(i,r)=>{i===t&&e(r)},s=()=>{const r=i();e(r[t])},n=p("set",r),o=p("reset",s);return c.set(e,{setHandler:r,resetHandler:s,propName:t}),()=>{n(),o(),c.delete(e)}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(p("set",e.set)),e.get&&t.push(p("get",e.get)),e.reset&&t.push(p("reset",e.reset)),e.dispose&&t.push(p("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{a.dispose.forEach((t=>t())),h()},reset:h,forceUpdate:t=>{const e=s.get(t);a.set.forEach((i=>i(t,e,e)))},removeListener:(t,e)=>{const i=c.get(e);i&&i.propName===t&&(o(a.set,i.setHandler),o(a.reset,i.resetHandler),c.delete(e))}}})(t,e);return i.use((()=>{if("function"!=typeof n||"function"!=typeof s)return{};const t=s,e=n,i=new Map;return{dispose:()=>i.clear(),get:t=>{const r=e();r&&((t,e,i)=>{let r=t.get(e);r||(r=[],t.set(e,r)),r.some((t=>t.deref()===i))||r.push(new WeakRef(i))})(i,t,r)},set:e=>{const s=i.get(e);if(s){const r=s.filter((e=>{const i=e.deref();return!!i&&t(i)}));i.set(e,r)}r(i)},reset:()=>{i.forEach((e=>{e.forEach((e=>{const i=e.deref();i&&t(i)}))})),r(i)}}})()),i};class a{constructor(){this.store=l({loadStripeStatus:"",applicationName:"stripe-pwa-elements",isCheckoutSession:!1}),this.initGeneration=0,this.changeListeners=new Map}get state(){return this.store.state}onChange(t,e){const i=this.store.onChange(t,e);return this.changeListeners.has(t)||this.changeListeners.set(t,[]),this.changeListeners.get(t).push(i),i}async initialize(t,i){const r=null!=(null==i?void 0:i.elementsOptions)?JSON.stringify(i.elementsOptions):void 0,s=null!=this.store.state.stripe&&!this.store.state.isCheckoutSession&&this.store.state.publishableKey===t&&this.store.state.stripeAccount===(null==i?void 0:i.stripeAccount)&&this.intentClientSecret===(null==i?void 0:i.clientSecret)&&this.elementsOptionsKey===r;if(this.store.state.publishableKey=t,this.store.state.isCheckoutSession=!1,this.intentClientSecret=null==i?void 0:i.clientSecret,this.elementsOptionsKey=r,null!=(null==i?void 0:i.stripeAccount)&&""!==(null==i?void 0:i.stripeAccount)&&(this.store.state.stripeAccount=i.stripeAccount),null!=(null==i?void 0:i.applicationName)&&""!==(null==i?void 0:i.applicationName)&&(this.store.state.applicationName=i.applicationName),s)return;const n=++this.initGeneration;this.store.state.loadStripeStatus="loading";try{const r=await e(t,{stripeAccount:null==i?void 0:i.stripeAccount});if(n!==this.initGeneration)return;r.registerAppInfo({name:this.store.state.applicationName}),this.store.state.stripe=r,this.store.state.elements=null!=(null==i?void 0:i.clientSecret)&&""!==i.clientSecret?r.elements({clientSecret:i.clientSecret}):null!=(null==i?void 0:i.elementsOptions)?r.elements(i.elementsOptions):r.elements(),this.store.state.checkout=void 0,this.store.state.loadStripeStatus="success"}catch(t){console.error("Failed to load Stripe.js:",t),this.store.state.loadStripeStatus="failure"}}async initializeWithCheckoutSession(t,i,r){const s=++this.initGeneration;this.store.state.publishableKey=t,this.store.state.isCheckoutSession=!0,null!=(null==r?void 0:r.stripeAccount)&&""!==(null==r?void 0:r.stripeAccount)&&(this.store.state.stripeAccount=r.stripeAccount),null!=(null==r?void 0:r.applicationName)&&""!==(null==r?void 0:r.applicationName)&&(this.store.state.applicationName=r.applicationName),this.store.state.loadStripeStatus="loading";try{const n=await e(t,{stripeAccount:null==r?void 0:r.stripeAccount});if(s!==this.initGeneration)return;n.registerAppInfo({name:this.store.state.applicationName}),this.store.state.stripe=n;const o=n.initCheckoutElementsSdk({clientSecret:i,elementsOptions:null==r?void 0:r.elementsOptions});this.store.state.checkout=o,this.store.state.elements=void 0,this.store.state.loadStripeStatus="success"}catch(t){console.error("Failed to initialize Stripe Checkout:",t),this.store.state.loadStripeStatus="failure"}}getStripe(){return this.store.state.stripe}getElements(){return this.store.state.elements}getCheckout(){return this.store.state.checkout}reset(){this.store.reset()}dispose(){this.changeListeners.forEach((t=>{t.forEach((t=>t()))})),this.changeListeners.clear(),this.store.dispose()}}function c(t,e,i=5e3){return new Promise(((r,s)=>{const n=t.querySelector(e);if(null!=n)return r(n);const o=setTimeout((()=>{l.disconnect(),s(new Error(`Element "${e}" not found within ${i}ms`))}),i),l=new MutationObserver((()=>{const i=t.querySelector(e);null!=i&&(clearTimeout(o),l.disconnect(),r(i))}));l.observe(t,{childList:!0,subtree:!0})}))}new a;class h{constructor(t){this.stripeService=t,this.store=l({errorMessage:"",errorSource:void 0})}getState(){return this.store.state}async initialize(t){const e=this.stripeService.getElements();if(null==e)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");null!=this.cardElements&&this.unmount();const r=e.create("cardNumber",{placeholder:i.t("Card Number")}),s=await c(t,"#card-number");r.mount(s),r.on("change",this.handleCardError("cardNumber"));const n=e.create("cardExpiry"),o=await c(t,"#card-expiry");n.mount(o),n.on("change",this.handleCardError("cardExpiry"));const l=e.create("cardCvc"),a=await c(t,"#card-cvc");return l.mount(a),l.on("change",this.handleCardError("cardCvc")),this.cardElements={cardNumber:r,cardExpiry:n,cardCVC:l},this.cardElements}getElements(){return this.cardElements}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage",""),this.store.set("errorSource",void 0)}unmount(){var t,e,i;null!=this.cardElements&&(null===(t=this.cardElements.cardNumber)||void 0===t||t.unmount(),null===(e=this.cardElements.cardExpiry)||void 0===e||e.unmount(),null===(i=this.cardElements.cardCVC)||void 0===i||i.unmount(),this.cardElements=void 0)}handleCardError(t){return({error:e})=>{if(e)return this.store.set("errorMessage",e.message),void this.store.set("errorSource",t);this.store.state.errorSource===t&&(this.store.set("errorMessage",""),this.store.set("errorSource",void 0))}}}class u{constructor(t){this.stripeService=t,this.store=l({errorMessage:""})}getState(){return this.store.state}async initialize(t,e){const i=this.stripeService.state.isCheckoutSession;if(null!=this.paymentElement&&this.unmount(),i){const t=this.stripeService.getCheckout();if(null==t)throw new Error("StripeService not initialized with Checkout Session. Call StripeService.initializeWithCheckoutSession() first.");this.paymentElement=t.createPaymentElement(e)}else{const t=this.stripeService.getElements();if(null==t)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");this.paymentElement=t.create("payment",e||{})}const r=await c(t,"#payment-element");return this.paymentElement.mount(r),this.paymentElement}getElement(){return this.paymentElement}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage","")}unmount(){null!=this.paymentElement&&(this.paymentElement.unmount(),this.paymentElement=void 0)}}class d{constructor(t){this.stripeService=t,this.store=l({errorMessage:"",isComplete:!1})}getState(){return this.store.state}async initialize(t,e){const i=this.stripeService.getElements();if(null==i)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");null!=this.addressElement&&this.unmount(),this.addressElement=i.create("address",e||{mode:"billing"});const r=await c(t,"#address-element");return this.addressElement.mount(r),this.addressElement.on("change",(t=>{this.store.set("errorMessage",""),this.store.set("isComplete",t.complete)})),this.addressElement}getElement(){return this.addressElement}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage","")}unmount(){null!=this.addressElement&&(this.addressElement.unmount(),this.addressElement=void 0)}}class v{constructor(t){this.stripeService=t,this.store=l({errorMessage:"",email:void 0})}getState(){return this.store.state}onChange(t,e){return this.store.onChange(t,e)}async initialize(t,e){const i=this.stripeService.getElements();if(null==i)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");null!=this.linkAuthenticationElement&&this.unmount();const r=i.create("linkAuthentication",e),s=await c(t,"#link-authentication-element");return r.mount(s),r.on("change",(t=>{var e;this.store.set("email",null===(e=t.value)||void 0===e?void 0:e.email)})),this.linkAuthenticationElement=r,this.linkAuthenticationElement}getElement(){return this.linkAuthenticationElement}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage","")}unmount(){null!=this.linkAuthenticationElement&&(this.linkAuthenticationElement.unmount(),this.linkAuthenticationElement=void 0)}}class p{constructor(t){this.stripeService=t,this.store=l({errorMessage:"",selectedCurrency:void 0})}getState(){return this.store.state}async initialize(t,e){const i=this.stripeService.getElements();if(null==i)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");null!=this.currencySelectorElement&&this.unmount();const r=await c(t,"#currency-selector");return this.currencySelectorElement=i.create("currencySelector",e||{}),this.currencySelectorElement.mount(r),this.currencySelectorElement.on("change",(t=>{var e;this.store.set("errorMessage",""),(null===(e=null==t?void 0:t.value)||void 0===e?void 0:e.currency)&&this.store.set("selectedCurrency",t.value.currency)})),this.currencySelectorElement}getElement(){return this.currencySelectorElement}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage","")}unmount(){null!=this.currencySelectorElement&&(this.currencySelectorElement.unmount(),this.currencySelectorElement=void 0)}}var g=function(t,e){var i={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(i[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(i[r[s]]=t[r[s]])}return i};class m{constructor(t){this.stripeService=t,this.store=l({errorMessage:"",isReady:!1})}getState(){return this.store.state}async initialize(t,e,i){const r=this.stripeService.getElements();if(null==r)throw new Error("StripeService not initialized. Call StripeService.initialize() first.");null!=this.expressCheckoutElement&&this.unmount();const s=g(e,["mode","amount","currency"]),n=Object.assign({},s);if(n.buttonHeight&&"string"==typeof n.buttonHeight){const t=parseInt(n.buttonHeight.replace("px",""),10);isNaN(t)||(n.buttonHeight=t)}const o=r.create("expressCheckout",n),l=await c(t,"#express-checkout-element");return null!=(null==i?void 0:i.onConfirm)&&o.on("confirm",i.onConfirm),null!=(null==i?void 0:i.onClick)&&o.on("click",i.onClick),null!=(null==i?void 0:i.onCancel)&&o.on("cancel",i.onCancel),null!=(null==i?void 0:i.onShippingAddressChange)&&o.on("shippingaddresschange",i.onShippingAddressChange),null!=(null==i?void 0:i.onShippingRateChange)&&o.on("shippingratechange",i.onShippingRateChange),o.on("ready",(()=>{this.store.set("isReady",!0)})),o.mount(l),this.expressCheckoutElement=o,this.expressCheckoutElement}getElement(){return this.expressCheckoutElement}update(t){var e;if(null==this.expressCheckoutElement)return void console.warn("Express Checkout Element not initialized. Cannot update options.");const{mode:i,amount:r,currency:s}=t,n=g(t,["mode","amount","currency"]),o={};void 0!==i&&(o.mode=i),void 0!==r&&(o.amount=r),void 0!==s&&(o.currency=s),Object.keys(o).length>0&&(null===(e=this.stripeService.getElements())||void 0===e||e.update(o));const l=Object.assign({},n);if(l.buttonHeight&&"string"==typeof l.buttonHeight){const t=parseInt(l.buttonHeight.replace("px",""),10);isNaN(t)||(l.buttonHeight=t)}0!==Object.keys(l).length&&this.expressCheckoutElement.update(l)}setError(t){this.store.set("errorMessage",t)}clearError(){this.store.set("errorMessage","")}unmount(){null!=this.expressCheckoutElement&&(this.expressCheckoutElement.unmount(),this.expressCheckoutElement=void 0,this.store.set("isReady",!1))}}const f=new class{createStripeService(){return new a}createCardElementManager(t){return new h(t)}createPaymentElementManager(t){return new u(t)}createAddressElementManager(t){return new d(t)}createLinkAuthenticationElementManager(t){return new v(t)}createCurrencySelectorElementManager(t){return new p(t)}createExpressCheckoutElementManager(t){return new m(t)}};export{f as s}
@@ -0,0 +1 @@
1
+ import{S as e}from"./p-XRfh5Wrs.js";const r=e=>{const{progress:r,isCheckoutSession:t,loadStripeStatus:i,intentClientSecret:n}=e;return"loading"===r||!(t?"success"===i:null!=n&&""!==n)},t=async(r,t,i,n)=>{const o=await("payment"===i?r.confirmPayment({elements:t,confirmParams:{return_url:n},redirect:"if_required"}):r.confirmSetup({elements:t,confirmParams:{return_url:n},redirect:"if_required"}));if(o.error)throw new e(o.error);return o},i=async(r,t)=>{var i;const n=await r.loadActions();if("error"===n.type)throw new e({type:"api_error",code:n.error.code||"checkout_session_error",message:n.error.message});const{actions:o}=n,s=await o.confirm({returnUrl:t,redirect:"if_required"});if("error"===s.type){const r={type:"card_error",code:s.error.code||"payment_failed",message:s.error.message,decline_code:"paymentFailed"===s.error.code?null===(i=s.error.paymentFailed)||void 0===i?void 0:i.declineCode:void 0};throw new e(r)}return s},n=e=>{const{stripe:r,isCheckoutSession:t,checkout:i,checkoutSessionClientSecret:n,elements:o,intentClientSecret:s}=e,c={stripe:r};return t?null==i?{error:"Checkout not properly initialized"}:(c.checkout=i,c.checkoutSessionClientSecret=n,{props:c}):null==o?{error:"Elements not properly initialized"}:(c.elements=o,c.intentClientSecret=s,{props:c})};export{i as a,n as b,t as c,r as i}
@@ -0,0 +1 @@
1
+ import{r as t,a as e,h as i,g as s}from"./p-C6bbmyga.js";import{c as r,i as n}from"./p-B6JoQetF.js";import{s as o}from"./p-C7MQk9FK.js";import{S as l}from"./p-XRfh5Wrs.js";import"./p-CBXaOfXU.js";const a=t=>{if(null!=t&&""!==t)return{stripeAccount:t}},p=class{async initStripe(t,e){if(await this.stripeService.initialize(t,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async e=>{"success"===e&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.cardElementManager.setError(t),this}updatePublishableKey(t){null!=t&&""!==t&&this.initStripe(t,a(this.stripeAccount))}updateStripeAccountId(t){const e=this.stripeService.state.publishableKey||this.publishableKey;null!=e&&""!==e&&this.initStripe(e,{stripeAccount:t})}async setPaymentRequestOption(t){return this.paymentRequestOption=t,this.createPaymentRequestButton(),this}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.cardElementManager.getElements(),e=this.stripeService.getStripe();null!=t?this.formSubmit.emit({cardCVCElement:t.cardCVC,cardExpiryElement:t.cardExpiry,cardNumberElement:t.cardNumber,stripe:e}):console.error("Card elements not initialized")}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(t,a(this.stripeService.state.stripeAccount)))}async defaultFormSubmitAction(t,{stripe:e,cardNumberElement:i,intentClientSecret:s}){t.preventDefault();try{const t=await((t,e,i,s)=>"payment"===this.intentType?t.confirmCardPayment(i,{payment_method:{card:s}}):t.confirmCardSetup(i,{payment_method:{card:s}}))(e,0,s,i);if(null!=t.error)throw new l(t.error);this.defaultFormSubmitResultHandler(t)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}constructor(i){t(this,i),this.stripeLoaded=e(this,"stripeLoaded",7),this.formSubmit=e(this,"formSubmit",7),this.defaultFormSubmitResult=e(this,"defaultFormSubmitResult",7),this.paymentRequestButtonCreated=!1,this.intentType="payment",this.zip=!0,this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.zipCode="",this.applicationName="stripe-pwa-elements",this.showLabel=!1,this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=o.createStripeService(),this.cardElementManager=o.createCardElementManager(this.stripeService)}componentWillLoad(){null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,a(this.stripeAccount))}async initElement(){await this.cardElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-card-element");null!=t?t.addEventListener("submit",(async t=>{const e=this.cardElementManager.getElements(),i=this.stripeService.getStripe(),{intentClientSecret:s}=this;if(null==e||null==i)return void console.error("Stripe not properly initialized");const r={cardCVCElement:e.cardCVC,cardExpiryElement:e.cardExpiry,cardNumberElement:e.cardNumber,stripe:i,intentClientSecret:s,zipCode:this.zipCode};this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,r):!0===this.shouldUseDefaultFormSubmitAction&&null!=s&&""!==s?await this.defaultFormSubmitAction(t,r):t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){this.cardElementManager.setError(t.message),this.progress="failure"}})):console.error("Form element #stripe-card-element not found")}componentDidLoad(){this.el.classList.add(r())}componentDidRender(){this.showPaymentRequestButton&&this.paymentRequestOption&&!this.paymentRequestButtonCreated&&this.createPaymentRequestButton()}disconnectedCallback(){this.cardElementManager.unmount()}createPaymentRequestButton(){const{showPaymentRequestButton:t,paymentRequestOption:e}=this;if(this.paymentRequestButtonCreated)return null;if(!t||null==e)return null;if(null==document)return null;const i=this.el.querySelector("#stripe-payment-request-button");if(null==i)return console.error("Target element #stripe-payment-request-button not found"),null;if(null!=i.querySelector("stripe-payment-request-button"))return this.paymentRequestButtonCreated=!0,null;const s=document.createElement("stripe-payment-request-button");i.appendChild(s),customElements.whenDefined("stripe-payment-request-button").then((()=>(((t,e)=>{const{paymentRequestPaymentMethodHandler:i,paymentRequestShippingOptionChangeHandler:s,paymentRequestShippingAddressChangeHandler:r}=e;t.setPaymentRequestOption(e),null!=i&&t.setPaymentMethodEventHandler(i),null!=s&&t.setPaymentRequestShippingOptionEventHandler(s),null!=r&&t.setPaymentRequestShippingAddressEventHandler(r)})(s,e),s.initStripe(this.publishableKey)))),this.paymentRequestButtonCreated=!0}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:e}=this.cardElementManager.getState();if("failure"===t)return i("p",null,n.t("Failed to load Stripe"));const s="loading"===this.progress;return i("div",{class:"stripe-payment-sheet-wrap"},i("form",{id:"stripe-card-element"},i("div",{class:"stripe-heading"},n.t(this.sheetTitle)),i("div",{id:"stripe-payment-request-button"}),i("div",null,i("div",{class:"stripe-section-title"},n.t("Card information"))),i("div",{class:"payment-info card visible"},i("fieldset",{class:"stripe-input-box"},i("div",null,i("label",null,this.showLabel?i("lenged",null,n.t("Card Number")):null,i("div",{id:"card-number"}))),i("div",{class:"stripe-input-column",style:{display:"flex"}},i("label",{style:{width:"50%"}},this.showLabel?i("lenged",null,n.t("MM / YY")):null,i("div",{id:"card-expiry"})),i("label",{style:{width:"50%"}},this.showLabel?i("lenged",null,n.t("CVC")):null,i("div",{id:"card-cvc"}))))),i("div",{id:"card-errors",class:"stripe-element-errors"},e),this.zip?i("div",{style:{marginTop:"1.5rem"}},i("div",{class:"stripe-section-title"},n.t("Country or region"))):null,this.zip?i("div",{class:"payment-info card visible"},i("fieldset",{class:"stripe-input-box"},i("div",null,i("label",null,this.showLabel?i("lenged",null,n.t("Postal Code")):null,i("input",{id:"zip",name:"zip",type:"text",inputmode:"numeric",class:"StripeElement",style:{width:"100%"},placeholder:n.t("Postal Code"),value:this.zipCode,onInput:t=>{this.zipCode=t.target.value}}))))):null,i("div",{style:{marginTop:"32px"}},i("button",{type:"submit",disabled:s},n.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return s(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}};p.style=':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap .StripeElement{padding:8px 16px;min-height:64px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-input-box{background-color:#fff;border-radius:6px;border:1px solid var(--color-input-border);overflow:hidden;filter:drop-shadow(0 0 2px var(--color-input-border-shadow))}.stripe-payment-sheet-wrap .stripe-input-box>*{border-bottom:1px solid var(--color-input-border)}.stripe-payment-sheet-wrap .stripe-input-box>*:last-child{border-bottom:none}.stripe-payment-sheet-wrap .stripe-input-column>*{border-right:1px solid var(--color-input-border)}.stripe-payment-sheet-wrap .stripe-input-column>*:last-child{border-right:none}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info label{color:var(--color-label)}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}';export{p as stripe_card_element}
@@ -0,0 +1 @@
1
+ import{r as t,a as i,h as e,g as s}from"./p-C6bbmyga.js";import{c as n,i as r}from"./p-B6JoQetF.js";import{s as o}from"./p-C7MQk9FK.js";import{b as a,c as h,a as l,i as c}from"./p-DFAhQS0n.js";import"./p-CBXaOfXU.js";import"./p-XRfh5Wrs.js";const p=class{async initStripe(t,i){const e=++this.initGeneration;await this.stripeService.initialize(t,{stripeAccount:null==i?void 0:i.stripeAccount,applicationName:this.applicationName,clientSecret:this.intentClientSecret}),await this.mountWhenLoaded(e)}async initStripeWithCheckoutSession(t,i,e){const s=++this.initGeneration;await this.stripeService.initializeWithCheckoutSession(t,i,{stripeAccount:null==e?void 0:e.stripeAccount,applicationName:this.applicationName,elementsOptions:null==e?void 0:e.elementsOptions}),await this.mountWhenLoaded(s)}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.paymentElementManager.setError(t),this}updatePublishableKey(t){const i={};i.stripeAccount=this.stripeService.state.stripeAccount;const e=Object.values(i).filter((t=>null!=t&&""!==t)).length>0;this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(t,this.checkoutSessionClientSecret,{stripeAccount:i.stripeAccount}):this.initStripe(t,e?i:void 0)}updateStripeAccountId(t){this.hasCheckoutSessionClientSecret()?this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:t}):this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:t})}async updateIntentClientSecret(){if(null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret)return;const{publishableKey:t,stripeAccount:i}=this.stripeService.state;null!=t&&""!==t&&await this.initStripe(t,{stripeAccount:i})}async updateCheckoutSessionClientSecret(t){null!=this.publishableKey&&""!==this.publishableKey&&null!=t&&""!==t&&await this.initStripeWithCheckoutSession(this.publishableKey,t,{stripeAccount:this.stripeAccount})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=this.stripeService.getStripe(),i=!0===this.stripeService.state.isCheckoutSession;if(null==t)return void console.error("Stripe not properly initialized");const e=a({stripe:t,isCheckoutSession:i,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});"error"in e?console.error(e.error):this.formSubmit.emit(e.props)}async defaultFormSubmitResultHandler(t){this.defaultFormSubmitResult.emit(t)}async checkoutSessionConfirmResultHandler(t){this.checkoutSessionConfirmResult.emit(t)}componentWillRender(){const{publishableKey:t}=this.stripeService.state;null!=t&&""!==t&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}):this.initStripeWithCheckoutSession(this.stripeService.state.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeService.state.stripeAccount})))}async defaultFormSubmitAction(t,{stripe:i,elements:e}){t.preventDefault();try{const t=window.location.href,s=await h(i,e,this.intentType,t);this.defaultFormSubmitResultHandler(s)}catch(t){throw console.error(t),this.defaultFormSubmitResultHandler(t),t}}async checkoutSessionFormSubmitAction(t,i){t.preventDefault();try{const t=window.location.href,e=await l(i,t);this.checkoutSessionConfirmResultHandler(e)}catch(t){throw console.error(t),this.checkoutSessionConfirmResultHandler(t instanceof Error?t:new Error(String(t))),t}}constructor(e){t(this,e),this.stripeLoaded=i(this,"stripeLoaded",7),this.formSubmit=i(this,"formSubmit",7),this.defaultFormSubmitResult=i(this,"defaultFormSubmitResult",7),this.checkoutSessionConfirmResult=i(this,"checkoutSessionConfirmResult",7),this.initGeneration=0,this.intentType="payment",this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.progress="",this.applicationName="stripe-pwa-elements",this.shouldUseDefaultFormSubmitAction=!0,this.stripeService=o.createStripeService(),this.paymentElementManager=o.createPaymentElementManager(this.stripeService)}componentWillLoad(){this.startStripe()}async mountWhenLoaded(t){if(t!==this.initGeneration)return;if("success"===this.stripeService.state.loadStripeStatus){if(await this.initElement(),t!==this.initGeneration)return;return void this.stripeLoadedEventHandler()}const i=this.stripeService.onChange("loadStripeStatus",(async e=>{t===this.initGeneration?"success"===e&&(await this.initElement(),t===this.initGeneration?(this.stripeLoadedEventHandler(),i()):i()):i()}))}hasCheckoutSessionClientSecret(){return null!=this.checkoutSessionClientSecret&&""!==this.checkoutSessionClientSecret}startStripe(){null!=this.publishableKey&&""!==this.publishableKey&&(null==this.checkoutSessionClientSecret||""===this.checkoutSessionClientSecret?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.initStripeWithCheckoutSession(this.publishableKey,this.checkoutSessionClientSecret,{stripeAccount:this.stripeAccount}))}async initElement(){await this.paymentElementManager.initialize(this.el);const t=this.el.querySelector("#stripe-payment-element");null!=t?(null!=this._submitHandler&&t.removeEventListener("submit",this._submitHandler),this._submitHandler=async t=>{const i=this.stripeService.getStripe(),e=!0===this.stripeService.state.isCheckoutSession;if(null==i)return void console.error("Stripe not properly initialized");const s=a({stripe:i,isCheckoutSession:e,checkout:this.stripeService.getCheckout(),checkoutSessionClientSecret:this.checkoutSessionClientSecret,elements:this.stripeService.getElements(),intentClientSecret:this.intentClientSecret});if("error"in s)return void console.error(s.error);const n=s.props;this.progress="loading";try{null!=this.handleSubmit?await this.handleSubmit(t,n):!0===this.shouldUseDefaultFormSubmitAction?e&&null!=n.checkout?await this.checkoutSessionFormSubmitAction(t,n.checkout):null!=this.intentClientSecret&&""!==this.intentClientSecret?await this.defaultFormSubmitAction(t,n):t.preventDefault():t.preventDefault(),await this.formSubmitEventHandler(),null==this.handleSubmit&&!0!==this.shouldUseDefaultFormSubmitAction||(this.progress="success")}catch(t){const i=t instanceof Error?t.message:String(t);this.paymentElementManager.setError(i),this.progress="failure"}},t.addEventListener("submit",this._submitHandler)):console.error("Form element #stripe-payment-element not found")}componentDidLoad(){this.el.classList.add(n())}disconnectedCallback(){if(this.paymentElementManager.unmount(),null!=this._submitHandler){const t=this.el.querySelector("#stripe-payment-element");null!=t&&t.removeEventListener("submit",this._submitHandler)}}render(){const{loadStripeStatus:t,isCheckoutSession:i}=this.stripeService.state,{errorMessage:s}=this.paymentElementManager.getState();if("failure"===t)return e("p",null,r.t("Failed to load Stripe"));const n=c({progress:this.progress,isCheckoutSession:!0===i,loadStripeStatus:t,intentClientSecret:this.intentClientSecret});return e("div",{class:"stripe-payment-sheet-wrap"},e("form",{id:"stripe-payment-element"},e("div",{class:"stripe-heading"},r.t(this.sheetTitle)),e("div",null,e("div",{class:"stripe-section-title"},r.t("Payment information"))),e("div",{class:"payment-info visible"},e("div",{id:"payment-element"})),e("div",{id:"payment-errors",class:"stripe-element-errors"},s),e("div",{style:{marginTop:"32px"}},e("button",{type:"submit",disabled:n},r.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return s(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}}};p.style=':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap .StripeElement{padding:8px 16px;min-height:64px;border-radius:6px;display:flex;justify-content:center;align-items:center}.stripe-payment-sheet-wrap .StripeElement>.__PrivateStripeElement{width:100%}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}';export{p as stripe_payment_element}
@@ -0,0 +1 @@
1
+ import{r as t,a as e,h as s,d as i,g as a}from"./p-C6bbmyga.js";import{l as n}from"./p-CBXaOfXU.js";const o=class{constructor(s){t(this,s),this.stripeLoaded=e(this,"stripeLoaded",7),this.loadStripeStatus="",this.applicationName="stripe-pwa-elements"}async isAvailable(t){if(void 0===this.publishableKey)throw new Error("You should set publishableKey before calling this method.");const e=(await n(this.publishableKey,{stripeAccount:this.stripeAccount})).paymentRequest({country:"US",currency:"usd",total:{label:"Demo total",amount:1099},disableWallets:["applePay","googlePay","browserCard"].filter((e=>e!==t))}),s=await e.canMakePayment();if(!s||"applePay"===t&&!s[t]||"googlePay"===t&&!s[t])throw new Error(`This device cannot use ${t}.`)}async setPaymentMethodEventHandler(t){this.paymentMethodEventHandler=t}async setPaymentRequestShippingOptionEventHandler(t){this.shippingOptionEventHandler=t}async setPaymentRequestShippingAddressEventHandler(t){this.shippingAddressEventHandler=t}stripeLoadedEventHandler(){const t={stripe:this.stripe};this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}componentWillLoad(){void 0!==this.publishableKey&&void 0!==this.paymentRequestOption?this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount}):this.loadStripeStatus="failure"}connectedCallback(){console.warn("[stripe-pwa-elements] <stripe-payment-request-button> is deprecated. stripe.paymentRequest() is being removed in Stripe.js 9.x (deprecated 2025-09-30 / removed 2026-03-25). Please migrate to <stripe-express-checkout-element>, which supports Apple Pay, Google Pay, Link, PayPal, and more. Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/")}async setPaymentRequestOption(t){return this.paymentRequestOption=t,this}async initStripe(t,e){this.loadStripeStatus="loading",n(t,{stripeAccount:null==e?void 0:e.stripeAccount}).then((t=>{this.loadStripeStatus="success",t.registerAppInfo({name:this.applicationName}),this.stripe=t})).catch((t=>{console.log(t),this.loadStripeStatus="failure"})).then((()=>{if(this.stripe)return this.initElement(0==!(null==e?void 0:e.showButton))})).then((()=>{this.stripe&&this.stripeLoadedEventHandler()}))}async initElement(t=!0){const e=this.stripe.paymentRequest(this.paymentRequestOption);if(!await e.canMakePayment())throw new Error("Payment Request is not supported.");if(this.paymentMethodEventHandler&&e.on("paymentmethod",(t=>{this.paymentMethodEventHandler(t,this.stripe)})),this.shippingOptionEventHandler&&e.on("shippingoptionchange",(t=>{this.shippingOptionEventHandler(t,this.stripe)})),this.shippingAddressEventHandler&&e.on("shippingaddresschange",(t=>{this.shippingAddressEventHandler(t,this.stripe)})),t){this.paymentRequestElement&&this.paymentRequestElement.unmount();const t=this.stripe.elements().create("paymentRequestButton",{paymentRequest:e});this.paymentRequestElement=t;const s=this.el.querySelector("#payment-request-button");t.mount(s),this.el.querySelector("#payment-request").classList.add("visible")}else e.show()}disconnectedCallback(){this.paymentRequestElement&&(this.paymentRequestElement.unmount(),this.paymentRequestElement=void 0),this.stripe=void 0}render(){return s(i,{key:"644a4b729c72e87b42df5e1b43262d3195e7ebc6"},s("div",{key:"aff26789868bbec0f1f6abc463fb14d7f3e73c1b",id:"payment-request"},s("div",{key:"074a25f3c5b2575696ddaeacf2715935212964a5",id:"payment-request-button"})),s("slot",{key:"5173400bd63ab201f02934cea4edcab4bb7eed9c"}))}get el(){return a(this)}};o.style=":host{display:block}";export{o as stripe_payment_request_button}
@@ -0,0 +1 @@
1
+ import{r as e,a as t,h as s,d as i,g as a}from"./p-C6bbmyga.js";import{c as n,i as r}from"./p-B6JoQetF.js";import{s as o}from"./p-C7MQk9FK.js";import{c}from"./p-DFAhQS0n.js";import"./p-CBXaOfXU.js";import"./p-XRfh5Wrs.js";const d={phase:"idle",generation:0,pendingPresent:!1,openRequested:!1},p=[[/^pi_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/,"payment"],[/^seti_[A-Za-z0-9]+_secret_[A-Za-z0-9]+$/,"setup"]],h=e=>({state:e,effects:[]}),l=(e,t)=>e.pendingPresent?{state:Object.assign(Object.assign({},e),{pendingPresent:!1}),effects:[{type:"resolvePresent",result:t}]}:h(e),f=e=>{const t=l(Object.assign(Object.assign({},e),{openRequested:!1}),"paymentSheetCanceled");return{state:t.state,effects:[..."presented"===e.phase||"confirming"===e.phase?[{type:"hide"}]:[],{type:"emit",event:"paymentSheetCanceled"},...t.effects]}},b=(e,t)=>{if(""===t)return h(e);if("confirming"===e.phase)return h(Object.assign(Object.assign({},e),{deferredClientSecret:t}));const s="presented"===e.phase?f(e):h(e),i=e.generation+1,a=(e=>{const t=p.find((([t])=>t.test(e)));return null==t?void 0:t[1]})(t);if(null==a){const e=l(Object.assign(Object.assign({},s.state),{phase:"loadFailed",generation:i,intentKind:void 0,openRequested:!1}),"paymentSheetFailed");return{state:e.state,effects:[...s.effects,{type:"emit",event:"paymentSheetFailedToLoad"},...e.effects]}}return{state:Object.assign(Object.assign({},s.state),{phase:"loading",generation:i,intentKind:a}),effects:[...s.effects,{type:"load",generation:i,clientSecret:t,intentKind:a}]}},m=e=>{const{deferredClientSecret:t}=e.state;if(null==t)return e;const s=b(Object.assign(Object.assign({},e.state),{deferredClientSecret:void 0}),t);return{state:s.state,effects:[...e.effects,...s.effects]}},u=(e,t)=>"confirming"===e.phase&&e.generation===t;var y=function(e,t){var s={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(s[i[a]]=e[i[a]])}return s};const g=["merchantDisplayName","paymentMethodLayout","defaultBillingDetails","returnURL","style"],v={horizontal:"tabs",vertical:"accordion",automatic:"auto"},j={alwaysLight:"stripe",alwaysDark:"night"},O=e=>Object.fromEntries(Object.entries(e).filter((([,e])=>void 0!==e))),w=["card_error","validation_error","api_connection_error","rate_limit_error","api_error"],S=class{async present(){null==this.presentPromise&&(this.presentPromise=new Promise((e=>{this.resolvePresent=e})));const e=this.presentPromise;return this.dispatch({type:"presentRequested"}),e}handleSecretChange(){this.startLoading()}handleOpenChange(e){this.dispatch({type:e?"openRequested":"closeRequested"})}constructor(s){e(this,s),this.paymentSheetLoaded=t(this,"paymentSheetLoaded",7),this.paymentSheetFailedToLoad=t(this,"paymentSheetFailedToLoad",7),this.paymentSheetCompleted=t(this,"paymentSheetCompleted",7),this.paymentSheetCanceled=t(this,"paymentSheetCanceled",7),this.paymentSheetFailed=t(this,"paymentSheetFailed",7),this.warnedUnsupportedOptions=!1,this.open=!1,this.sheetTitle="Add your payment information",this.buttonLabel="Pay",this.applicationName="stripe-pwa-elements",this.sheet=d,this.visible=!1,this.errorMessage="",this.handleSubmit=e=>{e.preventDefault(),this.errorMessage="",this.dispatch({type:"submitted"})},this.handleModalClose=()=>{var e;this.dispatch({type:"closeRequested"}),this.visible&&(null===(e=this.el.querySelector("stripe-modal"))||void 0===e||e.openModal())},this.stripeService=o.createStripeService(),this.paymentElementManager=o.createPaymentElementManager(this.stripeService)}componentWillLoad(){this.open&&this.dispatch({type:"openRequested"}),this.startLoading()}componentDidLoad(){this.el.classList.add(n())}disconnectedCallback(){this.paymentElementManager.unmount()}startLoading(){null!=this.publishableKey&&""!==this.publishableKey&&null!=this.intentClientSecret&&this.dispatch({type:"secretChanged",clientSecret:this.intentClientSecret})}dispatch(e){const{state:t,effects:s}=((e,t)=>{switch(t.type){case"secretChanged":return b(e,t.clientSecret);case"loadSucceeded":{if(t.generation!==e.generation||"loading"!==e.phase)return h(e);const s=e.openRequested;return{state:Object.assign(Object.assign({},e),{phase:s?"presented":"ready",openRequested:!1}),effects:[{type:"emit",event:"paymentSheetLoaded"},...s?[{type:"show"}]:[]]}}case"loadFailed":{if(t.generation!==e.generation||"loading"!==e.phase)return h(e);const s=l(Object.assign(Object.assign({},e),{phase:"loadFailed",openRequested:!1}),"paymentSheetFailed");return{state:s.state,effects:[{type:"emit",event:"paymentSheetFailedToLoad"},...s.effects]}}case"presentRequested":if(e.pendingPresent)return h(e);switch(e.phase){case"ready":return{state:Object.assign(Object.assign({},e),{phase:"presented",pendingPresent:!0}),effects:[{type:"show"}]};case"idle":case"loading":return h(Object.assign(Object.assign({},e),{pendingPresent:!0,openRequested:!0}));case"presented":case"confirming":return h(Object.assign(Object.assign({},e),{pendingPresent:!0}));default:return{state:e,effects:[{type:"resolvePresent",result:"paymentSheetFailed"}]}}case"openRequested":return"ready"===e.phase?{state:Object.assign(Object.assign({},e),{phase:"presented"}),effects:[{type:"show"}]}:h("idle"===e.phase||"loading"===e.phase?Object.assign(Object.assign({},e),{openRequested:!0}):e);case"closeRequested":if("presented"===e.phase){const t=f(e);return{state:Object.assign(Object.assign({},t.state),{phase:"ready"}),effects:t.effects}}return"idle"!==e.phase&&"loading"!==e.phase||!e.openRequested?h(e):f(e);case"submitted":return"presented"!==e.phase||null==e.intentKind?h(e):{state:Object.assign(Object.assign({},e),{phase:"confirming"}),effects:[{type:"confirm",generation:e.generation,intentKind:e.intentKind}]};case"confirmSucceeded":{if(!u(e,t.generation))return h(e);const s=l(Object.assign(Object.assign({},e),{phase:"completed"}),"paymentSheetCompleted");return m({state:s.state,effects:[{type:"hide"},{type:"emit",event:"paymentSheetCompleted"},...s.effects]})}case"confirmDeclined":return u(e,t.generation)?m({state:Object.assign(Object.assign({},e),{phase:"presented"}),effects:[{type:"showError",message:t.message}]}):h(e);case"confirmFailed":{if(!u(e,t.generation))return h(e);const s=l(Object.assign(Object.assign({},e),{phase:"errored"}),"paymentSheetFailed");return m({state:s.state,effects:[{type:"hide"},{type:"emit",event:"paymentSheetFailed"},...s.effects]})}}})(this.sheet,e);this.sheet=t,s.forEach((e=>this.perform(e)))}perform(e){var t;switch(e.type){case"load":this.load(e.generation,e.clientSecret);break;case"show":this.visible=!0,this.open=!0;break;case"hide":this.visible=!1,this.open=!1;break;case"confirm":this.confirm(e.generation,e.intentKind);break;case"showError":this.errorMessage=e.message;break;case"emit":this.emit(e.event);break;case"resolvePresent":null===(t=this.resolvePresent)||void 0===t||t.call(this,{paymentResult:e.result}),this.presentPromise=void 0,this.resolvePresent=void 0}}async load(e,t){var s;this.warnUnsupportedOptions();try{if(await this.stripeService.initialize(this.publishableKey,{stripeAccount:this.stripeAccount,applicationName:this.applicationName,clientSecret:t}),e!==this.sheet.generation)return;if("success"!==this.stripeService.state.loadStripeStatus)throw new Error("Failed to load Stripe.js");const i=(e=>{if(null!=e)return{theme:j[e]}})(null===(s=this.options)||void 0===s?void 0:s.style);null!=i&&await this.stripeService.getElements().update({appearance:i}),await this.paymentElementManager.initialize(this.el,(e=>{if(null==e)return{};const{merchantDisplayName:t,paymentMethodLayout:s,defaultBillingDetails:i}=e,a={};if(null!=t&&(a.business={name:t}),null!=s&&(a.layout=v[s]),null!=i){const{address:e}=i,t=y(i,["address"]),s=O(t);if(null!=e){const{postalCode:t}=e,i=y(e,["postalCode"]);s.address=O(Object.assign(Object.assign({},i),{postal_code:t}))}a.defaultValues={billingDetails:s}}return a})(this.options)),this.dispatch({type:"loadSucceeded",generation:e})}catch(t){this.lastError=t,this.dispatch({type:"loadFailed",generation:e})}}async confirm(e,t){var s,i,a;try{const a=null!==(i=null===(s=this.options)||void 0===s?void 0:s.returnURL)&&void 0!==i?i:window.location.href;this.lastResult=await c(this.stripeService.getStripe(),this.stripeService.getElements(),t,a),this.dispatch({type:"confirmSucceeded",generation:e})}catch(t){const s=null!==(a=t.message)&&void 0!==a?a:String(t);if((e=>{const t=null==e?void 0:e.type;return"string"==typeof t&&w.includes(t)})(t))return void this.dispatch({type:"confirmDeclined",generation:e,message:s});this.lastError=t,this.dispatch({type:"confirmFailed",generation:e,message:s})}}emit(e){switch(e){case"paymentSheetLoaded":this.paymentSheetLoaded.emit({stripe:this.stripeService.getStripe()});break;case"paymentSheetFailedToLoad":this.paymentSheetFailedToLoad.emit(this.lastError);break;case"paymentSheetCompleted":this.paymentSheetCompleted.emit(this.lastResult);break;case"paymentSheetCanceled":this.paymentSheetCanceled.emit();break;case"paymentSheetFailed":this.paymentSheetFailed.emit(this.lastError)}}warnUnsupportedOptions(){const e=null==(t=this.options)?[]:Object.entries(t).filter((([e,t])=>void 0!==t&&!g.includes(e))).map((([e])=>e)).sort();var t;this.warnedUnsupportedOptions||0===e.length||(this.warnedUnsupportedOptions=!0,console.warn(`<stripe-payment-sheet>: these options have no effect on the web yet: ${e.join(", ")}`))}render(){const{phase:e}=this.sheet,t="confirming"===e;return s(i,{key:"ecb6de4b0674af9f5ecf86acce93e092c3bee881"},s("stripe-modal",{key:"137473608d8cc3c0833c34529f1dafb9fc0cba34",open:this.visible,showCloseButton:!t,onClose:this.handleModalClose},s("div",{key:"0da153ef48ddc5464f050ea1921a69f975a7d8e1",class:"stripe-payment-sheet-wrap"},s("form",{key:"6f6653aee9d0ad54c8bf935ace2f6d4fdc648e1f",id:"stripe-payment-sheet",onSubmit:this.handleSubmit},s("div",{key:"85d3e28a20679051decdb02d590c2144e652f0bd",class:"stripe-heading"},r.t(this.sheetTitle)),s("div",{key:"f6b8d90a3731732c0b36af0512a5ace87a12f98d",class:"payment-info visible"},s("div",{key:"813a1ad3a0db2efa650aceff828412999f34ff2b",id:"payment-element"})),s("div",{key:"63bd6a8c20dd7b8b92aa2171553c13570ab17808",class:"stripe-element-errors",role:"alert"},this.errorMessage),s("div",{key:"f70e9b353ae9eecd1300bbbd40ebb731ef44c344",class:"stripe-submit"},s("button",{key:"6f32a7b94132091348680476b0e7292072800dbf",type:"submit",disabled:"presented"!==e},r.t(t?"Loading":this.buttonLabel)))))))}get el(){return a(this)}static get watchers(){return{publishableKey:[{handleSecretChange:0}],intentClientSecret:[{handleSecretChange:0}],stripeAccount:[{handleSecretChange:0}],open:[{handleOpenChange:0}]}}};S.style=':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}stripe-payment-sheet{display:contents}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .payment-info{margin-top:8px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .stripe-submit{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}';export{S as stripe_payment_sheet}
@@ -0,0 +1 @@
1
+ import{r as t,a as s,h as e,g as i}from"./p-C6bbmyga.js";import{c as r,i as o}from"./p-B6JoQetF.js";import{s as a}from"./p-C7MQk9FK.js";import"./p-CBXaOfXU.js";const n=class{async initStripe(t,s){if(await this.stripeService.initialize(t,{stripeAccount:null==s?void 0:s.stripeAccount,applicationName:this.applicationName}),"success"===this.stripeService.state.loadStripeStatus)await this.initElement(),this.stripeLoadedEventHandler();else{const t=this.stripeService.onChange("loadStripeStatus",(async s=>{"success"===s&&(await this.initElement(),this.stripeLoadedEventHandler(),t())}))}}async updateProgress(t){return this.progress=t,this}async setErrorMessage(t){return this.addressElementManager.setError(t),this}async getValue(){const t=this.addressElementManager.getElement();if(null==t)throw new Error("Address element not initialized");return await t.getValue({format:"localized"})}updatePublishableKey(t){const s={};null!=this.stripeAccount&&""!==this.stripeAccount&&(s.stripeAccount=this.stripeAccount),this.initStripe(t,Object.keys(s).length>0?s:void 0)}updateStripeAccountId(t){const s=this.stripeService.state.publishableKey||this.publishableKey;null!=s&&""!==s&&this.initStripe(s,{stripeAccount:t})}stripeLoadedEventHandler(){const t={stripe:this.stripeService.getStripe()};null!=this.stripeDidLoaded&&this.stripeDidLoaded(t),this.stripeLoaded.emit(t)}async formSubmitEventHandler(){const t=await this.getValue();this.formSubmit.emit({address:t})}componentWillRender(){null!=this.stripeService.state.publishableKey&&""!==this.stripeService.state.publishableKey&&(["success","loading"].includes(this.stripeService.state.loadStripeStatus)||this.initStripe(this.stripeService.state.publishableKey,{stripeAccount:this.stripeService.state.stripeAccount}))}constructor(e){t(this,e),this.stripeLoaded=s(this,"stripeLoaded",7),this.formSubmit=s(this,"formSubmit",7),this.mode="billing",this.sheetTitle="Billing address",this.buttonLabel="Save",this.progress="",this.applicationName="stripe-pwa-elements",this.showLabel=!1,this.stripeService=a.createStripeService(),this.addressElementManager=a.createAddressElementManager(this.stripeService)}componentWillLoad(){null!=this.publishableKey&&""!==this.publishableKey&&this.initStripe(this.publishableKey,{stripeAccount:this.stripeAccount})}async initElement(){const t={mode:this.mode};null!=this.defaultCountry&&""!==this.defaultCountry&&(t.defaultValues={address:{country:this.defaultCountry}}),this.allowedCountries&&this.allowedCountries.length>0&&(t.allowedCountries=this.allowedCountries),await this.addressElementManager.initialize(this.el,t);const s=this.el.querySelector("#stripe-address-element-form");null!=s?(null!=this.formSubmitListener&&s.removeEventListener("submit",this.formSubmitListener),this.formSubmitListener=async t=>{if(t.preventDefault(),null!=this.addressElementManager.getElement()){this.progress="loading";try{const s=await this.getValue();null!=this.handleSubmit&&await this.handleSubmit(t,{address:s}),await this.formSubmitEventHandler(),null!=this.handleSubmit&&(this.progress="success")}catch(t){const s=t instanceof Error?t.message:String(t);this.addressElementManager.setError(s),this.progress="failure"}}else console.error("Address element not initialized")},s.addEventListener("submit",this.formSubmitListener)):console.error("Form element #stripe-address-element-form not found")}componentDidLoad(){this.el.classList.add(r())}disconnectedCallback(){if(null!=this.formSubmitListener){const t=this.el.querySelector("#stripe-address-element-form");null!=t&&t.removeEventListener("submit",this.formSubmitListener),this.formSubmitListener=void 0}this.addressElementManager.unmount()}render(){const{loadStripeStatus:t}=this.stripeService.state,{errorMessage:s}=this.addressElementManager.getState();if("failure"===t)return e("p",null,o.t("Failed to load Stripe"));const i="loading"===this.progress;return e("div",{class:"stripe-payment-sheet-wrap"},e("form",{id:"stripe-address-element-form"},e("div",{class:"stripe-heading"},o.t(this.sheetTitle)),e("div",{class:"payment-info address visible"},e("div",{id:"address-element"})),e("div",{id:"address-errors",class:"stripe-element-errors"},s),e("div",{class:"submit-button-wrapper"},e("button",{type:"submit",disabled:i},o.t("loading"===this.progress?"Loading":this.buttonLabel)))))}get el(){return i(this)}static get watchers(){return{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}}};n.style=':root{--color-label:#565656;--color-placeholder:#acacac;--color-heading-text:#333;--color-text-error:#ef4444;--color-input-border:#e4e4e6;--color-input-border-shadow:rgba(228, 228, 230, 0.6);--color-button-text:rgba(255, 255, 255, 0.95);--color-button-text-disabled:rgba(255, 255, 255, 0.4);--color-primary:#0074d4}.stripe-payment-sheet-wrap{box-sizing:border-box}.stripe-payment-sheet-wrap *:where(:not(iframe,canvas,img,svg,video):not(svg *)){all:unset;display:revert;background:none;border:none;font-family:"Roboto", sans-serif;box-sizing:border-box}.stripe-payment-sheet-wrap button{cursor:pointer}.stripe-payment-sheet-wrap{display:block;width:100%;background:#fff;padding:32px 16px}.stripe-payment-sheet-wrap #address-element{margin-top:16px}.stripe-payment-sheet-wrap .stripe-heading{font-size:24px;font-weight:bold;color:var(--color-heading-text);margin-bottom:24px}.stripe-payment-sheet-wrap .stripe-section-title{font-size:14px;font-weight:bold;color:var(--color-label);margin-bottom:8px}.stripe-payment-sheet-wrap .payment-info.address{margin-bottom:16px}.stripe-payment-sheet-wrap .stripe-element-errors{margin-top:8px;font-size:14px;color:var(--color-text-error)}.stripe-payment-sheet-wrap .submit-button-wrapper{margin-top:32px}.stripe-payment-sheet-wrap button{display:block;color:var(--color-button-text);background-color:var(--color-primary);width:100%;text-align:center;padding:16px 16px;font-size:18px;border-radius:6px;min-height:42px}.stripe-payment-sheet-wrap button:disabled{color:var(--color-button-text-disabled)}';export{n as stripe_address_element}
@@ -1 +1 @@
1
- import{p as e,B as t,c as i,w as n,N as a,H as l,b as o}from"./p-C6bbmyga.js";export{s as setNonce}from"./p-C6bbmyga.js";import{g as p}from"./p-DQuL1Twl.js";var r=e=>{const t=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return t.call(this,e);const i=t.call(this,!1),n=this.childNodes;if(e)for(let e=0;e<n.length;e++)2!==n[e].nodeType&&i.appendChild(n[e].cloneNode(!0));return i}};(()=>{t.isDev&&!t.isTesting&&i("Running in development mode."),t.cloneNodeFix&&r(l.prototype);const s=t.scriptDataOpts?n.document&&Array.from(n.document.querySelectorAll("script")).find((e=>new RegExp(`/${a}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===a)):null,o=import.meta.url,p=t.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==o&&(p.resourcesUrl=new URL(".",o).href),e(p)})().then((async e=>(await p(),o([["p-38e7b187",[[0,"stripe-card-element-modal",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],intentClientSecret:[1,"intent-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],intentType:[1,"intent-type"],handleSubmit:[1040],stripeDidLoaded:[1040],showCloseButton:[4,"show-close-button"],zip:[4],open:[4],getStripeCardElementElement:[64],present:[64],updateProgress:[64],destroy:[64],setPaymentRequestButton:[64]}]]],["p-f64f394d",[[0,"stripe-address-element",{mode:[1],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],defaultCountry:[1,"default-country"],allowedCountries:[16],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],getValue:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-44495284",[[0,"stripe-currency-selector",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],clientSecret:[1,"client-secret"],handleCurrencyChange:[1040],stripeDidLoaded:[1040],initStripe:[64],setErrorMessage:[64],getSelectedCurrency:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-f09c86a0",[[0,"stripe-express-checkout-element",{intentType:[1,"intent-type"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],clientSecret:[1,"client-secret"],amount:[2],currency:[1],buttonHeight:[1,"button-height"],shouldUseDefaultConfirmAction:[4,"should-use-default-confirm-action"],stripeDidLoaded:[1040],progress:[32],updateProgress:[64],setErrorMessage:[64],initStripe:[64],updateElementOptions:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-4ba675fa",[[0,"stripe-link-authentication-element",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],defaultEmail:[1,"default-email"],handleChange:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],getEmail:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-f6d2425e",[[0,"stripe-payment-element",{intentType:[1,"intent-type"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],intentClientSecret:[1,"intent-client-secret"],checkoutSessionClientSecret:[1,"checkout-session-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],initStripeWithCheckoutSession:[64],updateProgress:[64],setErrorMessage:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}]]],["p-5cf62945",[[1,"ion-icon",{mode:[1025],color:[1],ios:[1],md:[1],flipRtl:[4,"flip-rtl"],name:[513],src:[1],icon:[8],size:[1],lazy:[4],sanitize:[4],svgContent:[32],isVisible:[32]},null,{name:[{loadIcon:0}],src:[{loadIcon:0}],icon:[{loadIcon:0}],ios:[{loadIcon:0}],md:[{loadIcon:0}]}]]],["p-d9e86451",[[260,"stripe-payment-request-button",{paymentMethodEventHandler:[16],shippingOptionEventHandler:[16],shippingAddressEventHandler:[16],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],stripeDidLoaded:[1040],loadStripeStatus:[32],stripe:[32],paymentRequestOption:[32],isAvailable:[64],setPaymentMethodEventHandler:[64],setPaymentRequestShippingOptionEventHandler:[64],setPaymentRequestShippingAddressEventHandler:[64],setPaymentRequestOption:[64],initStripe:[64]}]]],["p-c24ae181",[[0,"stripe-card-element",{intentType:[1,"intent-type"],zip:[4],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],intentClientSecret:[1,"intent-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],showPaymentRequestButton:[4,"show-payment-request-button"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],zipCode:[32],paymentRequestOption:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],setPaymentRequestOption:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}],[257,"stripe-modal",{showCloseButton:[4,"show-close-button"],open:[4],renderedOpen:[32],toggleModal:[64],openModal:[64],closeModal:[64]}]]]],e))));
1
+ import{p as e,B as t,c as n,w as i,N as a,H as l,b as o}from"./p-C6bbmyga.js";export{s as setNonce}from"./p-C6bbmyga.js";import{g as p}from"./p-DQuL1Twl.js";var r=e=>{const t=e.cloneNode;e.cloneNode=function(e){if("TEMPLATE"===this.nodeName)return t.call(this,e);const n=t.call(this,!1),i=this.childNodes;if(e)for(let e=0;e<i.length;e++)2!==i[e].nodeType&&n.appendChild(i[e].cloneNode(!0));return n}};(()=>{t.isDev&&!t.isTesting&&n("Running in development mode."),t.cloneNodeFix&&r(l.prototype);const s=t.scriptDataOpts?i.document&&Array.from(i.document.querySelectorAll("script")).find((e=>new RegExp(`/${a}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===a)):null,o=import.meta.url,p=t.scriptDataOpts&&(s||{})["data-opts"]||{};return""!==o&&(p.resourcesUrl=new URL(".",o).href),e(p)})().then((async e=>(await p(),o([["p-4891edf0",[[0,"stripe-card-element-modal",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],intentClientSecret:[1,"intent-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],intentType:[1,"intent-type"],handleSubmit:[1040],stripeDidLoaded:[1040],showCloseButton:[4,"show-close-button"],zip:[4],open:[4],getStripeCardElementElement:[64],present:[64],updateProgress:[64],destroy:[64],setPaymentRequestButton:[64]}]]],["p-e7372ca7",[[0,"stripe-payment-sheet",{publishableKey:[1,"publishable-key"],intentClientSecret:[1,"intent-client-secret"],stripeAccount:[1,"stripe-account"],open:[1540],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],applicationName:[1,"application-name"],options:[16],sheet:[32],visible:[32],errorMessage:[32],present:[64]},null,{publishableKey:[{handleSecretChange:0}],intentClientSecret:[{handleSecretChange:0}],stripeAccount:[{handleSecretChange:0}],open:[{handleOpenChange:0}]}]]],["p-f892e375",[[0,"stripe-address-element",{mode:[1],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],defaultCountry:[1,"default-country"],allowedCountries:[16],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],getValue:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-7fe4a287",[[0,"stripe-currency-selector",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],clientSecret:[1,"client-secret"],handleCurrencyChange:[1040],stripeDidLoaded:[1040],initStripe:[64],setErrorMessage:[64],getSelectedCurrency:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-6a9c8b7a",[[0,"stripe-express-checkout-element",{intentType:[1,"intent-type"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],clientSecret:[1,"client-secret"],amount:[2],currency:[1],buttonHeight:[1,"button-height"],shouldUseDefaultConfirmAction:[4,"should-use-default-confirm-action"],stripeDidLoaded:[1040],progress:[32],updateProgress:[64],setErrorMessage:[64],initStripe:[64],updateElementOptions:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-5338bc5e",[[0,"stripe-link-authentication-element",{publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],defaultEmail:[1,"default-email"],handleChange:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],getEmail:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-b91c4fa7",[[0,"stripe-payment-element",{intentType:[1,"intent-type"],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],intentClientSecret:[1,"intent-client-secret"],checkoutSessionClientSecret:[1,"checkout-session-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],initStripe:[64],initStripeWithCheckoutSession:[64],updateProgress:[64],setErrorMessage:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}],intentClientSecret:[{updateIntentClientSecret:0}],checkoutSessionClientSecret:[{updateCheckoutSessionClientSecret:0}]}]]],["p-ba791c8f",[[260,"stripe-payment-request-button",{paymentMethodEventHandler:[16],shippingOptionEventHandler:[16],shippingAddressEventHandler:[16],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],stripeDidLoaded:[1040],loadStripeStatus:[32],stripe:[32],paymentRequestOption:[32],isAvailable:[64],setPaymentMethodEventHandler:[64],setPaymentRequestShippingOptionEventHandler:[64],setPaymentRequestShippingAddressEventHandler:[64],setPaymentRequestOption:[64],initStripe:[64]}]]],["p-b06a254f",[[0,"stripe-card-element",{intentType:[1,"intent-type"],zip:[4],sheetTitle:[1,"sheet-title"],buttonLabel:[1,"button-label"],publishableKey:[1,"publishable-key"],stripeAccount:[1,"stripe-account"],applicationName:[1,"application-name"],showLabel:[4,"show-label"],intentClientSecret:[1,"intent-client-secret"],shouldUseDefaultFormSubmitAction:[4,"should-use-default-form-submit-action"],showPaymentRequestButton:[4,"show-payment-request-button"],handleSubmit:[1040],stripeDidLoaded:[1040],progress:[32],zipCode:[32],paymentRequestOption:[32],initStripe:[64],updateProgress:[64],setErrorMessage:[64],setPaymentRequestOption:[64]},null,{publishableKey:[{updatePublishableKey:0}],stripeAccount:[{updateStripeAccountId:0}]}]]],["p-915b86ed",[[257,"stripe-modal",{showCloseButton:[4,"show-close-button"],open:[1028],renderedOpen:[32],toggleModal:[64],openModal:[64],closeModal:[64]},null,{open:[{onOpenChange:0}]}],[1,"ion-icon",{mode:[1025],color:[1],ios:[1],md:[1],flipRtl:[4,"flip-rtl"],name:[513],src:[1],icon:[8],size:[1],lazy:[4],sanitize:[4],svgContent:[32],isVisible:[32]},null,{name:[{loadIcon:0}],src:[{loadIcon:0}],icon:[{loadIcon:0}],ios:[{loadIcon:0}],md:[{loadIcon:0}]}]]]],e))));
@@ -185,6 +185,12 @@ export declare class StripeAddressElement {
185
185
  private formSubmitEventHandler;
186
186
  componentWillRender(): void;
187
187
  constructor();
188
+ /**
189
+ * Props are not yet populated inside the constructor when the component is registered via
190
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
191
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
192
+ */
193
+ componentWillLoad(): void;
188
194
  /**
189
195
  * Initialize Component using Stripe Address Element
190
196
  */
@@ -147,7 +147,8 @@ export declare class StripeCardElement {
147
147
  */
148
148
  intentClientSecret?: string;
149
149
  /**
150
- * The component will provide a function to call the `stripe.confirmCardPayment`API.
150
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`,
151
+ * `stripe.confirmCardSetup` when it is `'setup'`.
151
152
  * If you want to customize the behavior, should set false.
152
153
  * And listen the 'formSubmit' event on the element
153
154
  */
@@ -254,6 +255,12 @@ export declare class StripeCardElement {
254
255
  */
255
256
  private defaultFormSubmitAction;
256
257
  constructor();
258
+ /**
259
+ * Props are not yet populated inside the constructor when the component is registered via
260
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
261
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
262
+ */
263
+ componentWillLoad(): void;
257
264
  /**
258
265
  * Initialize Component using Stripe Element
259
266
  */
@@ -59,7 +59,8 @@ export declare class StripeCardElementModal {
59
59
  */
60
60
  intentClientSecret?: string;
61
61
  /**
62
- * The component will provide a function to call the `stripe.confirmCardPayment`API.
62
+ * The component will confirm the intent for you: `stripe.confirmCardPayment` when `intentType` is `'payment'`,
63
+ * `stripe.confirmCardSetup` when it is `'setup'`.
63
64
  * If you want to customize the behavior, should set false.
64
65
  * And listen the 'formSubmit' event on the element
65
66
  */
@@ -117,6 +117,12 @@ export declare class StripeCurrencySelector {
117
117
  private currencyChangeEventHandler;
118
118
  componentWillRender(): void;
119
119
  constructor();
120
+ /**
121
+ * Props are not yet populated inside the constructor when the component is registered via
122
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
123
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
124
+ */
125
+ componentWillLoad(): void;
120
126
  /**
121
127
  * Initialize Component using Stripe Currency Selector Element
122
128
  */
@@ -122,6 +122,11 @@ export declare class StripeExpressCheckoutElement {
122
122
  * ```
123
123
  */
124
124
  initStripe(publishableKey: string, options?: InitStripeOptions): Promise<void>;
125
+ /**
126
+ * Options for `stripe.elements()` when there is no client secret.
127
+ * Stripe.js reads mode / amount / currency from the Elements group, not from the element itself.
128
+ */
129
+ private buildElementsOptions;
125
130
  /**
126
131
  * Update element options dynamically
127
132
  * @param options - Partial options to update
@@ -215,6 +220,12 @@ export declare class StripeExpressCheckoutElement {
215
220
  defaultConfirmResult: EventEmitter<DefaultFormSubmitResult>;
216
221
  private defaultConfirmResultHandler;
217
222
  constructor();
223
+ /**
224
+ * Props are not yet populated inside the constructor when the component is registered via
225
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
226
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
227
+ */
228
+ componentWillLoad(): void;
218
229
  componentWillUpdate(): void;
219
230
  /**
220
231
  * Default confirm action
@@ -133,6 +133,12 @@ export declare class StripeLinkAuthenticationElement {
133
133
  private linkAuthenticationChangeEventHandler;
134
134
  componentWillRender(): void;
135
135
  constructor();
136
+ /**
137
+ * Props are not yet populated inside the constructor when the component is registered via
138
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
139
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
140
+ */
141
+ componentWillLoad(): void;
136
142
  /**
137
143
  * Initialize Component using Stripe Element
138
144
  */
@@ -15,6 +15,25 @@ export declare class StripeModal {
15
15
  * Ionic Ref: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/accordion/accordion.tsx#L83
16
16
  */
17
17
  renderedOpen: boolean;
18
+ /**
19
+ * The element that had focus before the modal opened. Focus returns to it when the modal closes.
20
+ */
21
+ private returnFocusElement;
22
+ /**
23
+ * Set when the modal opens; the initial focus is moved after the open state has been rendered.
24
+ */
25
+ private shouldFocusOnRender;
26
+ private dialogElement?;
27
+ private contentElement?;
28
+ private closeButtonElement?;
29
+ /**
30
+ * The last element inside the modal that received focus.
31
+ * `FocusEvent.relatedTarget` is `null` when focus crosses an iframe boundary (e.g. leaving a Stripe Elements field),
32
+ * so the guards fall back to this value to tell which way focus is moving.
33
+ */
34
+ private lastFocusedInside;
35
+ onOpenChange(open: boolean): void;
36
+ private handleKeyDown;
18
37
  /**
19
38
  * Toggle modal state
20
39
  */
@@ -32,6 +51,31 @@ export declare class StripeModal {
32
51
  */
33
52
  close: EventEmitter;
34
53
  componentDidLoad(): void;
54
+ componentDidRender(): void;
55
+ private rememberFocus;
56
+ private restoreFocus;
57
+ private getTabbableElements;
58
+ private isInsideModal;
59
+ /**
60
+ * Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
61
+ * The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
62
+ */
63
+ private handleFocusIn;
64
+ private getFocusOrigin;
65
+ /**
66
+ * Whether focus came from a focusable element inside the modal (not from the container itself or from outside).
67
+ * The guards use it to tell Tab from Shift+Tab: a guard cannot see the key, but it can see where focus came from.
68
+ */
69
+ private cameFromFocusableInside;
70
+ private handleStartGuardFocus;
71
+ private handleEndGuardFocus;
72
+ /**
73
+ * Slotted content is hidden (and therefore not focusable) while the open transition runs.
74
+ * When it ends, move focus from the placeholder (container / close button) into the content, unless the user already moved it.
75
+ */
76
+ private focusContentAfterLoading;
77
+ private focusFirstElement;
78
+ private focusLastElement;
35
79
  private openModalAnimation;
36
80
  render(): any;
37
81
  }
@@ -29,6 +29,7 @@ export declare class StripePaymentElement {
29
29
  private stripeService;
30
30
  private paymentElementManager;
31
31
  private _submitHandler;
32
+ private initGeneration;
32
33
  /**
33
34
  * Default submit handle type.
34
35
  * If you want to use `setupIntent`, should update this attribute.
@@ -285,6 +286,23 @@ export declare class StripePaymentElement {
285
286
  */
286
287
  private checkoutSessionFormSubmitAction;
287
288
  constructor();
289
+ /**
290
+ * Props are not yet populated inside the constructor when the component is registered via
291
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
292
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
293
+ */
294
+ componentWillLoad(): void;
295
+ /**
296
+ * Mount the element once Stripe.js has loaded, unless a newer init call (of either mode) has superseded this one.
297
+ * @param generation - The value of `initGeneration` taken when the init call started
298
+ */
299
+ private mountWhenLoaded;
300
+ private hasCheckoutSessionClientSecret;
301
+ /**
302
+ * Start Stripe.js in the mode that matches the given props.
303
+ * Checkout Session mode when `checkoutSessionClientSecret` is set, PaymentIntent / SetupIntent mode otherwise.
304
+ */
305
+ private startStripe;
288
306
  /**
289
307
  * Initialize Component using Stripe Element
290
308
  */
@@ -6,7 +6,7 @@ import { StripeDidLoadedHandler, StripeLoadedEvent, PaymentRequestShippingAddres
6
6
  * `stripe.paymentRequest()` is being removed in Stripe.js 9.x (deprecated as of 2025-09-30 / 2026-03-25).
7
7
  * Please migrate to `<stripe-express-checkout-element>` which supports Apple Pay, Google Pay, Link, PayPal,
8
8
  * and more via the modern Express Checkout Element API.
9
- * Migration guide: https://hideokamoto.github.io/stripe-pwa-elements/guides/migrate-payment-request-button-to-express-checkout/
9
+ * Migration guide: https://stripe-pwa-elements-docs.wp-kyoto.workers.dev/guides/migrate-payment-request-button-to-express-checkout/
10
10
  */
11
11
  export declare class StripePaymentRequestButton {
12
12
  el: HTMLStripePaymentRequestButtonElement;
@@ -129,7 +129,12 @@ export declare class StripePaymentRequestButton {
129
129
  */
130
130
  stripeLoaded: EventEmitter<StripeLoadedEvent>;
131
131
  private stripeLoadedEventHandler;
132
- constructor();
132
+ /**
133
+ * Props are not yet populated inside the constructor when the component is registered via
134
+ * the custom-elements build (`dist/components/*`), so initialization that depends on them
135
+ * must run in `componentWillLoad`, where both the lazy and custom-elements builds have them set.
136
+ */
137
+ componentWillLoad(): void;
133
138
  connectedCallback(): void;
134
139
  /**
135
140
  * @param option