@leatcom/portal-sessions 0.0.88 → 0.0.89

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.
@@ -1,4 +1,4 @@
1
- (function(vt,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],k):(vt=typeof globalThis<"u"?globalThis:vt||self,k(vt.PortalSessions={},vt.React,vt.ReactDOM))})(this,function(vt,k,qi){"use strict";var MF=Object.defineProperty;var DF=(vt,k,qi)=>k in vt?MF(vt,k,{enumerable:!0,configurable:!0,writable:!0,value:qi}):vt[k]=qi;var lr=(vt,k,qi)=>DF(vt,typeof k!="symbol"?k+"":k,qi);try{let vt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},k=new vt.Error().stack;k&&(vt._sentryDebugIds=vt._sentryDebugIds||{},vt._sentryDebugIds[k]="767720a4-26aa-449f-a9a7-0ae830532161",vt._sentryDebugIdIdentifier="sentry-dbid-767720a4-26aa-449f-a9a7-0ae830532161")}catch{}{let vt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};vt._sentryModuleMetadata=vt._sentryModuleMetadata||{},vt._sentryModuleMetadata[new vt.Error().stack]=Object.assign({},vt._sentryModuleMetadata[new vt.Error().stack],{"_sentryBundlerPluginAppKey:portal-sessions-application-key":!0})}function AE(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}function IE(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ue=AE(k);{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"e24c612af6471868a2ce521779c63040c392d678"}}var $i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nd={exports:{}},Ws={};/**
1
+ (function(vt,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],k):(vt=typeof globalThis<"u"?globalThis:vt||self,k(vt.PortalSessions={},vt.React,vt.ReactDOM))})(this,function(vt,k,qi){"use strict";var MF=Object.defineProperty;var DF=(vt,k,qi)=>k in vt?MF(vt,k,{enumerable:!0,configurable:!0,writable:!0,value:qi}):vt[k]=qi;var lr=(vt,k,qi)=>DF(vt,typeof k!="symbol"?k+"":k,qi);try{let vt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},k=new vt.Error().stack;k&&(vt._sentryDebugIds=vt._sentryDebugIds||{},vt._sentryDebugIds[k]="5f2bd75c-3919-46a2-84c2-d9905172f101",vt._sentryDebugIdIdentifier="sentry-dbid-5f2bd75c-3919-46a2-84c2-d9905172f101")}catch{}{let vt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};vt._sentryModuleMetadata=vt._sentryModuleMetadata||{},vt._sentryModuleMetadata[new vt.Error().stack]=Object.assign({},vt._sentryModuleMetadata[new vt.Error().stack],{"_sentryBundlerPluginAppKey:portal-sessions-application-key":!0})}function AE(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}function IE(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const ue=AE(k);{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"988981503500d18802dab6b3b26107c743338f46"}}var $i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function td(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var nd={exports:{}},Ws={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -154,7 +154,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
154
154
  matrix: null
155
155
  `),t.append(`>>
156
156
  `),t.toString()},e.prototype.setMode=function(t){this.mode=t},e.prototype.setECLevel=function(t){this.ecLevel=t},e.prototype.setVersion=function(t){this.version=t},e.prototype.setMaskPattern=function(t){this.maskPattern=t},e.prototype.setMatrix=function(t){this.matrix=t},e.isValidMaskPattern=function(t){return t>=0&&t<e.NUM_MASK_PATTERNS},e.NUM_MASK_PATTERNS=8,e}(),yB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ji=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return yB(t,e),t.kind="WriterException",t}(or);(function(){function e(){}return e.clearMatrix=function(t){t.clear(255)},e.buildMatrix=function(t,n,r,o,i){e.clearMatrix(i),e.embedBasicPatterns(r,i),e.embedTypeInfo(n,o,i),e.maybeEmbedVersionInfo(r,i),e.embedDataBits(t,o,i)},e.embedBasicPatterns=function(t,n){e.embedPositionDetectionPatternsAndSeparators(n),e.embedDarkDotAtLeftBottomCorner(n),e.maybeEmbedPositionAdjustmentPatterns(t,n),e.embedTimingPatterns(n)},e.embedTypeInfo=function(t,n,r){var o=new ao;e.makeTypeInfoBits(t,n,o);for(var i=0,s=o.getSize();i<s;++i){var a=o.get(o.getSize()-1-i),c=e.TYPE_INFO_COORDINATES[i],u=c[0],d=c[1];if(r.setBoolean(u,d,a),i<8){var h=r.getWidth()-i-1,f=8;r.setBoolean(h,f,a)}else h=8,f=r.getHeight()-7+(i-8),r.setBoolean(h,f,a)}},e.maybeEmbedVersionInfo=function(t,n){if(!(t.getVersionNumber()<7)){var r=new ao;e.makeVersionInfoBits(t,r);for(var o=17,i=0;i<6;++i)for(var s=0;s<3;++s){var a=r.get(o);o--,n.setBoolean(i,n.getHeight()-11+s,a),n.setBoolean(n.getHeight()-11+s,i,a)}}},e.embedDataBits=function(t,n,r){for(var o=0,i=-1,s=r.getWidth()-1,a=r.getHeight()-1;s>0;){for(s===6&&(s-=1);a>=0&&a<r.getHeight();){for(var c=0;c<2;++c){var u=s-c;if(e.isEmpty(r.get(u,a))){var d=void 0;o<t.getSize()?(d=t.get(o),++o):d=!1,n!==255&&mB.getDataMaskBit(n,u,a)&&(d=!d),r.setBoolean(u,a,d)}}a+=i}a+=i=-i,s-=2}if(o!==t.getSize())throw new ji("Not all bits consumed: "+o+"/"+t.getSize())},e.findMSBSet=function(t){return 32-Rn.numberOfLeadingZeros(t)},e.calculateBCHCode=function(t,n){if(n===0)throw new Ge("0 polynomial");var r=e.findMSBSet(n);for(t<<=r-1;e.findMSBSet(t)>=r;)t^=n<<e.findMSBSet(t)-r;return t},e.makeTypeInfoBits=function(t,n,r){if(!gB.isValidMaskPattern(n))throw new ji("Invalid mask pattern");var o=t.getBits()<<3|n;r.appendBits(o,5);var i=e.calculateBCHCode(o,e.TYPE_INFO_POLY);r.appendBits(i,10);var s=new ao;if(s.appendBits(e.TYPE_INFO_MASK_PATTERN,15),r.xor(s),r.getSize()!==15)throw new ji("should not happen but we got: "+r.getSize())},e.makeVersionInfoBits=function(t,n){n.appendBits(t.getVersionNumber(),6);var r=e.calculateBCHCode(t.getVersionNumber(),e.VERSION_INFO_POLY);if(n.appendBits(r,12),n.getSize()!==18)throw new ji("should not happen but we got: "+n.getSize())},e.isEmpty=function(t){return t===255},e.embedTimingPatterns=function(t){for(var n=8;n<t.getWidth()-8;++n){var r=(n+1)%2;e.isEmpty(t.get(n,6))&&t.setNumber(n,6,r),e.isEmpty(t.get(6,n))&&t.setNumber(6,n,r)}},e.embedDarkDotAtLeftBottomCorner=function(t){if(t.get(8,t.getHeight()-8)===0)throw new ji;t.setNumber(8,t.getHeight()-8,1)},e.embedHorizontalSeparationPattern=function(t,n,r){for(var o=0;o<8;++o){if(!e.isEmpty(r.get(t+o,n)))throw new ji;r.setNumber(t+o,n,0)}},e.embedVerticalSeparationPattern=function(t,n,r){for(var o=0;o<7;++o){if(!e.isEmpty(r.get(t,n+o)))throw new ji;r.setNumber(t,n+o,0)}},e.embedPositionAdjustmentPattern=function(t,n,r){for(var o=0;o<5;++o)for(var i=e.POSITION_ADJUSTMENT_PATTERN[o],s=0;s<5;++s)r.setNumber(t+s,n+o,i[s])},e.embedPositionDetectionPattern=function(t,n,r){for(var o=0;o<7;++o)for(var i=e.POSITION_DETECTION_PATTERN[o],s=0;s<7;++s)r.setNumber(t+s,n+o,i[s])},e.embedPositionDetectionPatternsAndSeparators=function(t){var n=e.POSITION_DETECTION_PATTERN[0].length;e.embedPositionDetectionPattern(0,0,t),e.embedPositionDetectionPattern(t.getWidth()-n,0,t),e.embedPositionDetectionPattern(0,t.getWidth()-n,t),e.embedHorizontalSeparationPattern(0,7,t),e.embedHorizontalSeparationPattern(t.getWidth()-8,7,t),e.embedHorizontalSeparationPattern(0,t.getWidth()-8,t),e.embedVerticalSeparationPattern(7,0,t),e.embedVerticalSeparationPattern(t.getHeight()-7-1,0,t),e.embedVerticalSeparationPattern(7,t.getHeight()-7,t)},e.maybeEmbedPositionAdjustmentPatterns=function(t,n){if(!(t.getVersionNumber()<2))for(var r=t.getVersionNumber()-1,o=e.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r],i=0,s=o.length;i!==s;i++){var a=o[i];if(a>=0)for(var c=0;c!==s;c++){var u=o[c];u>=0&&e.isEmpty(n.get(u,a))&&e.embedPositionAdjustmentPattern(u-2,a-2,n)}}},e.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),e.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),e.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),e.VERSION_INFO_POLY=7973,e.TYPE_INFO_POLY=1335,e.TYPE_INFO_MASK_PATTERN=21522,e})(),function(){Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),ir.UTF8.getName()}();var vB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o,i,s,a,c,u){var d=e.call(this,a,c)||this;if(d.yuvData=n,d.dataWidth=r,d.dataHeight=o,d.left=i,d.top=s,i+a>r||s+c>o)throw new Ge("Crop rectangle does not fit within image data.");return u&&d.reverseHorizontal(a,c),d}vB(t,e),t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ht.arraycopy(this.yuvData,i,r,0,o),r},t.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.yuvData;var o=n*r,i=new Uint8ClampedArray(o),s=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ht.arraycopy(this.yuvData,s,i,0,o),i;for(var a=0;a<r;a++){var c=a*n;Ht.arraycopy(this.yuvData,s,i,c,n),s+=this.dataWidth}return i},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return new t(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,o,i,!1)},t.prototype.renderThumbnail=function(){for(var n=this.getWidth()/t.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/t.THUMBNAIL_SCALE_FACTOR,o=new Int32Array(n*r),i=this.yuvData,s=this.top*this.dataWidth+this.left,a=0;a<r;a++){for(var c=a*n,u=0;u<n;u++){var d=255&i[s+u*t.THUMBNAIL_SCALE_FACTOR];o[c+u]=4278190080|65793*d}s+=this.dataWidth*t.THUMBNAIL_SCALE_FACTOR}return o},t.prototype.getThumbnailWidth=function(){return this.getWidth()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.getThumbnailHeight=function(){return this.getHeight()/t.THUMBNAIL_SCALE_FACTOR},t.prototype.reverseHorizontal=function(n,r){for(var o=this.yuvData,i=0,s=this.top*this.dataWidth+this.left;i<r;i++,s+=this.dataWidth)for(var a=s+n/2,c=s,u=s+n-1;c<a;c++,u--){var d=o[c];o[c]=o[u],o[u]=d}},t.prototype.invert=function(){return new Al(this)},t.THUMBNAIL_SCALE_FACTOR=2})(oc);var wB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o,i,s,a,c){var u=e.call(this,r,o)||this;if(u.dataWidth=i,u.dataHeight=s,u.left=a,u.top=c,n.BYTES_PER_ELEMENT===4){for(var d=r*o,h=new Uint8ClampedArray(d),f=0;f<d;f++){var p=n[f],l=p>>16&255,m=p>>7&510,g=255&p;h[f]=(l+m+g)/4&255}u.luminances=h}else u.luminances=n;if(i===void 0&&(u.dataWidth=r),s===void 0&&(u.dataHeight=o),a===void 0&&(u.left=0),c===void 0&&(u.top=0),u.left+r>u.dataWidth||u.top+o>u.dataHeight)throw new Ge("Crop rectangle does not fit within image data.");return u}wB(t,e),t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth();(r==null||r.length<o)&&(r=new Uint8ClampedArray(o));var i=(n+this.top)*this.dataWidth+this.left;return Ht.arraycopy(this.luminances,i,r,0,o),r},t.prototype.getMatrix=function(){var n=this.getWidth(),r=this.getHeight();if(n===this.dataWidth&&r===this.dataHeight)return this.luminances;var o=n*r,i=new Uint8ClampedArray(o),s=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ht.arraycopy(this.luminances,s,i,0,o),i;for(var a=0;a<r;a++){var c=a*n;Ht.arraycopy(this.luminances,s,i,c,n),s+=this.dataWidth}return i},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return new t(this.luminances,o,i,this.dataWidth,this.dataHeight,this.left+n,this.top+r)},t.prototype.invert=function(){return new Al(this)}})(oc);var bB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(){return e!==null&&e.apply(this,arguments)||this}bB(t,e),t.forName=function(n){return this.getCharacterSetECIByName(n)}})(ir);var EB=function(){function e(t){this.previous=t}return e.prototype.getPrevious=function(){return this.previous},e}(),CB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),vb=function(e){function t(n,r,o){var i=e.call(this,n)||this;return i.value=r,i.bitCount=o,i}return CB(t,e),t.prototype.appendTo=function(n,r){n.appendBits(this.value,this.bitCount)},t.prototype.add=function(n,r){return new t(this,n,r)},t.prototype.addBinaryShift=function(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new t(this,n,r)},t.prototype.toString=function(){var n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+Rn.toBinaryString(n|1<<this.bitCount).substring(1)+">"},t}(EB),_B=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r,o){var i=e.call(this,n,0,0)||this;return i.binaryShiftStart=r,i.binaryShiftByteCount=o,i}_B(t,e),t.prototype.appendTo=function(n,r){for(var o=0;o<this.binaryShiftByteCount;o++)(o===0||o===31&&this.binaryShiftByteCount<=62)&&(n.appendBits(31,5),this.binaryShiftByteCount>62?n.appendBits(this.binaryShiftByteCount-31,16):o===0?n.appendBits(Math.min(this.binaryShiftByteCount,31),5):n.appendBits(this.binaryShiftByteCount-31,5)),n.appendBits(r[this.binaryShiftStart+o],8)},t.prototype.addBinaryShift=function(n,r){return new t(this,n,r)},t.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}})(vb),new vb(null,0,0);var SB=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(e){var t,n;try{for(var r=SB(e),o=r.next();!o.done;o=r.next()){var i=o.value;wr.fill(i,-1)}}catch(s){t={error:s}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}e[0][4]=0,e[1][4]=0,e[1][0]=28,e[3][4]=0,e[2][4]=0,e[2][0]=15})(wr.createInt32Array(6,6)),function(e){var t=Sn.getCharCode(" "),n=Sn.getCharCode("."),r=Sn.getCharCode(",");e[0][t]=1;for(var o=Sn.getCharCode("Z"),i=Sn.getCharCode("A"),s=i;s<=o;s++)e[0][s]=s-i+2;e[1][t]=1;var a=Sn.getCharCode("z"),c=Sn.getCharCode("a");for(s=c;s<=a;s++)e[1][s]=s-c+2;e[2][t]=1;var u=Sn.getCharCode("9"),d=Sn.getCharCode("0");for(s=d;s<=u;s++)e[2][s]=s-d+2;e[2][r]=12,e[2][n]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
157
- `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)e[3][Sn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)Sn.getCharCode(p[f])>0&&(e[4][Sn.getCharCode(p[f])]=f)}(wr.createInt32Array(5,256));var AB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),IB=function(e){function t(n){var r=e.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=t.makeBufferFromCanvasImageData(n),r}return AB(t,e),t.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return t.toGrayscaleBuffer(o.data,n.width,n.height)},t.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),s=0,a=0,c=n.length;s<c;s+=4,a++){var u=void 0;n[s+3]===0?u=255:u=306*n[s]+601*n[s+1]+117*n[s+2]+512>>10,i[a]=u}return i},t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return e.prototype.crop.call(this,n,r,o,i),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new Al(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},t.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*t.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*s),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*s);r.width=a,r.height=c;var u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(a/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,s/-2),this.buffer=t.makeBufferFromCanvasImageData(r),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(oc);function wb(){return typeof navigator<"u"}function TB(){return!!(wb()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var Us=function(){return Us=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Us.apply(this,arguments)},en=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(u){try{c(r.next(u))}catch(d){i(d)}}function a(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(s,a)}c((r=r.apply(e,[])).next())})},tn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},Vl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xB={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Hs=function(){function e(t,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=t,this.hints=n,this.options=Us(Us({},xB),r)}return Object.defineProperty(e.prototype,"possibleFormats",{set:function(t){this.hints.set(Ft.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),e.addVideoSource=function(t,n){try{t.srcObject=n}catch{t.src=URL.createObjectURL(n)}},e.mediaStreamSetTorch=function(t,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},e.mediaStreamIsTorchCompatible=function(t){var n,r,o=t.getVideoTracks();try{for(var i=Vl(o),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.mediaStreamIsTorchCompatibleTrack(a))return!0}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.mediaStreamIsTorchCompatibleTrack=function(t){try{return"torch"in t.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},e.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},e.getMediaElement=function(t,n){var r=document.getElementById(t);if(!r)throw new Zt("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Zt("element with id '"+t+"' must be an "+n+" element");return r},e.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return e.getMediaElement(t,"video");if(!t&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},e.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return e.getMediaElement(t,"img");if(t===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},e.prepareVideoElement=function(t){var n=e.createVideoElement(t);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},e.isImageLoaded=function(t){return!!t.complete&&t.naturalWidth!==0},e.createBinaryBitmapFromCanvas=function(t){var n=new IB(t),r=new Fw(n);return new Dw(r)},e.drawImageOnCanvas=function(t,n){t.drawImage(n,0,0)},e.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimentions!")},e.createCaptureCanvas=function(t){if(!t)throw new Zt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=e.getMediaElementDimensions(t),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},e.tryPlayVideo=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(t!=null&&t.ended)return console.error("Trying to play video that has ended."),[2,!1];if(e.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},e.createCanvasFromMediaElement=function(t){var n=e.createCaptureCanvas(t),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return e.drawImageOnCanvas(r,t),n},e.createBinaryBitmapFromMediaElem=function(t){var n=e.createCanvasFromMediaElement(t);return e.createBinaryBitmapFromCanvas(n)},e.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},e.listVideoInputDevices=function(){return en(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,d,h,f;return tn(this,function(p){switch(p.label){case 0:if(!wb())throw new Error("Can't enumerate devices, navigator is not present.");if(!TB())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=p.sent(),n=[];try{for(r=Vl(t),o=r.next();!o.done;o=r.next())i=o.value,(s=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(a=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),u=i.groupId,d={deviceId:a,label:c,kind:s,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},e.findDeviceById=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:return[4,e.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===t})]:[2]}})})},e.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},e.playVideoOnLoadAsync=function(t,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,e.tryPlayVideo(t)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var s=setTimeout(function(){e.isVideoPlaying(t)||(i(!1),t.removeEventListener("canplay",a))},n),a=function(){e.tryPlayVideo(t).then(function(c){clearTimeout(s),t.removeEventListener("canplay",a),o(c)})};t.addEventListener("canplay",a)})]}})})},e.attachStreamToVideo=function(t,n,r){return r===void 0&&(r=5e3),en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return o=e.prepareVideoElement(n),e.addVideoSource(o,t),[4,e.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},e._waitImageLoad=function(t){return new Promise(function(n,r){var o=setTimeout(function(){e.isImageLoaded(t)||(t.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),t.removeEventListener("load",i),n()};t.addEventListener("load",i)})},e.checkCallbackFnOrThrow=function(t){if(!t)throw new Zt("`callbackFn` is a required parameter, you cannot capture results without it.")},e.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(n){return n.stop()}),t=void 0},e.prototype.decode=function(t){var n=e.createCanvasFromMediaElement(t);return this.decodeFromCanvas(n)},e.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},e.prototype.decodeFromCanvas=function(t){var n=e.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(n)},e.prototype.decodeFromImageElement=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!t)throw new Zt("An image element must be provided.");return n=e.prepareImageElement(t),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},e.prototype.decodeFromImageUrl=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!t)throw new Zt("An URL must be provided.");(n=e.prepareImageElement()).src=t,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return e.destroyImageElement(n),[7];case 4:return[2]}})})},e.prototype.decodeFromConstraints=function(t,n,r){return en(this,void 0,void 0,function(){var o,i;return tn(this,function(s){switch(s.label){case 0:return e.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(t)];case 1:o=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,s.sent()];case 4:throw i=s.sent(),e.disposeMediaStream(o),i;case 5:return[2]}})})},e.prototype.decodeFromStream=function(t,n,r){return en(this,void 0,void 0,function(){var o,i,s,a,c,u,d,h,f,p,l=this;return tn(this,function(m){switch(m.label){case 0:return e.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,e.attachStreamToVideo(t,n,o)];case 1:return i=m.sent(),s=function(){var g,y;try{for(var v=Vl(t.getVideoTracks()),b=v.next();!b.done;b=v.next())b.value.stop()}catch(E){g={error:E}}finally{try{b&&!b.done&&(y=v.return)&&y.call(v)}finally{if(g)throw g.error}}t=void 0},a=function(){s(),e.cleanVideoSource(i)},c=this.scan(i,r,a),u=t.getVideoTracks(),d=Us(Us({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(g,y){return en(this,void 0,void 0,function(){var v,b,E,C,A,T;return tn(this,function(x){switch(x.label){case 0:v=y?u.filter(y):u,x.label=1;case 1:x.trys.push([1,6,7,8]),b=Vl(v),E=b.next(),x.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(g)];case 3:x.sent(),x.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=x.sent(),A={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(A)throw A.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(g){return u.find(g).getConstraints()},streamVideoSettingsGet:function(g){return u.find(g).getSettings()},streamVideoCapabilitiesGet:function(g){return u.find(g).getCapabilities()}}),e.mediaStreamIsTorchCompatible(t)&&(h=u==null?void 0:u.find(function(g){return e.mediaStreamIsTorchCompatibleTrack(g)}),f=function(g){return en(l,void 0,void 0,function(){return tn(this,function(y){switch(y.label){case 0:return[4,e.mediaStreamSetTorch(h,g)];case 1:return y.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},e.prototype.decodeFromVideoDevice=function(t,n,r){return en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return e.checkCallbackFnOrThrow(r),o={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},e.prototype.decodeFromVideoElement=function(t,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Zt("A video element must be provided.");return r=e.prepareVideoElement(t),o=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},e.prototype.decodeFromVideoUrl=function(t,n){return en(this,void 0,void 0,function(){var r,o,i;return tn(this,function(s){switch(s.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Zt("An URL must be provided.");return(r=e.prepareVideoElement()).src=t,o=function(){e.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,i)];case 1:return s.sent(),[2,this.scan(r,n,o)]}})})},e.prototype.decodeOnceFromConstraints=function(t,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromStream=function(t,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:return r=!!n,[4,e.attachStreamToVideo(t,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||e.cleanVideoSource(o),[7];case 5:return[2]}})})},e.prototype.decodeOnceFromVideoDevice=function(t,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return r={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoElement=function(t){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!t)throw new Zt("A video element must be provided.");return n=e.prepareVideoElement(t),r=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoUrl=function(t){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!t)throw new Zt("An URL must be provided.");(n=e.prepareVideoElement()).src=t,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return e.cleanVideoSource(n),[7];case 4:return[2]}})})},e.prototype.scanOneResult=function(t,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(s,a){i.scan(t,function(c,u,d){if(c)return s(c),void d.stop();if(u){if(u instanceof ge&&n||u instanceof yn&&r||u instanceof xe&&o)return;d.stop(),a(u)}})})},e.prototype.scan=function(t,n,r){var o=this;e.checkCallbackFnOrThrow(n);var i=e.createCaptureCanvas(t),s=i.getContext("2d");if(!s)throw new Error("Couldn't create canvas for visual element scan.");var a,c=function(){s=void 0,i=void 0},u=!1,d={stop:function(){u=!0,clearTimeout(a),c(),r&&r()}},h=function(){if(!u)try{e.drawImageOnCanvas(s,t);var f=o.decodeFromCanvas(i);n(f,void 0,d),a=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof yn||p instanceof xe||p instanceof ge)return void(a=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},e.prototype._decodeOnLoadImage=function(t){return en(this,void 0,void 0,function(){return tn(this,function(n){switch(n.label){case 0:return e.isImageLoaded(t)?[3,2]:[4,e._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},e}(),kB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new kl,n,r)||this}kB(t,e)})(Hs);var OB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new js(n),n,r)||this}OB(t,e)})(Hs);var PB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new Ml,n,r)||this}PB(t,e)})(Hs);var RB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){var o=this,i=new gb;return i.setHints(n),(o=e.call(this,i,n,r)||this).reader=i,o}RB(t,e),Object.defineProperty(t.prototype,"possibleFormats",{set:function(n){this.hints.set(Ft.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},t.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(Hs);var NB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new jl,n,r)||this}NB(t,e)})(Hs);var BB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),MB=function(e){function t(n,r){return e.call(this,new Fl,n,r)||this}return BB(t,e),t}(Hs),Ul=function(e,t,n){var r=typeof e===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(t,'" to be a of type "').concat(n,'".')),r},DB=function(e){var t=e.scanDelay,n=e.constraints,r=e.onResult,o=e.videoId,i=k.useRef(null);k.useEffect(function(){var s=new MB(null,{delayBetweenScanAttempts:t});return!function(){var a=typeof navigator<"u"&&!!navigator.mediaDevices;return a||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a}()&&Ul(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s),Ul(n,"constraints","object")&&s.decodeFromConstraints({video:n},o,function(a,c){Ul(r,"onResult","function")&&r(a,c,s)}).then(function(a){return i.current=a}).catch(function(a){Ul(r,"onResult","function")&&r(null,a,s)}),function(){var a;(a=i.current)===null||a===void 0||a.stop()}},[])},Vi=function(){return Vi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vi.apply(this,arguments)},bb={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},xp=function(e){var t=e.videoContainerStyle,n=e.containerStyle,r=e.videoStyle,o=e.constraints,i=e.ViewFinder,s=e.scanDelay,a=e.className,c=e.onResult,u=e.videoId;return DB({constraints:o,scanDelay:s,onResult:c,videoId:u}),ue.createElement("section",{className:a,style:n},ue.createElement("div",{style:Vi(Vi({},bb.container),t)},!!i&&ue.createElement(i,null),ue.createElement("video",{muted:!0,id:u,style:Vi(Vi(Vi({},bb.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};xp.displayName="QrReader",xp.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function LB({onScan:e}){const{cameraFacingMode:t}=gn(),[n,r]=k.useState(t??Zn.USER);return w.jsxs("div",{className:"relative w-full",children:[w.jsx(xp,{onResult:o=>{o&&e(o.getText())},constraints:{facingMode:n},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER),children:w.jsx("img",{src:dp,alt:"camera-switch"})})]})}class ot{constructor(t,n,r,o,i){this._legacyCanvasSize=ot.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let s=!1;if(t.hidden&&(t.hidden=!1,s=!0),document.body.contains(t)||(document.body.appendChild(t),s=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let a=window.getComputedStyle(t);a.display==="none"&&(t.style.setProperty("display","block","important"),s=!0),a.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),s=!0),s&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=ot.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await ot.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),ot._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),ot._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),ot._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?ot._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(ot._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,i=!1,s=!1){let a,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(a=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,s=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||s?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let u,d;[r,u]=await Promise.all([r||ot.createQrEngine(),ot._loadImage(t)]),[o,d]=ot._drawToCanvas(u,a,o,i);let h;if(r instanceof Worker){let f=r;n||ot._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let m,g,y,v=-1;g=E=>{E.data.id===v&&(f.removeEventListener("message",g),f.removeEventListener("error",y),clearTimeout(m),E.data.data!==null?p({data:E.data.data,cornerPoints:ot._convertPoints(E.data.cornerPoints,a)}):l(ot.NO_QR_CODE_FOUND))},y=E=>{f.removeEventListener("message",g),f.removeEventListener("error",y),clearTimeout(m),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",g),f.addEventListener("error",y),m=setTimeout(()=>y("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);v=ot._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw ot.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:ot._convertPoints(f.cornerPoints,a)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return ot._disableBarcodeDetector=!0,ot.scanImage(t,{scanRegion:a,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:s});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!a||!s)throw u;let d=await ot.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||ot._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){ot._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){ot._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>Promise.resolve().then(()=>ND).then(r=>r.createWorker()),!(!ot._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,i=t.offsetHeight,s=t.offsetLeft,a=t.offsetTop,c=window.getComputedStyle(t),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,m]=c.objectPosition.split(" ").map((y,v)=>{const b=parseFloat(y);return y.endsWith("%")?(v?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var g=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${a+m+g/r*p}px`,r=/scaleX\(-1\)/.test(t.style.transform),d.left=`${s+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let s of t)s.x=s.x*i+r,s.y=s.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await ot.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!ot._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=ot.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==ot.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),s=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:s}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,s=n&&n.y?n.y:0,a=n&&n.width?n.width:t.videoWidth||t.width,c=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:a,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,i,s,a,c,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await ot._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await ot._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{t.removeEventListener("load",o),t.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return ot._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let i=ot._workerMessageId++;return t.postMessage({id:i,type:n,data:r},o),i}}ot.DEFAULT_CANVAS_SIZE=400,ot.NO_QR_CODE_FOUND="No QR code found",ot._disableBarcodeDetector=!1,ot._workerMessageId=0;function FB({onScan:e}){const{cameraFacingMode:t}=gn(),[n,r]=k.useState(t),o=k.useRef(),i=k.useRef(null),[s,a]=k.useState(!0),c=d=>{e(d==null?void 0:d.data)},u=d=>{};return k.useEffect(()=>{var d;return i!=null&&i.current&&!o.current&&(o.current=new ot(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(d=o==null?void 0:o.current)==null||d.start().then(()=>a(!0)).catch(h=>{h&&a(!1)})),()=>{var h;i!=null&&i.current||(h=o==null?void 0:o.current)==null||h.stop()}},[]),k.useEffect(()=>{s||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[s]),w.jsxs("div",{className:"relative",children:[w.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var h;const d=n===Zn.USER?Zn.ENVIRONMENT:Zn.USER;r(d),(h=o==null?void 0:o.current)==null||h.setCamera(d)},children:w.jsx("img",{src:dp,alt:"camera-switch"})})]})}function Gs({data:e,dataSetter:t,setDefer:n,label:r=""}){const o=k.useRef(null),i=MP(),[s,a]=Ax()??[0,0],{subscribe:c,unsubscribe:u}=Da(),{cameraService:d}=gn(),h=p=>{t(p)};k.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const p=l=>{t(l.detail.code)};return c("onCodeScan",p),()=>{u("onCodeScan",p)}},[a]);const f=()=>{switch(+d){case 1:return w.jsx(Mw,{onScan:h});case 2:return w.jsx(FB,{onScan:h});case 3:return w.jsx(LB,{onScan:h});default:return w.jsx(Mw,{onScan:h})}};return w.jsxs("div",{ref:o,children:[!!i.length&&w.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[f(),w.jsx("hr",{})]}),w.jsx(Oi,{label:r,value:e,autoFocus:!0,placeholder:"CDE2341S",onChange:p=>{n&&n(!0),t(p.target.value)}})]})}function jB(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),d=on(),h=qt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);t(e("unknownCode",{code:o}))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{o&&!s&&f()},[o]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"code"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:f,children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:a,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function VB(){const{hash:e}=_o();return w.jsx(kr,{to:`${je.GIFTCARD}/select/${e}`})}function UB(){const{identifierValue:e}=_o(),{errorToast:t}=Kt(),{uuid:n,mutate:r}=He(),{onContactLink:o}=gn(),[i,s]=k.useState(!1),a=qt(),c=d=>a.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{a.put(n,{contact_identifier_value:e}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>s(!0))}).catch(t)};return k.useEffect(()=>{u()},[]),i?w.jsx(kr,{to:`${je.PORTAL}/overview`}):w.jsx(Fr,{})}function Eb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/vouchers/${e}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:s}}function HB(){const{t:e}=$e(),{code:t}=_o(),{voucher:n}=Eb(t),{portalSession:r}=He(),[o,i]=k.useState(!1),[s,a]=k.useState(!1),c=on(),u=()=>{n!=null&&n.contact||r.contact?i(!0):a(!0)};return k.useEffect(()=>{n&&u()},[n]),n?w.jsxs(w.Fragment,{children:[o?w.jsx(kr,{to:`${je.VOUCHER}/${n.code}/redeem`}):w.jsx(Fr,{}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:s,onClose:()=>a(!1),primaryAction:{label:e("linkToContact"),action:()=>c(`${je.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>a(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:n.code})})})]}):w.jsx(Fr,{})}function Hl({redirectRoute:e}){const{state:t}=yr(),{t:n}=$e(),{errorToast:r}=Kt(),{onContactLink:o}=gn(),{portalSession:i,mutate:s}=He(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=on(),m=qt(),g=b=>m.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),m.put(i.uuid,{email:c}).then(b=>{o&&g(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),s().then(()=>l(e))}).catch(b=>{b.response.data.code===jc.CONTACT_NOT_FOUND&&p(!0)}).finally(()=>h(!1))},v=()=>{h(!0),m.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return k.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>c&&!d&&y(),children:w.jsx(Oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>u(b.target.value),beforeIcon:"mail"})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:d}),w.jsx(dt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>l("../identifier",{state:t})})]})})]})}),w.jsx(ni,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:v,disabled:d},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function GB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/*",element:w.jsx(jB,{})}),w.jsx(Je,{path:"/giftcard/:hash",element:w.jsx(VB,{})}),w.jsx(Je,{path:"/identifier/:identifierValue",element:w.jsx(UB,{})}),w.jsx(Je,{path:"/voucher/:code",element:w.jsx(HB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})})]})}const qB={[rn.GIFTCARD]:`${je.GIFTCARD}/select`,[rn.REDEEM_GIFTCARD]:`${je.GIFTCARD}/redeem`,[rn.TOP_UP_GIFTCARD]:`${je.GIFTCARD}/top-up`};function $B(){const{t:e}=$e(),{portalSession:t}=He(),{errorToast:n}=Kt(),[r,o]=k.useState(""),[i,s]=k.useState(!1),[a,c]=k.useState(!1),u=qt(),d=on(),h=()=>{s(!0),u.get(`${t.uuid}/giftcards/${r}`).then(f=>{const p=t.type;d(`${qB[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>s(!1))};return k.useEffect(()=>{!a&&r&&h()},[r]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanGiftcard")})})}),w.jsx(Vt,{children:w.jsx(Gs,{data:r,dataSetter:o,setDefer:c,label:e("hash")})}),w.jsx(mn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function WB(){const{t:e}=$e(),{hash:t}=_o(),n=on();return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("chooseType")})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:e("redeem"),onClick:()=>n(`${je.GIFTCARD}/redeem/${t}`)}),w.jsx(dt,{className:"grow",label:e("topUp"),onClick:()=>n(`${je.GIFTCARD}/top-up/${t}`)})]})})]})})}function Cb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/giftcards/${e}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:s}}function dc(){const{mutate:e}=He();return{get:()=>e().then(r=>r.data.data.events),post:()=>{e().then(r=>{OC(r.data.data.events)})}}}function YB(){const{t:e}=$e(),{errorToast:t}=Kt(),{hash:n}=_o(),{giftcard:r,mutate:o}=Cb(n),{portalSession:i,mutate:s}=He(),{onUseGiftcard:a}=gn(),{post:c}=dc(),[u]=k.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=k.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=on(),l=qt(),m=()=>{h(!0),l.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-g()}).then(E=>{o(),s(),c(),a==null||a(E.data.data)}).catch(t).finally(()=>h(!1))},g=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,v=()=>{let E=0;return i.events.filter(A=>A.type===Fo.GIFTCARD_TRANSACTION).forEach(A=>{A.data.giftcard.uuid===r.uuid&&(E+=A.data.amount_in_cents)}),E},b=()=>{if(g())return{label:e("confirmAndPay",{amount:Qi(g(),i.currency)}),onClick:m};if(f&&y())return{label:e("useAnotherGiftcard"),onClick:()=>p(je.GIFTCARD),variant:"secondary"}};return r?w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:`${e("giftcard")} ${r.hash}`})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("balance")}),w.jsx(ti,{value:r.amount_in_cents,start:r.amount_in_cents-v(),currency:i.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u+v(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&w.jsx(mn,{children:w.jsx(dt,{label:"",className:"w-full",...b(),pending:d})})]})}):w.jsx(Fr,{})}function zB({value:e,valueSetter:t,enabled:n}){const[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef(null);k.useEffect(()=>{u(e?e.toString():"")},[]);const a=d=>{t(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(e===0&&!/^[1-9]$/.test(h)||e!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(e===0?h:`${e}${h}`);else{const p=e.toString().slice(0,-1);f=p.length?parseInt(p,10):0}t(f),u(f?f.toString():"")},u=d=>{s&&s.current&&(d?s.current.style.width=`${Math.max(d.length,3)*3}rem`:s.current.style.width="calc(3rem + 14px)")};return w.jsxs(w.Fragment,{children:[w.jsx("input",{ref:s,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:e?(e/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&w.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:w.jsx($y,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:a})})]})}function _b({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),[s,a]=k.useState(0),{portalSession:c}=He(),u=()=>{let d=0;return c.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return w.jsxs($t,{children:[e&&w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t??0,start:t??0,currency:c.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:u()?w.jsx(ti,{value:0,start:s,currency:c.currency,asCurrency:!0}):w.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[w.jsx("p",{children:kC(c.currency)}),w.jsx(zB,{value:s,valueSetter:a,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(s,c.currency)}),className:"w-full",onClick:r&&(()=>r(s)),disabled:!s||!!u(),pending:o})})]})}function KB(){const{t:e}=$e(),{errorToast:t}=Kt(),{hash:n}=_o(),{giftcard:r,mutate:o}=Cb(n),{portalSession:i,mutate:s}=He(),{post:a}=dc(),{onUseGiftcard:c}=gn(),[u,d]=k.useState(!1),h=qt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),s(),a(),c==null||c(l.data.data),xt.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${Qi(l.data.data.amount_in_cents,i.currency)}`)}).catch(t).finally(()=>d(!1))};return r?w.jsx(Fn,{children:w.jsx(_b,{title:`${e("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):w.jsx(Fr,{})}function XB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx($B,{})}),w.jsx(Je,{path:"/select/:hash",element:w.jsx(WB,{})}),w.jsx(Je,{path:"/redeem/:hash",element:w.jsx(YB,{})}),w.jsx(Je,{path:"/top-up/:hash",element:w.jsx(KB,{})})]})}class kp{constructor(){lr(this,"uuid");lr(this,"email");lr(this,"credit_balance");lr(this,"prepaid_balance");lr(this,"current_display_values")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.current_display_values.email}}const Sb=k.createContext({contact:new kp,mutate:async()=>{}});function Op({children:e}){const{uuid:t}=He(),[n,r]=k.useState(new kp),{mutate:o}=_r({url:`${t}/contacts`,onData:s=>{const a=new kp;a.uuid=s.uuid,a.email=s.email,a.credit_balance=s.credit_balance,a.prepaid_balance=s.prepaid_balance,a.current_display_values=s.current_display_values,r(a)}}),i=k.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?w.jsx(Sb.Provider,{value:i,children:e}):w.jsx(Fr,{})}function Er(){const e=k.useContext(Sb);if(!e)throw new Error("Only use 'useContactContext' within a ContactProvider");return e}function Gl({message:e=""}){return w.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[w.jsx(Hd,{className:"h-[32px] w-[32px]"}),e&&w.jsx("p",{className:"text-sm",children:e})]})}function QB(){const{t:e}=$e(),{errorToast:t}=Kt(),{contact:n,mutate:r}=Er(),{uuid:o,portalSession:i,mutate:s}=He(),a=qt(),c=()=>{a.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),s()}).catch(t)},u=()=>{const d=i.events.filter(h=>h.type===Fo.CREDIT_RECEPTION);return d.length?d[0]:null};return k.useEffect(()=>{u()||c()},[]),w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n.getDisplayName()})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?w.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:u()?w.jsxs(w.Fragment,{children:["+",w.jsx(ti,{value:u().data.credits,start:0})]}):w.jsx(Gl,{})}):w.jsx("p",{className:"text-core-red-500",children:e("xIsRequired",{x:"Amount in cents"})+"."})}),w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:`${e("new")} ${e("balance").toLowerCase()}`}),w.jsx(ti,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function JB(){const{portalSession:e}=He();return e.contact?w.jsx(Op,{children:w.jsx(QB,{})}):e.inputData.primary_identification_method&&e.inputData.primary_identification_method===zi.EMAIL?w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/email`}):w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/identifier`})}function Pp({redirectRoute:e}){const{t}=$e(),{state:n}=yr(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=gn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt();k.useEffect(()=>{!d&&s&&l()},[s]);const l=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(g=>{i&&m(g.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(e,{state:{contactIdentifier:s}}))}).catch(()=>f("link",{state:{contactIdentifier:s}})).finally(()=>u(!1))},m=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g});return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>s&&l(),children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:t("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:t("continue"),onClick:l,disabled:!s,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Rp({redirectRoute:e}){const{t}=$e(),{errorToast:n}=Kt(),{uuid:r,mutate:o}=He(),{onContactLink:i}=gn(),{state:s}=yr(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=on(),m=qt();if(!s||!s.contactIdentifier)return w.jsx(kr,{to:"../"});const g=()=>{h(!0),m.post(`${r}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:c}).then(v).catch(E=>{E.response.data.code===jc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},y=()=>{h(!0),m.post(`${r}/contacts`,{email:c}).then(g).catch(n).finally(()=>h(!1))},v=()=>{m.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>l(e))}).catch(n).finally(()=>h(!1))},b=E=>m.get(`${r}/contacts`,{contact_uuid:E});return k.useEffect(()=>{a("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),w.jsxs(Fn,{children:[w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:t("linkContact")})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx(bx,{body:t("noEmailAddressLinkedToIdentifier")}),w.jsx(Ni,{onSubmit:g,children:w.jsx(Oi,{id:"new-contact-identifier-input",label:t("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:t("continue"),className:"w-full",onClick:g,disabled:!c||d})})]}),w.jsx(ni,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:t("confirm"),action:y,loading:d},secondaryAction:{label:t("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:t("continueWithEmail",{email:c})})})]})}function ZB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(JB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.POINTS_TRANSACTION})})]})}function eM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=gn();return e.contact?w.jsx(kr,{to:`${je.PORTAL}/overview`}):t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PORTAL}/email`}):w.jsx(kr,{to:`${je.PORTAL}/identifier`})}function tM({children:e}){return w.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:w.jsx("div",{className:"h-full max-h-full",children:e})})}function nM({contact:e}){const{t}=$e(),n=on();return w.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Ih,{src:e.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-2",children:[w.jsx("p",{className:"text-lg",children:e.getDisplayName()}),e.current_display_values.tier&&w.jsx(Th,{label:e.current_display_values.tier,size:"sm",stroke:!0})]}),w.jsx("p",{className:"text-sm text-core-gray-500 ",children:t("joinedAtDate",{date:new Date(e.current_display_values.created_at).toLocaleDateString(dn.language,{month:"long",year:"numeric"})})})]})]}),w.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[w.jsx(dt,{label:t("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),w.jsx(dt,{before:w.jsx(Pn,{icon:"edit"}),label:t("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function fc({children:e}){return w.jsx("div",{className:"flex-grow rounded-lg border p-4",children:e})}function rM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:t.current_display_values.loyalty_balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:Qi(t.prepaid_balance.balance_in_cents,n.currency)}),w.jsx("p",{className:"text-sm text-core-gray-500",children:e("prepaidCredit")})]})})]})}function oM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He(),r=(o,i)=>x0(o,i)?`${x0(o,i)} ${e("yearsAgo")}`:T0(o,i)?`${T0(o,i)} ${e("weeksAgo")}`:I0(o,i)?`${I0(o,i)} ${e("daysAgo")}`:e("today");return w.jsx(fc,{children:w.jsxs("div",{className:"h-full justify-between",children:[w.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:"Stats"}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"calendar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(t.current_display_values.loyalty_last_transaction_date))}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("lastVisit")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"shopping-bag"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_number_of_transactions} ${e("visits")}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalVisits")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"dollar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalCredits")})]})]})]})]})})}function Ab(){const{uuid:e}=He(),[t,n]=k.useState([]),{data:r,isLoading:o,pending:i,mutate:s}=_r({url:`${e}/loyalty-transactions`});return k.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:t,isLoading:o,pending:i,mutate:s}}function Ib({loyaltyTransaction:e}){const{t}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs text-core-gray-500",children:e.type===f0.CREDIT_RECEPTION?t("transaction"):`${t("isRedeemed")} '${e.loyalty_transaction_data.title}'`}),w.jsx("p",{className:"text-xs font-semibold",children:e.credits>0?"+"+e.credits:e.credits})]})}function iM(){const{t:e}=$e(),t=on(),{loyaltyTransactions:n}=Ab();return n?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("activities")}),n&&n.length?w.jsx("div",{children:n.slice(0,5).map(r=>w.jsx(Ib,{loyaltyTransaction:r},r.uuid))}):w.jsx("p",{className:"text-sm text-core-gray-500",children:e("noActivity")})]}),w.jsx(dt,{label:`${e("all")} ${e("activities").toLowerCase()}`,variant:"secondary",onClick:()=>t("activity")})]})}):w.jsx(Gl,{})}function Tb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/subscriptions/contact`,onData:n});return{subscriptions:t,isLoading:r,pending:o,mutate:i}}function xb({subscription:e,onChange:t,editable:n=!1}){const{t:r}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs font-semibold",children:e.subscription_type.name}),n?w.jsx(sp,{defaultChecked:e.is_subscribed,disabled:e.subscription_type.strategy===h0.FUNCTIONAL,onChange:t&&(()=>t(e.subscription_type.name))}):w.jsx(Th,{label:r(e.status.toLowerCase()),size:"sm",color:e.is_subscribed?"primary":"gray"})]})}function sM(){const{t:e}=$e(),{subscriptions:t}=Tb(),n=on();return t?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("subscriptions")}),w.jsx("div",{children:t.map(r=>w.jsx(xb,{subscription:r},r.subscription_type.uuid))})]}),w.jsx(dt,{label:e("change"),before:w.jsx(Pn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):w.jsx(Gl,{})}function aM(){const{contact:e}=Er();return w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(nM,{contact:e})}),w.jsx(Vt,{children:w.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[w.jsx(rM,{}),w.jsx(oM,{}),w.jsx(iM,{}),w.jsx(sM,{})]})})]})}function hc({label:e,path:t}){const n=on();return w.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:w.jsx(dt,{label:e,variant:"link-gray",before:w.jsx(Pn,{icon:"caret-left",size:"md"}),onClick:()=>n(t)})})}function cM(){const{t:e}=$e(),{loyaltyTransactions:t}=Ab(),{contact:n}=Er();return w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsx("p",{className:"text-sm font-medium",children:e("allActivities")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),w.jsx("div",{className:"overflow-auto",children:t==null?void 0:t.map(r=>w.jsx(Ib,{loyaltyTransaction:r},r.uuid))})]})})]})})}function uM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{subscriptions:r,mutate:o}=Tb(),[i,s]=k.useState({}),[a,c]=k.useState(!1),u=qt();k.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,m)=>({...l,[m.subscription_type.name]:m.is_subscribed}),{});s(p)}},[]);const d=p=>{Object.hasOwn(i,p)?s({...i,[p]:!i[p]}):s({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(t).finally(()=>c(!1))},f=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("subscriptions")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("manageEmailPreferences")}),r.map(p=>w.jsx(xb,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:h,pending:a,disabled:!f()||a})})]})}):w.jsx(Gl,{})}function lM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contact:r,mutate:o}=Er(),[i,s]=k.useState(),[a,c]=k.useState(!1),[u,d]=k.useState(),h=qt();_r({url:`${n}/contact-attributes`,onData:m=>s(m.elements)});const f=m=>{d({...u,[m.target.name]:m.target.value})},p=(m,g)=>{d({...u,[m]:g})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(t).finally(()=>c(!1))};return w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[w.jsx(Ih,{src:r.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{children:[w.jsx("div",{className:"flex flex-row items-center gap-2 ",children:w.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),w.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(m=>{if(!(m.type==="media_upload"||m.type==="email"))return m.type==="select"?w.jsx(Bx,{name:m.name,label:m.label,value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],onChange:g=>p(m.name,g),disabled:m.disabled,children:m.options.map(g=>w.jsx(kh,{label:g.label,value:g.value},g.value))},m.id):m.type==="multi_select"?w.jsx(Ox,{name:m.name,value:u&&u[m.name]?u[m.name]:m.defaultValue,label:m.label,onChange:p,disabled:m.disabled,options:m.options},m.id):m.type==="birth_date"||m.type==="date_time"?w.jsx(Yy,{id:m.id,name:m.name,label:m.label,type:m.type==="date_time"?"date_time":"date",value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],disabled:m.disabled,onChange:f},m.id):w.jsx(Oi,{disabled:m.disabled,label:m.label,name:m.name,value:u&&u[m.name]!=="undefined"?u[m.name]:r.current_display_values[m.name],onChange:f},m.id)}):w.jsx(vl,{rows:10})]})}),w.jsx(mn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:a})})]})})}function kb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/contact-identifiers`,onData:n});return{contactIdentifiers:t,isLoading:r,pending:o,mutate:i}}function dM({identifier:e,onClear:t}){const{t:n}=$e();return w.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[w.jsxs("div",{className:"flex-col pl-4",children:[w.jsx("p",{className:"font-semibold",children:e.value}),w.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),w.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>t&&t(e.value),children:w.jsx(Pn,{className:"h-full",icon:"close"})})]})}function fM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contactIdentifiers:r,isLoading:o,mutate:i}=kb(),[s,a]=k.useState(""),[c,u]=k.useState(!1),d=on(),h=qt(),f=l=>{a(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:s}).then(()=>i()).catch(t).finally(()=>u(!1))};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("contactIdentifiers")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("contactIdentifierDescription")})]}),o?w.jsx(vl,{rows:10}):r==null?void 0:r.map(l=>w.jsx(dM,{identifier:l,onClear:f},l.value))]})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),w.jsx(ni,{title:e("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:e("confirm"),action:p},secondaryAction:{label:e("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:w.jsx("p",{children:e("clearContactIdentifier",{value:s})})})]})}function hM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contact:r}=Er(),{mutate:o}=kb(),[i,s]=k.useState(""),[a,c]=k.useState(!1),[u,d]=k.useState(!1),h=on(),f=qt(),p=()=>{c(!0),f.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(t).finally(()=>{s(""),c(!1)})};return k.useEffect(()=>{!u&&i&&p()},[i]),w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile/contact-identifiers"})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>i&&p(),children:w.jsx(Gs,{data:i,dataSetter:s,setDefer:d,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",onClick:p,pending:a,disabled:!i})})]})})}function pM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/profile",element:w.jsx(aM,{})}),w.jsx(Je,{path:"/profile/activity",element:w.jsx(cM,{})}),w.jsx(Je,{path:"/profile/subscriptions",element:w.jsx(uM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers",element:w.jsx(fM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers/create",element:w.jsx(hM,{})}),w.jsx(Je,{path:"/profile/contact-attributes",element:w.jsx(lM,{})})]})}function mM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex h-16 items-center justify-between",children:[w.jsx("h1",{children:e("rewards")}),w.jsxs("div",{className:"flex flex-col items-center",children:[w.jsx("p",{children:t.credit_balance.balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function Ob(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/rewards`,onData:n});return{rewards:t,isLoading:r,pending:o,mutate:i}}function Np({reward:e,selected:t,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=He(),{contact:s}=Er();return w.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[w.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(t==null?void 0:t.uuid)===e.uuid?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.media&&e.media.value?e.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:e.title??e.description})]}),w.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[e.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),e.required_credits-s.credit_balance.balance>0&&w.jsx(Px,{value:s.credit_balance.balance,max:e.required_credits})]})}function gM({selected:e,setSelected:t}){const{t:n}=$e(),{contact:r}=Er(),{rewards:o,isLoading:i}=Ob(),s=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),a=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return w.jsx(w.Fragment,{children:i?w.jsx(vl,{rows:1}):w.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[w.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),s.map(c=>w.jsx(Np,{reward:c,selected:e,setSelected:t},c.uuid))]})}),w.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),a.map(c=>w.jsx(Np,{reward:c,selected:e,setSelected:t,disabled:!0},c.uuid))]})})]})})}function yM(){const{portalSession:e}=He(),{rewards:t}=Ob(),n=()=>e.events.filter(r=>r.type===Fo.REWARD_RECEPTION).map(r=>t.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return t?w.jsx("div",{children:w.jsx(Xv,{children:n().map((r,o)=>w.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:r.title??r.description})]}),w.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",e.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):w.jsx(w.Fragment,{})}function vM(){const{t:e}=$e(),{errorToast:t,successToast:n}=Kt(),{portalSession:r,mutate:o}=He(),{mutate:i}=Er(),{onClaimReward:s}=gn(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),{post:p}=dc(),l=qt();k.useEffect(()=>{a&&f(!0)},[a]);const m=y=>{o().then(v=>{const E=v.data.data.events.filter(C=>C.type===Fo.REWARD_RECEPTION&&C.data.reward.uuid===a.uuid).reduce((C,A)=>new Date(C.created_at)>new Date(A.created_at)?C:A);s==null||s(y,E.data.uuid)})},g=()=>{d(!0),l.post(`${r.uuid}/rewards/claim`,{uuid:a.uuid}).then(y=>{p(),i(),m(y.data.data),n(e("rewardClaimed",{name:y.data.data.title}))}).catch(t).finally(()=>{f(!1),c(void 0),d(!1)})};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(mM,{})}),w.jsx(Vt,{children:w.jsx(gM,{selected:a,setSelected:c})}),w.jsx(mn,{children:w.jsx(yM,{})})]}),w.jsx(ni,{title:e("confirmRewardRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:g,loading:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:w.jsx("div",{className:"flex flex-col gap-4",children:a&&w.jsx(Np,{reward:a,selected:a,setSelected:c,readOnly:!0})})})]})}function Bp(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/vouchers`,onData:n});return{vouchers:t,isLoading:r,pending:o,mutate:i}}function wM(){const{t:e}=$e();return w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("vouchers")})})}function Mp({voucher:e,selected:t,setSelected:n}){const{t:r}=$e();return w.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${e.status===oa.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(t==null?void 0:t.code)===e.code?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.promotion.image?e.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[w.jsx("p",{className:"font-semibold",children:e.name}),e.status===oa.REDEEMED?w.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):w.jsx("p",{className:"text-core-primary-500",children:e.expiration_date?`Valid until ${new Date(e.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),w.jsx("p",{className:`text-core-${e.status===oa.REDEEMED?"gray":"primary"}-500`,children:e.code})]})}function bM({selected:e,setSelected:t}){const{t:n}=$e(),{vouchers:r,isLoading:o}=Bp();return w.jsx(w.Fragment,{children:o?w.jsx(vl,{rows:1}):w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>w.jsx(Mp,{voucher:i,selected:e,setSelected:t},i.code)):w.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function EM(){const{t:e}=$e(),{portalSession:t}=He(),{vouchers:n}=Bp(),r=()=>t.events.filter(o=>o.type===Fo.VOUCHER_REDEEMED);return n?w.jsx("div",{children:w.jsx(Xv,{children:r().map((o,i)=>w.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:w.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:w.jsxs("div",{className:"overflow-hidden",children:[w.jsx("p",{className:"font-semibold",children:o.data.name}),w.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",e("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):w.jsx(w.Fragment,{})}function CM(){const{t:e}=$e(),{errorToast:t,successToast:n}=Kt(),{uuid:r}=He(),{onRedeemVoucher:o}=gn(),{post:i}=dc(),{mutate:s}=Bp(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=qt();k.useEffect(()=>{a&&f(!0)},[a]);const l=()=>{d(!0),p.post(`${r}/vouchers/redeem`,{code:a.code}).then(g=>{i(),o&&o(g.data.data),n(e("voucherSuccessfullyRedeemed")),s()}).catch(t).finally(()=>{m(),d(!1)})},m=()=>{f(!1),c(void 0)};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(wM,{})}),w.jsx(Vt,{children:w.jsx(bM,{selected:a,setSelected:c})}),w.jsx(mn,{children:w.jsx(EM,{})})]}),w.jsx(ni,{title:e("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:l,loading:u},secondaryAction:{label:e("cancel"),action:m},onClose:m,children:w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{children:e("redeemTitle",{title:a==null?void 0:a.name})}),a&&w.jsx(Mp,{voucher:a,setSelected:c})]})})]})}function _M(){const{t:e}=$e(),[t,n]=k.useState(1),r=on(),o=[{id:0,label:e("profile"),icon:"user",pathname:"profile"},{id:1,label:e("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:e("vouchers"),icon:"mail",pathname:"vouchers"}];return k.useEffect(()=>{r(o[t].pathname)},[]),w.jsx(Op,{children:w.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[w.jsx(uO,{children:o.map(i=>w.jsx(lO,{id:i.id,label:i.label,icon:i.icon,activeTab:t,setActiveTab:n,pathname:i.pathname},i.id))}),w.jsxs(tM,{children:[w.jsx(pM,{}),w.jsxs(So,{children:[w.jsx(Je,{path:"/rewards",element:w.jsx(vM,{})}),w.jsx(Je,{path:"/vouchers",element:w.jsx(CM,{})})]})]})]})})}function SM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(eM,{})}),w.jsx(Je,{path:"/overview/*",element:w.jsx(_M,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.PORTAL})})]})}function Pb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/prepaid`,onData:n});return{prepaidBalance:t,isLoading:r,pending:o,mutate:i}}function AM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=Kt(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=gn(),{prepaidBalance:c,mutate:u}=Pb(),[d,h]=k.useState(!1),f=qt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(_b,{title:s.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function IM({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),{portalSession:s}=He(),a=s.inputData.amount_in_cents??0,c=()=>{let d=0;return s.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(a+c(),t);return w.jsxs($t,{children:[e&&w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t,start:t+c(),currency:s.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u(),start:a,currency:s.currency,asCurrency:!0})})]})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(u(),s.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!a||!!c(),pending:o})})]})}function TM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=Kt(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=gn(),{prepaidBalance:c,mutate:u}=Pb(),[d,h]=k.useState(!1),f=qt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(IM,{title:s.getDisplayName(),balance:c.balance_in_cents,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function xM({setType:e}){const{t}=$e();return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("Choose type")})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:t("pay"),onClick:()=>e(rn.PAY_PREPAID)}),w.jsx(dt,{className:"grow",label:t("topUp"),onClick:()=>e(rn.TOP_UP_PREPAID)})]})})]})})}function kM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=gn(),[n,r]=k.useState(e.type);if(!e.contact)return t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PREPAID}/email`}):w.jsx(kr,{to:`${je.PREPAID}/identifier`});const o=()=>n===rn.TOP_UP_PREPAID?w.jsx(AM,{}):n===rn.PAY_PREPAID?w.jsx(TM,{}):w.jsx(xM,{setType:r});return w.jsx(Op,{children:o()})}function OM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(kM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.PREPAID})})]})}function PM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt(),l=()=>{a(!0),p.get(`${n}/vouchers/check/${o}`).then(m=>{m.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(t).finally(()=>a(!1))};return k.useEffect(()=>{!c&&o&&l()},[o]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:e("voucherCode").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:u,label:e("code")})}),w.jsx(mn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:l,pending:s})})]})}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:o})})})]})}function RM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{uuid:r}=He(),{onRedeemVoucher:o}=gn(),{post:i}=dc(),{voucher:s,mutate:a}=Eb(n),[c,u]=k.useState(!1),d=qt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),a()}).catch(t).finally(()=>u(!1))};return s?w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:"Voucher"})})}),w.jsx(Vt,{children:w.jsx("div",{children:w.jsx(Mp,{voucher:s,setSelected:()=>{}})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("redeemVoucher"),className:"w-full",onClick:h,disabled:s.status!==oa.ACTIVE||c,pending:c})})]})}):w.jsx(Fr,{})}function NM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=gn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt(),l=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g}),m=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(g=>{i&&l(g.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(`${je.VOUCHER}/${n}/redeem`))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{!d&&s&&m()},[s]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:m,children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:m,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function BM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{onContactLink:r}=gn(),{portalSession:o,mutate:i}=He(),{publish:s}=Da(),[a,c]=k.useState(""),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=on(),l=qt(),m=v=>l.get(`${o.uuid}/contacts`,{contact_uuid:v}),g=()=>{d(!0),l.put(o.uuid,{email:a}).then(v=>{r&&m(v.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${je.VOUCHER}/${n}/redeem`))}).catch(v=>{v.response.data.code===jc.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},y=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:a}).then(g).catch(t).finally(()=>d(!1))};return k.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("fillInXBelow",{x:e("emailAddress").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>a&&!u&&g(),children:w.jsx(Oi,{id:"via-email-address-input",label:e("emailAddress"),autoFocus:!0,onChange:v=>c(v.target.value),beforeIcon:"mail"})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),className:"w-full",onClick:g,pending:u,disabled:!a||u}),w.jsx(dt,{label:e("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),w.jsx(ni,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:e("confirm"),action:y,disabled:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},children:w.jsx("p",{children:e("continueWithEmail",{email:a})})})]})}function MM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(PM,{})}),w.jsx(Je,{path:":code/redeem",element:w.jsx(RM,{})}),w.jsx(Je,{path:":code/email",element:w.jsx(BM,{})}),w.jsx(Je,{path:":code/identifier",element:w.jsx(NM,{})})]})}function DM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(lx,{})}),w.jsx(Je,{path:`${je.GENERIC}/*`,element:w.jsx(GB,{})}),w.jsx(Je,{path:`${je.GIFTCARD}/*`,element:w.jsx(XB,{})}),w.jsx(Je,{path:`${je.POINTS_TRANSACTION}/*`,element:w.jsx(ZB,{})}),w.jsx(Je,{path:`${je.PORTAL}/*`,element:w.jsx(SM,{})}),w.jsx(Je,{path:`${je.PREPAID}/*`,element:w.jsx(OM,{})}),w.jsx(Je,{path:`${je.VOUCHER}/*`,element:w.jsx(MM,{})})]})}function LM(){const{t:e}=$e(),[t,n]=k.useState(!1);return w.jsx("div",{className:"default-bg-colors flex h-screen items-center justify-center",children:w.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 bg-white shadow-lg",children:[w.jsx("div",{className:"border-b border-gray-200 bg-gray-50 px-6 pb-3 pt-4 shadow",children:w.jsx("h2",{className:"text-3xl",children:"Oops!"})}),w.jsx("p",{className:"mt-4 px-6 text-gray-900",children:e("sorrySomethingWentWrong")}),w.jsx("div",{className:"mt-10 p-6",children:w.jsx(dt,{onClick:()=>{n(!0),window.location.replace("/")},pending:t,label:e("back")})})]})})}function Dp(e){"@babel/helpers - typeof";return Dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dp(e)}function Rb(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Dp(XMLHttpRequest))==="object"}function FM(e){return!!e&&typeof e.then=="function"}function jM(e){return FM(e)?e:Promise.resolve(e)}function VM(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lp={exports:{}},ql={exports:{}},Nb;function UM(){return Nb||(Nb=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof $i<"u"&&$i,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof a<"u"&&a,c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(P){return P&&DataView.prototype.isPrototypeOf(P)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(P){return P&&d.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function p(P){return typeof P!="string"&&(P=String(P)),P}function l(P){var V={next:function(){var z=P.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function m(P){this.map={},P instanceof m?P.forEach(function(V,z){this.append(z,V)},this):Array.isArray(P)?P.forEach(function(V){this.append(V[0],V[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(V){this.append(V,P[V])},this)}m.prototype.append=function(P,V){P=f(P),V=p(V);var z=this.map[P];this.map[P]=z?z+", "+V:V},m.prototype.delete=function(P){delete this.map[f(P)]},m.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},m.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},m.prototype.set=function(P,V){this.map[f(P)]=p(V)},m.prototype.forEach=function(P,V){for(var z in this.map)this.map.hasOwnProperty(z)&&P.call(V,this.map[z],z,this)},m.prototype.keys=function(){var P=[];return this.forEach(function(V,z){P.push(z)}),l(P)},m.prototype.values=function(){var P=[];return this.forEach(function(V){P.push(V)}),l(P)},m.prototype.entries=function(){var P=[];return this.forEach(function(V,z){P.push([z,V])}),l(P)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function g(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function y(P){return new Promise(function(V,z){P.onload=function(){V(P.result)},P.onerror=function(){z(P.error)}})}function v(P){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(P),z}function b(P){var V=new FileReader,z=y(V);return V.readAsText(P),z}function E(P){for(var V=new Uint8Array(P),z=new Array(V.length),X=0;X<V.length;X++)z[X]=String.fromCharCode(V[X]);return z.join("")}function C(P){if(P.slice)return P.slice(0);var V=new Uint8Array(P.byteLength);return V.set(new Uint8Array(P)),V.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:c.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:c.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():c.arrayBuffer&&c.blob&&u(P)?(this._bodyArrayBuffer=C(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||h(P))?this._bodyArrayBuffer=C(P):this._bodyText=P=Object.prototype.toString.call(P):this._bodyText="",this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var P=g(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=g(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var P=g(this);if(P)return P;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function x(P){var V=P.toUpperCase();return T.indexOf(V)>-1?V:P}function R(P,V){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(P instanceof R){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,V.headers||(this.headers=new m(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!z&&P._bodyInit!=null&&(z=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new m(V.headers)),this.method=x(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var X=/([?&])_=[^&]*/;if(X.test(this.url))this.url=this.url.replace(X,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function B(P){var V=new FormData;return P.trim().split("&").forEach(function(z){if(z){var X=z.split("="),re=X.shift().replace(/\+/g," "),oe=X.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(oe))}}),V}function F(P){var V=new m,z=P.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(X){return X.indexOf(`
157
+ `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)e[3][Sn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)Sn.getCharCode(p[f])>0&&(e[4][Sn.getCharCode(p[f])]=f)}(wr.createInt32Array(5,256));var AB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),IB=function(e){function t(n){var r=e.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=t.makeBufferFromCanvasImageData(n),r}return AB(t,e),t.makeBufferFromCanvasImageData=function(n){var r=n.getContext("2d");if(!r)throw new Error("Couldn't get canvas context.");var o=r.getImageData(0,0,n.width,n.height);return t.toGrayscaleBuffer(o.data,n.width,n.height)},t.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),s=0,a=0,c=n.length;s<c;s+=4,a++){var u=void 0;n[s+3]===0?u=255:u=306*n[s]+601*n[s+1]+117*n[s+2]+512>>10,i[a]=u}return i},t.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ge("Requested row is outside the image: "+n);var o=this.getWidth(),i=n*o;return r===null?r=this.buffer.slice(i,i+o):(r.length<o&&(r=new Uint8ClampedArray(o)),r.set(this.buffer.slice(i,i+o))),r},t.prototype.getMatrix=function(){return this.buffer},t.prototype.isCropSupported=function(){return!0},t.prototype.crop=function(n,r,o,i){return e.prototype.crop.call(this,n,r,o,i),this},t.prototype.isRotateSupported=function(){return!0},t.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},t.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},t.prototype.invert=function(){return new Al(this)},t.prototype.getTempCanvasElement=function(){if(this.tempCanvasElement===null){var n=this.canvas.ownerDocument.createElement("canvas");n.width=this.canvas.width,n.height=this.canvas.height,this.tempCanvasElement=n}return this.tempCanvasElement},t.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*t.DEGREE_TO_RADIANS,i=this.canvas.width,s=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*s),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*s);r.width=a,r.height=c;var u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(a/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,s/-2),this.buffer=t.makeBufferFromCanvasImageData(r),this},t.DEGREE_TO_RADIANS=Math.PI/180,t}(oc);function wb(){return typeof navigator<"u"}function TB(){return!!(wb()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var Us=function(){return Us=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Us.apply(this,arguments)},en=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(u){try{c(r.next(u))}catch(d){i(d)}}function a(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(s,a)}c((r=r.apply(e,[])).next())})},tn=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(c){return function(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){s=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){s.label=d[1];break}if(d[0]===6&&s.label<o[1]){s.label=o[1],o=d;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(d);break}o[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},Vl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xB={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},Hs=function(){function e(t,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=t,this.hints=n,this.options=Us(Us({},xB),r)}return Object.defineProperty(e.prototype,"possibleFormats",{set:function(t){this.hints.set(Ft.POSSIBLE_FORMATS,t)},enumerable:!1,configurable:!0}),e.addVideoSource=function(t,n){try{t.srcObject=n}catch{t.src=URL.createObjectURL(n)}},e.mediaStreamSetTorch=function(t,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,t.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},e.mediaStreamIsTorchCompatible=function(t){var n,r,o=t.getVideoTracks();try{for(var i=Vl(o),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.mediaStreamIsTorchCompatibleTrack(a))return!0}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},e.mediaStreamIsTorchCompatibleTrack=function(t){try{return"torch"in t.getCapabilities()}catch(n){return console.error(n),console.warn("Your browser may be not fully compatible with WebRTC and/or ImageCapture specs. Torch will not be available."),!1}},e.isVideoPlaying=function(t){return t.currentTime>0&&!t.paused&&t.readyState>2},e.getMediaElement=function(t,n){var r=document.getElementById(t);if(!r)throw new Zt("element with id '"+t+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Zt("element with id '"+t+"' must be an "+n+" element");return r},e.createVideoElement=function(t){if(t instanceof HTMLVideoElement)return t;if(typeof t=="string")return e.getMediaElement(t,"video");if(!t&&typeof document<"u"){var n=document.createElement("video");return n.width=200,n.height=200,n}throw new Error("Couldn't get videoElement from videoSource!")},e.prepareImageElement=function(t){if(t instanceof HTMLImageElement)return t;if(typeof t=="string")return e.getMediaElement(t,"img");if(t===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},e.prepareVideoElement=function(t){var n=e.createVideoElement(t);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},e.isImageLoaded=function(t){return!!t.complete&&t.naturalWidth!==0},e.createBinaryBitmapFromCanvas=function(t){var n=new IB(t),r=new Fw(n);return new Dw(r)},e.drawImageOnCanvas=function(t,n){t.drawImage(n,0,0)},e.getMediaElementDimensions=function(t){if(t instanceof HTMLVideoElement)return{height:t.videoHeight,width:t.videoWidth};if(t instanceof HTMLImageElement)return{height:t.naturalHeight||t.height,width:t.naturalWidth||t.width};throw new Error("Couldn't find the Source's dimentions!")},e.createCaptureCanvas=function(t){if(!t)throw new Zt("Cannot create a capture canvas without a media element.");if(typeof document>"u")throw new Error(`The page "Document" is undefined, make sure you're running in a browser.`);var n=document.createElement("canvas"),r=e.getMediaElementDimensions(t),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},e.tryPlayVideo=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(t!=null&&t.ended)return console.error("Trying to play video that has ended."),[2,!1];if(e.isVideoPlaying(t))return console.warn("Trying to play video that is already playing."),[2,!0];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t.play()];case 2:return r.sent(),[2,!0];case 3:return n=r.sent(),console.warn("It was not possible to play the video.",n),[2,!1];case 4:return[2]}})})},e.createCanvasFromMediaElement=function(t){var n=e.createCaptureCanvas(t),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return e.drawImageOnCanvas(r,t),n},e.createBinaryBitmapFromMediaElem=function(t){var n=e.createCanvasFromMediaElement(t);return e.createBinaryBitmapFromCanvas(n)},e.destroyImageElement=function(t){t.src="",t.removeAttribute("src"),t=void 0},e.listVideoInputDevices=function(){return en(this,void 0,void 0,function(){var t,n,r,o,i,s,a,c,u,d,h,f;return tn(this,function(p){switch(p.label){case 0:if(!wb())throw new Error("Can't enumerate devices, navigator is not present.");if(!TB())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:t=p.sent(),n=[];try{for(r=Vl(t),o=r.next();!o.done;o=r.next())i=o.value,(s=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(a=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),u=i.groupId,d={deviceId:a,label:c,kind:s,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},e.findDeviceById=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:return[4,e.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===t})]:[2]}})})},e.cleanVideoSource=function(t){if(t){try{t.srcObject=null}catch{t.src=""}t&&t.removeAttribute("src")}},e.playVideoOnLoadAsync=function(t,n){return en(this,void 0,void 0,function(){return tn(this,function(r){switch(r.label){case 0:return[4,e.tryPlayVideo(t)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var s=setTimeout(function(){e.isVideoPlaying(t)||(i(!1),t.removeEventListener("canplay",a))},n),a=function(){e.tryPlayVideo(t).then(function(c){clearTimeout(s),t.removeEventListener("canplay",a),o(c)})};t.addEventListener("canplay",a)})]}})})},e.attachStreamToVideo=function(t,n,r){return r===void 0&&(r=5e3),en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return o=e.prepareVideoElement(n),e.addVideoSource(o,t),[4,e.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},e._waitImageLoad=function(t){return new Promise(function(n,r){var o=setTimeout(function(){e.isImageLoaded(t)||(t.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),t.removeEventListener("load",i),n()};t.addEventListener("load",i)})},e.checkCallbackFnOrThrow=function(t){if(!t)throw new Zt("`callbackFn` is a required parameter, you cannot capture results without it.")},e.disposeMediaStream=function(t){t.getVideoTracks().forEach(function(n){return n.stop()}),t=void 0},e.prototype.decode=function(t){var n=e.createCanvasFromMediaElement(t);return this.decodeFromCanvas(n)},e.prototype.decodeBitmap=function(t){return this.reader.decode(t,this.hints)},e.prototype.decodeFromCanvas=function(t){var n=e.createBinaryBitmapFromCanvas(t);return this.decodeBitmap(n)},e.prototype.decodeFromImageElement=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!t)throw new Zt("An image element must be provided.");return n=e.prepareImageElement(t),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},e.prototype.decodeFromImageUrl=function(t){return en(this,void 0,void 0,function(){var n;return tn(this,function(r){switch(r.label){case 0:if(!t)throw new Zt("An URL must be provided.");(n=e.prepareImageElement()).src=t,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.decodeFromImageElement(n)];case 2:return[2,r.sent()];case 3:return e.destroyImageElement(n),[7];case 4:return[2]}})})},e.prototype.decodeFromConstraints=function(t,n,r){return en(this,void 0,void 0,function(){var o,i;return tn(this,function(s){switch(s.label){case 0:return e.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(t)];case 1:o=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,s.sent()];case 4:throw i=s.sent(),e.disposeMediaStream(o),i;case 5:return[2]}})})},e.prototype.decodeFromStream=function(t,n,r){return en(this,void 0,void 0,function(){var o,i,s,a,c,u,d,h,f,p,l=this;return tn(this,function(m){switch(m.label){case 0:return e.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,e.attachStreamToVideo(t,n,o)];case 1:return i=m.sent(),s=function(){var g,y;try{for(var v=Vl(t.getVideoTracks()),b=v.next();!b.done;b=v.next())b.value.stop()}catch(E){g={error:E}}finally{try{b&&!b.done&&(y=v.return)&&y.call(v)}finally{if(g)throw g.error}}t=void 0},a=function(){s(),e.cleanVideoSource(i)},c=this.scan(i,r,a),u=t.getVideoTracks(),d=Us(Us({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(g,y){return en(this,void 0,void 0,function(){var v,b,E,C,A,T;return tn(this,function(x){switch(x.label){case 0:v=y?u.filter(y):u,x.label=1;case 1:x.trys.push([1,6,7,8]),b=Vl(v),E=b.next(),x.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(g)];case 3:x.sent(),x.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=x.sent(),A={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(A)throw A.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(g){return u.find(g).getConstraints()},streamVideoSettingsGet:function(g){return u.find(g).getSettings()},streamVideoCapabilitiesGet:function(g){return u.find(g).getCapabilities()}}),e.mediaStreamIsTorchCompatible(t)&&(h=u==null?void 0:u.find(function(g){return e.mediaStreamIsTorchCompatibleTrack(g)}),f=function(g){return en(l,void 0,void 0,function(){return tn(this,function(y){switch(y.label){case 0:return[4,e.mediaStreamSetTorch(h,g)];case 1:return y.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},e.prototype.decodeFromVideoDevice=function(t,n,r){return en(this,void 0,void 0,function(){var o;return tn(this,function(i){switch(i.label){case 0:return e.checkCallbackFnOrThrow(r),o={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},e.prototype.decodeFromVideoElement=function(t,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Zt("A video element must be provided.");return r=e.prepareVideoElement(t),o=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},e.prototype.decodeFromVideoUrl=function(t,n){return en(this,void 0,void 0,function(){var r,o,i;return tn(this,function(s){switch(s.label){case 0:if(e.checkCallbackFnOrThrow(n),!t)throw new Zt("An URL must be provided.");return(r=e.prepareVideoElement()).src=t,o=function(){e.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(r,i)];case 1:return s.sent(),[2,this.scan(r,n,o)]}})})},e.prototype.decodeOnceFromConstraints=function(t,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(t)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromStream=function(t,n){return en(this,void 0,void 0,function(){var r,o;return tn(this,function(i){switch(i.label){case 0:return r=!!n,[4,e.attachStreamToVideo(t,n)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,this.scanOneResult(o)];case 3:return[2,i.sent()];case 4:return r||e.cleanVideoSource(o),[7];case 5:return[2]}})})},e.prototype.decodeOnceFromVideoDevice=function(t,n){return en(this,void 0,void 0,function(){var r;return tn(this,function(o){switch(o.label){case 0:return r={video:t?{deviceId:{exact:t}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoElement=function(t){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!t)throw new Zt("A video element must be provided.");return n=e.prepareVideoElement(t),r=this.options.tryPlayVideoTimeout,[4,e.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},e.prototype.decodeOnceFromVideoUrl=function(t){return en(this,void 0,void 0,function(){var n,r;return tn(this,function(o){switch(o.label){case 0:if(!t)throw new Zt("An URL must be provided.");(n=e.prepareVideoElement()).src=t,r=this.decodeOnceFromVideoElement(n),o.label=1;case 1:return o.trys.push([1,,3,4]),[4,r];case 2:return[2,o.sent()];case 3:return e.cleanVideoSource(n),[7];case 4:return[2]}})})},e.prototype.scanOneResult=function(t,n,r,o){var i=this;return n===void 0&&(n=!0),r===void 0&&(r=!0),o===void 0&&(o=!0),new Promise(function(s,a){i.scan(t,function(c,u,d){if(c)return s(c),void d.stop();if(u){if(u instanceof ge&&n||u instanceof yn&&r||u instanceof xe&&o)return;d.stop(),a(u)}})})},e.prototype.scan=function(t,n,r){var o=this;e.checkCallbackFnOrThrow(n);var i=e.createCaptureCanvas(t),s=i.getContext("2d");if(!s)throw new Error("Couldn't create canvas for visual element scan.");var a,c=function(){s=void 0,i=void 0},u=!1,d={stop:function(){u=!0,clearTimeout(a),c(),r&&r()}},h=function(){if(!u)try{e.drawImageOnCanvas(s,t);var f=o.decodeFromCanvas(i);n(f,void 0,d),a=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof yn||p instanceof xe||p instanceof ge)return void(a=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},e.prototype._decodeOnLoadImage=function(t){return en(this,void 0,void 0,function(){return tn(this,function(n){switch(n.label){case 0:return e.isImageLoaded(t)?[3,2]:[4,e._waitImageLoad(t)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(t)]}})})},e}(),kB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new kl,n,r)||this}kB(t,e)})(Hs);var OB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new js(n),n,r)||this}OB(t,e)})(Hs);var PB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new Ml,n,r)||this}PB(t,e)})(Hs);var RB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){var o=this,i=new gb;return i.setHints(n),(o=e.call(this,i,n,r)||this).reader=i,o}RB(t,e),Object.defineProperty(t.prototype,"possibleFormats",{set:function(n){this.hints.set(Ft.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),t.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},t.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(Hs);var NB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(e){function t(n,r){return e.call(this,new jl,n,r)||this}NB(t,e)})(Hs);var BB=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var i in o)o.hasOwnProperty(i)&&(r[i]=o[i])},e(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),MB=function(e){function t(n,r){return e.call(this,new Fl,n,r)||this}return BB(t,e),t}(Hs),Ul=function(e,t,n){var r=typeof e===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(t,'" to be a of type "').concat(n,'".')),r},DB=function(e){var t=e.scanDelay,n=e.constraints,r=e.onResult,o=e.videoId,i=k.useRef(null);k.useEffect(function(){var s=new MB(null,{delayBetweenScanAttempts:t});return!function(){var a=typeof navigator<"u"&&!!navigator.mediaDevices;return a||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),a}()&&Ul(r,"onResult","function")&&r(null,new Error('MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s),Ul(n,"constraints","object")&&s.decodeFromConstraints({video:n},o,function(a,c){Ul(r,"onResult","function")&&r(a,c,s)}).then(function(a){return i.current=a}).catch(function(a){Ul(r,"onResult","function")&&r(null,a,s)}),function(){var a;(a=i.current)===null||a===void 0||a.stop()}},[])},Vi=function(){return Vi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vi.apply(this,arguments)},bb={container:{width:"100%",paddingTop:"100%",overflow:"hidden",position:"relative"},video:{top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden",position:"absolute",transform:void 0}},xp=function(e){var t=e.videoContainerStyle,n=e.containerStyle,r=e.videoStyle,o=e.constraints,i=e.ViewFinder,s=e.scanDelay,a=e.className,c=e.onResult,u=e.videoId;return DB({constraints:o,scanDelay:s,onResult:c,videoId:u}),ue.createElement("section",{className:a,style:n},ue.createElement("div",{style:Vi(Vi({},bb.container),t)},!!i&&ue.createElement(i,null),ue.createElement("video",{muted:!0,id:u,style:Vi(Vi(Vi({},bb.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};xp.displayName="QrReader",xp.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function LB({onScan:e}){const{cameraFacingMode:t}=gn(),[n,r]=k.useState(t??Zn.USER);return w.jsxs("div",{className:"relative w-full",children:[w.jsx(xp,{onResult:o=>{o&&e(o.getText())},constraints:{facingMode:n},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>n===Zn.USER?r(Zn.ENVIRONMENT):r(Zn.USER),children:w.jsx("img",{src:dp,alt:"camera-switch"})})]})}class ot{constructor(t,n,r,o,i){this._legacyCanvasSize=ot.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=t,this.$canvas=document.createElement("canvas"),r&&typeof r=="object"?this._onDecode=n:(console.warn(r||o||i?"You're using a deprecated version of the QrScanner constructor which will be removed in the future":"Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),this._legacyOnDecode=n),n=typeof r=="object"?r:{},this._onDecodeError=n.onDecodeError||(typeof r=="function"?r:this._onDecodeError),this._calculateScanRegion=n.calculateScanRegion||(typeof o=="function"?o:this._calculateScanRegion),this._preferredCamera=n.preferredCamera||i||this._preferredCamera,this._legacyCanvasSize=typeof r=="number"?r:typeof o=="number"?o:this._legacyCanvasSize,this._maxScansPerSecond=n.maxScansPerSecond||this._maxScansPerSecond,this._onPlay=this._onPlay.bind(this),this._onLoadedMetaData=this._onLoadedMetaData.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this),this._updateOverlay=this._updateOverlay.bind(this),t.disablePictureInPicture=!0,t.playsInline=!0,t.muted=!0;let s=!1;if(t.hidden&&(t.hidden=!1,s=!0),document.body.contains(t)||(document.body.appendChild(t),s=!0),r=t.parentElement,n.highlightScanRegion||n.highlightCodeOutline){if(o=!!n.overlay,this.$overlay=n.overlay||document.createElement("div"),i=this.$overlay.style,i.position="absolute",i.display="none",i.pointerEvents="none",this.$overlay.classList.add("scan-region-highlight"),!o&&n.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)","scale(1.01)"]},{duration:400,iterations:1/0,direction:"alternate",easing:"ease-in-out"})}catch{}r.insertBefore(this.$overlay,this.$video.nextSibling)}n.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild)}this._scanRegion=this._calculateScanRegion(t),requestAnimationFrame(()=>{let a=window.getComputedStyle(t);a.display==="none"&&(t.style.setProperty("display","block","important"),s=!0),a.visibility!=="visible"&&(t.style.setProperty("visibility","visible","important"),s=!0),s&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),t.style.opacity="0",t.style.width="0",t.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),t.addEventListener("play",this._onPlay),t.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=ot.createQrEngine()}static set WORKER_PATH(t){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.")}static async hasCamera(){try{return!!(await ot.listCameras(!1)).length}catch{return!1}}static async listCameras(t=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{t&&(await n()).every(o=>!o.label)&&(r=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}))}catch{}try{return(await n()).map((o,i)=>({id:o.deviceId,label:o.label||(i===0?"Default Camera":`Camera ${i+1}`)}))}finally{r&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),ot._stopVideoStream(r))}}async hasFlash(){let t;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;t=this.$video.srcObject}else t=(await this._getCameraStream()).stream;return"torch"in t.getVideoTracks()[0].getSettings()}catch{return!1}finally{t&&t!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),ot._stopVideoStream(t))}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn()}async turnFlashOn(){if(!this._flashOn&&!this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw"No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]})}catch(t){throw this._flashOn=!1,t}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream())}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData),this.$video.removeEventListener("play",this._onPlay),document.removeEventListener("visibilitychange",this._onVisibilityChange),window.removeEventListener("resize",this._updateOverlay),this._destroyed=!0,this._flashOn=!1,this.stop(),ot._postWorkerMessage(this._qrEnginePromise,"close")}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if((!this._active||this._paused)&&(window.location.protocol!=="https:"&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden))if(this._paused=!1,this.$video.srcObject)await this.$video.play();else try{let{stream:t,facingMode:n}=await this._getCameraStream();!this._active||this._paused?ot._stopVideoStream(t):(this._setVideoMirror(n),this.$video.srcObject=t,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(t){if(!this._paused)throw this._active=!1,t}}stop(){this.pause(),this._active=!1}async pause(t=!1){if(this._paused=!0,!this._active)return!0;this.$video.pause(),this.$overlay&&(this.$overlay.style.display="none");let n=()=>{this.$video.srcObject instanceof MediaStream&&(ot._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return t?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(t){t!==this._preferredCamera&&(this._preferredCamera=t,await this._restartVideoStream())}static async scanImage(t,n,r,o,i=!1,s=!1){let a,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(a=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,s=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||s?"You're using a deprecated api for scanImage which will be removed in the future.":"Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),n=!!r;try{let u,d;[r,u]=await Promise.all([r||ot.createQrEngine(),ot._loadImage(t)]),[o,d]=ot._drawToCanvas(u,a,o,i);let h;if(r instanceof Worker){let f=r;n||ot._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let m,g,y,v=-1;g=E=>{E.data.id===v&&(f.removeEventListener("message",g),f.removeEventListener("error",y),clearTimeout(m),E.data.data!==null?p({data:E.data.data,cornerPoints:ot._convertPoints(E.data.cornerPoints,a)}):l(ot.NO_QR_CODE_FOUND))},y=E=>{f.removeEventListener("message",g),f.removeEventListener("error",y),clearTimeout(m),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",g),f.addEventListener("error",y),m=setTimeout(()=>y("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);v=ot._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw ot.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:ot._convertPoints(f.cornerPoints,a)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return ot._disableBarcodeDetector=!0,ot.scanImage(t,{scanRegion:a,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:s});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!a||!s)throw u;let d=await ot.scanImage(t,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||ot._postWorkerMessage(r,"close")}}setGrayscaleWeights(t,n,r,o=!0){ot._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:t,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(t){ot._postWorkerMessage(this._qrEnginePromise,"inversionMode",t)}static async createQrEngine(t){if(t&&console.warn("Specifying a worker path is not required and not supported anymore."),t=()=>Promise.resolve().then(()=>ND).then(r=>r.createWorker()),!(!ot._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return t();let n=navigator.userAgentData;return n&&n.brands.some(({brand:r})=>/Chromium/i.test(r))&&/mac ?OS/i.test(n.platform)&&await n.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:r,platformVersion:o})=>/arm/i.test(r||"arm")&&13<=parseInt(o||"13")).catch(()=>!0)?t():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay(),this.$overlay&&(this.$overlay.style.display=""),this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video),this._updateOverlay()}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(t){let n=Math.round(.6666666666666666*Math.min(t.videoWidth,t.videoHeight));return{x:Math.round((t.videoWidth-n)/2),y:Math.round((t.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var t=this.$video,n=t.videoWidth,r=t.videoHeight,o=t.offsetWidth,i=t.offsetHeight,s=t.offsetLeft,a=t.offsetTop,c=window.getComputedStyle(t),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,m]=c.objectPosition.split(" ").map((y,v)=>{const b=parseFloat(y);return y.endsWith("%")?(v?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var g=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${a+m+g/r*p}px`,r=/scaleX\(-1\)/.test(t.style.transform),d.left=`${s+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.transform=t.style.transform}})}static _convertPoints(t,n){if(!n)return t;let r=n.x||0,o=n.y||0,i=n.width&&n.downScaledWidth?n.width/n.downScaledWidth:1;n=n.height&&n.downScaledHeight?n.height/n.downScaledHeight:1;for(let s of t)s.x=s.x*i+r,s.y=s.y*n+o;return t}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var t=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;t<n&&await new Promise(o=>setTimeout(o,n-t)),this._lastScanTimestamp=Date.now();try{var r=await ot.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!ot._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=ot.createQrEngine()),r?(this._onDecode?this._onDecode(r):this._legacyOnDecode&&this._legacyOnDecode(r.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} ${this._scanRegion.y||0} ${this._scanRegion.width||this.$video.videoWidth} ${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",r.cornerPoints.map(({x:o,y:i})=>`${o},${i}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100))}this._scanFrame()})}_onDecodeError(t){t!==ot.NO_QR_CODE_FOUND&&console.log(t)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let t=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[t]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),s=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:s}}catch{}throw"Camera not found."}async _restartVideoStream(){let t=this._paused;await this.pause(!0)&&!t&&this._active&&await this.start()}static _stopVideoStream(t){for(let n of t.getTracks())n.stop(),t.removeTrack(n)}_setVideoMirror(t){this.$video.style.transform="scaleX("+(t==="user"?-1:1)+")"}_getFacingMode(t){return(t=t.getVideoTracks()[0])?/rear|back|environment/i.test(t.label)?"environment":/front|user|face/i.test(t.label)?"user":null:null}static _drawToCanvas(t,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,s=n&&n.y?n.y:0,a=n&&n.width?n.width:t.videoWidth||t.width,c=n&&n.height?n.height:t.videoHeight||t.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:a,n=n&&n.downScaledHeight?n.downScaledHeight:c,r.width!==o&&(r.width=o),r.height!==n&&(r.height=n)),n=r.getContext("2d",{alpha:!1}),n.imageSmoothingEnabled=!1,n.drawImage(t,i,s,a,c,0,0,r.width,r.height),[r,n]}static async _loadImage(t){if(t instanceof Image)return await ot._awaitImageLoad(t),t;if(t instanceof HTMLVideoElement||t instanceof HTMLCanvasElement||t instanceof SVGImageElement||"OffscreenCanvas"in window&&t instanceof OffscreenCanvas||"ImageBitmap"in window&&t instanceof ImageBitmap)return t;if(t instanceof File||t instanceof Blob||t instanceof URL||typeof t=="string"){let n=new Image;n.src=t instanceof File||t instanceof Blob?URL.createObjectURL(t):t.toString();try{return await ot._awaitImageLoad(n),n}finally{(t instanceof File||t instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(t){t.complete&&t.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{t.removeEventListener("load",o),t.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};t.addEventListener("load",o),t.addEventListener("error",o)})}static async _postWorkerMessage(t,n,r,o){return ot._postWorkerMessageSync(await t,n,r,o)}static _postWorkerMessageSync(t,n,r,o){if(!(t instanceof Worker))return-1;let i=ot._workerMessageId++;return t.postMessage({id:i,type:n,data:r},o),i}}ot.DEFAULT_CANVAS_SIZE=400,ot.NO_QR_CODE_FOUND="No QR code found",ot._disableBarcodeDetector=!1,ot._workerMessageId=0;function FB({onScan:e}){const{cameraFacingMode:t}=gn(),[n,r]=k.useState(t),o=k.useRef(),i=k.useRef(null),[s,a]=k.useState(!0),c=d=>{e(d==null?void 0:d.data)},u=d=>{};return k.useEffect(()=>{var d;return i!=null&&i.current&&!o.current&&(o.current=new ot(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(d=o==null?void 0:o.current)==null||d.start().then(()=>a(!0)).catch(h=>{h&&a(!1)})),()=>{var h;i!=null&&i.current||(h=o==null?void 0:o.current)==null||h.stop()}},[]),k.useEffect(()=>{s||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[s]),w.jsxs("div",{className:"relative",children:[w.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),w.jsx("div",{className:"absolute right-2 top-2 flex h-10 w-10 cursor-pointer items-center justify-center rounded bg-white shadow-overlay",onClick:()=>{var h;const d=n===Zn.USER?Zn.ENVIRONMENT:Zn.USER;r(d),(h=o==null?void 0:o.current)==null||h.setCamera(d)},children:w.jsx("img",{src:dp,alt:"camera-switch"})})]})}function Gs({data:e,dataSetter:t,setDefer:n,label:r=""}){const o=k.useRef(null),i=MP(),[s,a]=Ax()??[0,0],{subscribe:c,unsubscribe:u}=Da(),{cameraService:d}=gn(),h=p=>{t(p)};k.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const p=l=>{t(l.detail.code)};return c("onCodeScan",p),()=>{u("onCodeScan",p)}},[a]);const f=()=>{switch(+d){case 1:return w.jsx(Mw,{onScan:h});case 2:return w.jsx(FB,{onScan:h});case 3:return w.jsx(LB,{onScan:h});default:return w.jsx(Mw,{onScan:h})}};return w.jsxs("div",{ref:o,children:[!!i.length&&w.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[f(),w.jsx("hr",{})]}),w.jsx(Oi,{label:r,value:e,autoFocus:!0,placeholder:"CDE2341S",onChange:p=>{n&&n(!0),t(p.target.value)}})]})}function jB(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),d=on(),h=qt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);t(e("unknownCode",{code:o}))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{o&&!s&&f()},[o]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"code"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:f,children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:a,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function VB(){const{hash:e}=_o();return w.jsx(kr,{to:`${je.GIFTCARD}/select/${e}`})}function UB(){const{identifierValue:e}=_o(),{errorToast:t}=Kt(),{uuid:n,mutate:r}=He(),{onContactLink:o}=gn(),[i,s]=k.useState(!1),a=qt(),c=d=>a.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{a.put(n,{contact_identifier_value:e}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>s(!0))}).catch(t)};return k.useEffect(()=>{u()},[]),i?w.jsx(kr,{to:`${je.PORTAL}/overview`}):w.jsx(Fr,{})}function Eb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/vouchers/${e}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:s}}function HB(){const{t:e}=$e(),{code:t}=_o(),{voucher:n}=Eb(t),{portalSession:r}=He(),[o,i]=k.useState(!1),[s,a]=k.useState(!1),c=on(),u=()=>{n!=null&&n.contact||r.contact?i(!0):a(!0)};return k.useEffect(()=>{n&&u()},[n]),n?w.jsxs(w.Fragment,{children:[o?w.jsx(kr,{to:`${je.VOUCHER}/${n.code}/redeem`}):w.jsx(Fr,{}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:s,onClose:()=>a(!1),primaryAction:{label:e("linkToContact"),action:()=>c(`${je.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>a(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:n.code})})})]}):w.jsx(Fr,{})}function Hl({redirectRoute:e}){const{state:t}=yr(),{t:n}=$e(),{errorToast:r}=Kt(),{onContactLink:o}=gn(),{portalSession:i,mutate:s}=He(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=on(),m=qt(),g=b=>m.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),m.put(i.uuid,{email:c}).then(b=>{o&&g(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),s().then(()=>l(e))}).catch(b=>{b.response.data.code===jc.CONTACT_NOT_FOUND&&p(!0)}).finally(()=>h(!1))},v=()=>{h(!0),m.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return k.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>c&&!d&&y(),children:w.jsx(Oi,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>u(b.target.value),beforeIcon:"mail"})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:d}),w.jsx(dt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>l("../identifier",{state:t})})]})})]})}),w.jsx(ni,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:v,disabled:d},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function GB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/*",element:w.jsx(jB,{})}),w.jsx(Je,{path:"/giftcard/:hash",element:w.jsx(VB,{})}),w.jsx(Je,{path:"/identifier/:identifierValue",element:w.jsx(UB,{})}),w.jsx(Je,{path:"/voucher/:code",element:w.jsx(HB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})})]})}const qB={[rn.GIFTCARD]:`${je.GIFTCARD}/select`,[rn.REDEEM_GIFTCARD]:`${je.GIFTCARD}/redeem`,[rn.TOP_UP_GIFTCARD]:`${je.GIFTCARD}/top-up`};function $B(){const{t:e}=$e(),{portalSession:t}=He(),{errorToast:n}=Kt(),[r,o]=k.useState(""),[i,s]=k.useState(!1),[a,c]=k.useState(!1),u=qt(),d=on(),h=()=>{s(!0),u.get(`${t.uuid}/giftcards/${r}`).then(f=>{const p=t.type;d(`${qB[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>s(!1))};return k.useEffect(()=>{!a&&r&&h()},[r]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanGiftcard")})})}),w.jsx(Vt,{children:w.jsx(Gs,{data:r,dataSetter:o,setDefer:c,label:e("hash")})}),w.jsx(mn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function WB(){const{t:e}=$e(),{hash:t}=_o(),n=on();return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("chooseType")})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:e("redeem"),onClick:()=>n(`${je.GIFTCARD}/redeem/${t}`)}),w.jsx(dt,{className:"grow",label:e("topUp"),onClick:()=>n(`${je.GIFTCARD}/top-up/${t}`)})]})})]})})}function Cb(e){const{portalSession:t}=He(),[n,r]=k.useState(),{isLoading:o,pending:i,mutate:s}=_r({url:`${t.uuid}/giftcards/${e}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:s}}function dc(){const{mutate:e}=He();return{get:()=>e().then(r=>r.data.data.events),post:()=>{e().then(r=>{OC(r.data.data.events)})}}}function YB(){const{t:e}=$e(),{errorToast:t}=Kt(),{hash:n}=_o(),{giftcard:r,mutate:o}=Cb(n),{portalSession:i,mutate:s}=He(),{onUseGiftcard:a}=gn(),{post:c}=dc(),[u]=k.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=k.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=on(),l=qt(),m=()=>{h(!0),l.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-g()}).then(E=>{o(),s(),c(),a==null||a(E.data.data)}).catch(t).finally(()=>h(!1))},g=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,v=()=>{let E=0;return i.events.filter(A=>A.type===Fo.GIFTCARD_TRANSACTION).forEach(A=>{A.data.giftcard.uuid===r.uuid&&(E+=A.data.amount_in_cents)}),E},b=()=>{if(g())return{label:e("confirmAndPay",{amount:Qi(g(),i.currency)}),onClick:m};if(f&&y())return{label:e("useAnotherGiftcard"),onClick:()=>p(je.GIFTCARD),variant:"secondary"}};return r?w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:`${e("giftcard")} ${r.hash}`})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("balance")}),w.jsx(ti,{value:r.amount_in_cents,start:r.amount_in_cents-v(),currency:i.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"font-light text-gray-500",children:e("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u+v(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&w.jsx(mn,{children:w.jsx(dt,{label:"",className:"w-full",...b(),pending:d})})]})}):w.jsx(Fr,{})}function zB({value:e,valueSetter:t,enabled:n}){const[r,o]=k.useState(!1),i=k.useRef(null),s=k.useRef(null);k.useEffect(()=>{u(e?e.toString():"")},[]);const a=d=>{t(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(e===0&&!/^[1-9]$/.test(h)||e!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(e===0?h:`${e}${h}`);else{const p=e.toString().slice(0,-1);f=p.length?parseInt(p,10):0}t(f),u(f?f.toString():"")},u=d=>{s&&s.current&&(d?s.current.style.width=`${Math.max(d.length,3)*3}rem`:s.current.style.width="calc(3rem + 14px)")};return w.jsxs(w.Fragment,{children:[w.jsx("input",{ref:s,className:"h-full w-[65px] rounded border-gray-200 border-transparent text-5xl [appearance:textfield] focus:border-transparent focus:ring-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",type:"number",pattern:"[0-9]*",inputMode:"numeric",placeholder:"0",autoFocus:!0,value:e?(e/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&w.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:w.jsx($y,{keyboardRef:i,layout:{default:["1 2 3","4 5 6","7 8 9","00 0 {bksp}"]},theme:"hg-theme-default hg-layout-numeric numeric-theme",onChange:a})})]})}function _b({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),[s,a]=k.useState(0),{portalSession:c}=He(),u=()=>{let d=0;return c.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return w.jsxs($t,{children:[e&&w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t??0,start:t??0,currency:c.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:u()?w.jsx(ti,{value:0,start:s,currency:c.currency,asCurrency:!0}):w.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[w.jsx("p",{children:kC(c.currency)}),w.jsx(zB,{value:s,valueSetter:a,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(s,c.currency)}),className:"w-full",onClick:r&&(()=>r(s)),disabled:!s||!!u(),pending:o})})]})}function KB(){const{t:e}=$e(),{errorToast:t}=Kt(),{hash:n}=_o(),{giftcard:r,mutate:o}=Cb(n),{portalSession:i,mutate:s}=He(),{post:a}=dc(),{onUseGiftcard:c}=gn(),[u,d]=k.useState(!1),h=qt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),s(),a(),c==null||c(l.data.data),xt.success(`${e("transactionSuccessful")}! ${e("totalUpgradedAmount")}: ${Qi(l.data.data.amount_in_cents,i.currency)}`)}).catch(t).finally(()=>d(!1))};return r?w.jsx(Fn,{children:w.jsx(_b,{title:`${e("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):w.jsx(Fr,{})}function XB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx($B,{})}),w.jsx(Je,{path:"/select/:hash",element:w.jsx(WB,{})}),w.jsx(Je,{path:"/redeem/:hash",element:w.jsx(YB,{})}),w.jsx(Je,{path:"/top-up/:hash",element:w.jsx(KB,{})})]})}class kp{constructor(){lr(this,"uuid");lr(this,"email");lr(this,"credit_balance");lr(this,"prepaid_balance");lr(this,"current_display_values")}getDisplayName(){return this.current_display_values.firstname||this.current_display_values.lastname?`${this.current_display_values.firstname} ${this.current_display_values.lastname}`:this.current_display_values.email}}const Sb=k.createContext({contact:new kp,mutate:async()=>{}});function Op({children:e}){const{uuid:t}=He(),[n,r]=k.useState(new kp),{mutate:o}=_r({url:`${t}/contacts`,onData:s=>{const a=new kp;a.uuid=s.uuid,a.email=s.email,a.credit_balance=s.credit_balance,a.prepaid_balance=s.prepaid_balance,a.current_display_values=s.current_display_values,r(a)}}),i=k.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?w.jsx(Sb.Provider,{value:i,children:e}):w.jsx(Fr,{})}function Er(){const e=k.useContext(Sb);if(!e)throw new Error("Only use 'useContactContext' within a ContactProvider");return e}function Gl({message:e=""}){return w.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[w.jsx(Hd,{className:"h-[32px] w-[32px]"}),e&&w.jsx("p",{className:"text-sm",children:e})]})}function QB(){const{t:e}=$e(),{errorToast:t}=Kt(),{contact:n,mutate:r}=Er(),{uuid:o,portalSession:i,mutate:s}=He(),a=qt(),c=()=>{a.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),s()}).catch(t)},u=()=>{const d=i.events.filter(h=>h.type===Fo.CREDIT_RECEPTION);return d.length?d[0]:null};return k.useEffect(()=>{u()||c()},[]),w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:n.getDisplayName()})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?w.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:u()?w.jsxs(w.Fragment,{children:["+",w.jsx(ti,{value:u().data.credits,start:0})]}):w.jsx(Gl,{})}):w.jsx("p",{className:"text-core-red-500",children:e("xIsRequired",{x:"Amount in cents"})+"."})}),w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:`${e("new")} ${e("balance").toLowerCase()}`}),w.jsx(ti,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function JB(){const{portalSession:e}=He();return e.contact?w.jsx(Op,{children:w.jsx(QB,{})}):e.inputData.primary_identification_method&&e.inputData.primary_identification_method===zi.EMAIL?w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/email`}):w.jsx(kr,{to:`${je.POINTS_TRANSACTION}/identifier`})}function Pp({redirectRoute:e}){const{t}=$e(),{state:n}=yr(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=gn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt();k.useEffect(()=>{!d&&s&&l()},[s]);const l=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(g=>{i&&m(g.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(e,{state:{contactIdentifier:s}}))}).catch(()=>f("link",{state:{contactIdentifier:s}})).finally(()=>u(!1))},m=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g});return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>s&&l(),children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:t("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:t("continue"),onClick:l,disabled:!s,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:t("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Rp({redirectRoute:e}){const{t}=$e(),{errorToast:n}=Kt(),{uuid:r,mutate:o}=He(),{onContactLink:i}=gn(),{state:s}=yr(),{publish:a}=Da(),[c,u]=k.useState(""),[d,h]=k.useState(!1),[f,p]=k.useState(!1),l=on(),m=qt();if(!s||!s.contactIdentifier)return w.jsx(kr,{to:"../"});const g=()=>{h(!0),m.post(`${r}/contacts/link-identifier`,{contact_identifier_value:s.contactIdentifier,email:c}).then(v).catch(E=>{E.response.data.code===jc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},y=()=>{h(!0),m.post(`${r}/contacts`,{email:c}).then(g).catch(n).finally(()=>h(!1))},v=()=>{m.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>l(e))}).catch(n).finally(()=>h(!1))},b=E=>m.get(`${r}/contacts`,{contact_uuid:E});return k.useEffect(()=>{a("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),w.jsxs(Fn,{children:[w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:t("linkContact")})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex flex-col gap-3",children:[w.jsx(bx,{body:t("noEmailAddressLinkedToIdentifier")}),w.jsx(Ni,{onSubmit:g,children:w.jsx(Oi,{id:"new-contact-identifier-input",label:t("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:t("continue"),className:"w-full",onClick:g,disabled:!c||d})})]}),w.jsx(ni,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:t("confirm"),action:y,loading:d},secondaryAction:{label:t("cancel"),action:()=>p(!1)},children:w.jsx("p",{children:t("continueWithEmail",{email:c})})})]})}function ZB(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(JB,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.POINTS_TRANSACTION})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.POINTS_TRANSACTION})})]})}function eM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=gn();return e.contact?w.jsx(kr,{to:`${je.PORTAL}/overview`}):t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PORTAL}/email`}):w.jsx(kr,{to:`${je.PORTAL}/identifier`})}function tM({children:e}){return w.jsx("div",{className:"h-screen w-screen pb-[70px] md:px-4 md:pb-[86px] md:pt-4 lg:pb-4 lg:pt-[66px]",children:w.jsx("div",{className:"h-full max-h-full",children:e})})}function nM({contact:e}){const{t}=$e(),n=on();return w.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx(Ih,{src:e.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{className:"flex flex-col gap-1",children:[w.jsxs("div",{className:"flex gap-2",children:[w.jsx("p",{className:"text-lg",children:e.getDisplayName()}),e.current_display_values.tier&&w.jsx(Th,{label:e.current_display_values.tier,size:"sm",stroke:!0})]}),w.jsx("p",{className:"text-sm text-core-gray-500 ",children:t("joinedAtDate",{date:new Date(e.current_display_values.created_at).toLocaleDateString(dn.language,{month:"long",year:"numeric"})})})]})]}),w.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[w.jsx(dt,{label:t("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),w.jsx(dt,{before:w.jsx(Pn,{icon:"edit"}),label:t("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function fc({children:e}){return w.jsx("div",{className:"flex-grow rounded-lg border p-4",children:e})}function rM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:t.current_display_values.loyalty_balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[w.jsx("p",{className:"text-2xl leading-8",children:Qi(t.prepaid_balance.balance_in_cents,n.currency)}),w.jsx("p",{className:"text-sm text-core-gray-500",children:e("prepaidCredit")})]})})]})}function oM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He(),r=(o,i)=>x0(o,i)?`${x0(o,i)} ${e("yearsAgo")}`:T0(o,i)?`${T0(o,i)} ${e("weeksAgo")}`:I0(o,i)?`${I0(o,i)} ${e("daysAgo")}`:e("today");return w.jsx(fc,{children:w.jsxs("div",{className:"h-full justify-between",children:[w.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:e("stats")}),w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"calendar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(t.current_display_values.loyalty_last_transaction_date))}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("lastVisit")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"shopping-bag"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_number_of_transactions} ${e("visits")}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalVisits")})]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx(Pn,{icon:"dollar"}),w.jsxs("div",{children:[w.jsx("p",{className:"text-xs font-semibold",children:`${t.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),w.jsx("p",{className:"text-xs text-core-gray-500",children:e("totalCredits")})]})]})]})]})})}function Ab(){const{uuid:e}=He(),[t,n]=k.useState([]),{data:r,isLoading:o,pending:i,mutate:s}=_r({url:`${e}/loyalty-transactions`});return k.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:t,isLoading:o,pending:i,mutate:s}}function Ib({loyaltyTransaction:e}){const{t}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs text-core-gray-500",children:e.type===f0.CREDIT_RECEPTION?t("transaction"):`${t("isRedeemed")} '${e.loyalty_transaction_data.title}'`}),w.jsx("p",{className:"text-xs font-semibold",children:e.credits>0?"+"+e.credits:e.credits})]})}function iM(){const{t:e}=$e(),t=on(),{loyaltyTransactions:n}=Ab();return n?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("activities")}),n&&n.length?w.jsx("div",{children:n.slice(0,5).map(r=>w.jsx(Ib,{loyaltyTransaction:r},r.uuid))}):w.jsx("p",{className:"text-sm text-core-gray-500",children:e("noActivity")})]}),w.jsx(dt,{label:`${e("all")} ${e("activities").toLowerCase()}`,variant:"secondary",onClick:()=>t("activity")})]})}):w.jsx(Gl,{})}function Tb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/subscriptions/contact`,onData:n});return{subscriptions:t,isLoading:r,pending:o,mutate:i}}function xb({subscription:e,onChange:t,editable:n=!1}){const{t:r}=$e();return w.jsxs("div",{className:"mb-2 flex justify-between",children:[w.jsx("p",{className:"text-xs font-semibold",children:e.subscription_type.name}),n?w.jsx(sp,{defaultChecked:e.is_subscribed,disabled:e.subscription_type.strategy===h0.FUNCTIONAL,onChange:t&&(()=>t(e.subscription_type.name))}):w.jsx(Th,{label:r(e.status.toLowerCase()),size:"sm",color:e.is_subscribed?"primary":"gray"})]})}function sM(){const{t:e}=$e(),{subscriptions:t}=Tb(),n=on();return t?w.jsx(fc,{children:w.jsxs("div",{className:"flex h-full flex-col justify-between",children:[w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{className:"text-lg font-semibold leading-7",children:e("subscriptions")}),w.jsx("div",{children:t.map(r=>w.jsx(xb,{subscription:r},r.subscription_type.uuid))})]}),w.jsx(dt,{label:e("change"),before:w.jsx(Pn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):w.jsx(Gl,{})}function aM(){const{contact:e}=Er();return w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(nM,{contact:e})}),w.jsx(Vt,{children:w.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[w.jsx(rM,{}),w.jsx(oM,{}),w.jsx(iM,{}),w.jsx(sM,{})]})})]})}function hc({label:e,path:t}){const n=on();return w.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:w.jsx(dt,{label:e,variant:"link-gray",before:w.jsx(Pn,{icon:"caret-left",size:"md"}),onClick:()=>n(t)})})}function cM(){const{t:e}=$e(),{loyaltyTransactions:t}=Ab(),{contact:n}=Er();return w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsx("p",{className:"text-sm font-medium",children:e("allActivities")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),w.jsx("div",{className:"overflow-auto",children:t==null?void 0:t.map(r=>w.jsx(Ib,{loyaltyTransaction:r},r.uuid))})]})})]})})}function uM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{subscriptions:r,mutate:o}=Tb(),[i,s]=k.useState({}),[a,c]=k.useState(!1),u=qt();k.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,m)=>({...l,[m.subscription_type.name]:m.is_subscribed}),{});s(p)}},[]);const d=p=>{Object.hasOwn(i,p)?s({...i,[p]:!i[p]}):s({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(t).finally(()=>c(!1))},f=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("subscriptions")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("manageEmailPreferences")}),r.map(p=>w.jsx(xb,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:h,pending:a,disabled:!f()||a})})]})}):w.jsx(Gl,{})}function lM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contact:r,mutate:o}=Er(),[i,s]=k.useState(),[a,c]=k.useState(!1),[u,d]=k.useState(),h=qt();_r({url:`${n}/contact-attributes`,onData:m=>s(m.elements)});const f=m=>{d({...u,[m.target.name]:m.target.value})},p=(m,g)=>{d({...u,[m]:g})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(t).finally(()=>c(!1))};return w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsxs("div",{className:"md:max-h-[528px]",children:[w.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[w.jsx(Ih,{src:r.current_display_values.avatar,size:"2xl"}),w.jsxs("div",{children:[w.jsx("div",{className:"flex flex-row items-center gap-2 ",children:w.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),w.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(m=>{if(!(m.type==="media_upload"||m.type==="email"))return m.type==="select"?w.jsx(Bx,{name:m.name,label:m.label,value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],onChange:g=>p(m.name,g),disabled:m.disabled,children:m.options.map(g=>w.jsx(kh,{label:g.label,value:g.value},g.value))},m.id):m.type==="multi_select"?w.jsx(Ox,{name:m.name,value:u&&u[m.name]?u[m.name]:m.defaultValue,label:m.label,onChange:p,disabled:m.disabled,options:m.options},m.id):m.type==="birth_date"||m.type==="date_time"?w.jsx(Yy,{id:m.id,name:m.name,label:m.label,type:m.type==="date_time"?"date_time":"date",value:u&&u[m.name]?u[m.name]:r.current_display_values[m.name],disabled:m.disabled,onChange:f},m.id):w.jsx(Oi,{disabled:m.disabled,label:m.label,name:m.name,value:u&&u[m.name]!=="undefined"?u[m.name]:r.current_display_values[m.name],onChange:f},m.id)}):w.jsx(vl,{rows:10})]})}),w.jsx(mn,{children:w.jsx(dt,{label:e("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:a})})]})})}function kb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/contact-identifiers`,onData:n});return{contactIdentifiers:t,isLoading:r,pending:o,mutate:i}}function dM({identifier:e,onClear:t}){const{t:n}=$e();return w.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[w.jsxs("div",{className:"flex-col pl-4",children:[w.jsx("p",{className:"font-semibold",children:e.value}),w.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),w.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>t&&t(e.value),children:w.jsx(Pn,{className:"h-full",icon:"close"})})]})}function fM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contactIdentifiers:r,isLoading:o,mutate:i}=kb(),[s,a]=k.useState(""),[c,u]=k.useState(!1),d=on(),h=qt(),f=l=>{a(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:s}).then(()=>i()).catch(t).finally(()=>u(!1))};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile"})}),w.jsx(Vt,{children:w.jsx("div",{className:"md:max-h-[528px]",children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsxs("div",{children:[w.jsx("p",{className:"text-sm font-medium",children:e("contactIdentifiers")}),w.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:e("contactIdentifierDescription")})]}),o?w.jsx(vl,{rows:10}):r==null?void 0:r.map(l=>w.jsx(dM,{identifier:l,onClear:f},l.value))]})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),w.jsx(ni,{title:e("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:e("confirm"),action:p},secondaryAction:{label:e("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:w.jsx("p",{children:e("clearContactIdentifier",{value:s})})})]})}function hM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n}=He(),{contact:r}=Er(),{mutate:o}=kb(),[i,s]=k.useState(""),[a,c]=k.useState(!1),[u,d]=k.useState(!1),h=on(),f=qt(),p=()=>{c(!0),f.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(t).finally(()=>{s(""),c(!1)})};return k.useEffect(()=>{!u&&i&&p()},[i]),w.jsx("div",{className:"h-full md:container",children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx(hc,{label:e("back"),path:"../profile/contact-identifiers"})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>i&&p(),children:w.jsx(Gs,{data:i,dataSetter:s,setDefer:d,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("addIdentifier"),className:"w-full",onClick:p,pending:a,disabled:!i})})]})})}function pM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/profile",element:w.jsx(aM,{})}),w.jsx(Je,{path:"/profile/activity",element:w.jsx(cM,{})}),w.jsx(Je,{path:"/profile/subscriptions",element:w.jsx(uM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers",element:w.jsx(fM,{})}),w.jsx(Je,{path:"/profile/contact-identifiers/create",element:w.jsx(hM,{})}),w.jsx(Je,{path:"/profile/contact-attributes",element:w.jsx(lM,{})})]})}function mM(){const{t:e}=$e(),{contact:t}=Er(),{portalSession:n}=He();return w.jsxs("div",{className:"flex h-16 items-center justify-between",children:[w.jsx("h1",{children:e("rewards")}),w.jsxs("div",{className:"flex flex-col items-center",children:[w.jsx("p",{children:t.credit_balance.balance}),w.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function Ob(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/rewards`,onData:n});return{rewards:t,isLoading:r,pending:o,mutate:i}}function Np({reward:e,selected:t,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=He(),{contact:s}=Er();return w.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[w.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(t==null?void 0:t.uuid)===e.uuid?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.media&&e.media.value?e.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:e.title??e.description})]}),w.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[e.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),e.required_credits-s.credit_balance.balance>0&&w.jsx(Px,{value:s.credit_balance.balance,max:e.required_credits})]})}function gM({selected:e,setSelected:t}){const{t:n}=$e(),{contact:r}=Er(),{rewards:o,isLoading:i}=Ob(),s=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),a=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return w.jsx(w.Fragment,{children:i?w.jsx(vl,{rows:1}):w.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[w.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),s.map(c=>w.jsx(Np,{reward:c,selected:e,setSelected:t},c.uuid))]})}),w.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&w.jsxs(w.Fragment,{children:[w.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),a.map(c=>w.jsx(Np,{reward:c,selected:e,setSelected:t,disabled:!0},c.uuid))]})})]})})}function yM(){const{portalSession:e}=He(),{rewards:t}=Ob(),n=()=>e.events.filter(r=>r.type===Fo.REWARD_RECEPTION).map(r=>t.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return t?w.jsx("div",{children:w.jsx(Xv,{children:n().map((r,o)=>w.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:r.media&&r.media.value?r.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-8 w-8 rounded object-cover object-center"}),w.jsx("p",{className:"truncate",children:r.title??r.description})]}),w.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",e.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):w.jsx(w.Fragment,{})}function vM(){const{t:e}=$e(),{errorToast:t,successToast:n}=Kt(),{portalSession:r,mutate:o}=He(),{mutate:i}=Er(),{onClaimReward:s}=gn(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),{post:p}=dc(),l=qt();k.useEffect(()=>{a&&f(!0)},[a]);const m=y=>{o().then(v=>{const E=v.data.data.events.filter(C=>C.type===Fo.REWARD_RECEPTION&&C.data.reward.uuid===a.uuid).reduce((C,A)=>new Date(C.created_at)>new Date(A.created_at)?C:A);s==null||s(y,E.data.uuid)})},g=()=>{d(!0),l.post(`${r.uuid}/rewards/claim`,{uuid:a.uuid}).then(y=>{p(),i(),m(y.data.data),n(e("rewardClaimed",{name:y.data.data.title}))}).catch(t).finally(()=>{f(!1),c(void 0),d(!1)})};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(mM,{})}),w.jsx(Vt,{children:w.jsx(gM,{selected:a,setSelected:c})}),w.jsx(mn,{children:w.jsx(yM,{})})]}),w.jsx(ni,{title:e("confirmRewardRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:g,loading:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:w.jsx("div",{className:"flex flex-col gap-4",children:a&&w.jsx(Np,{reward:a,selected:a,setSelected:c,readOnly:!0})})})]})}function Bp(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/vouchers`,onData:n});return{vouchers:t,isLoading:r,pending:o,mutate:i}}function wM(){const{t:e}=$e();return w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("vouchers")})})}function Mp({voucher:e,selected:t,setSelected:n}){const{t:r}=$e();return w.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${e.status===oa.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(t==null?void 0:t.code)===e.code?n(void 0):n(e),children:[w.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[w.jsx("img",{src:e.promotion.image?e.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),w.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[w.jsx("p",{className:"font-semibold",children:e.name}),e.status===oa.REDEEMED?w.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):w.jsx("p",{className:"text-core-primary-500",children:e.expiration_date?`Valid until ${new Date(e.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),w.jsx("p",{className:`text-core-${e.status===oa.REDEEMED?"gray":"primary"}-500`,children:e.code})]})}function bM({selected:e,setSelected:t}){const{t:n}=$e(),{vouchers:r,isLoading:o}=Bp();return w.jsx(w.Fragment,{children:o?w.jsx(vl,{rows:1}):w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:w.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>w.jsx(Mp,{voucher:i,selected:e,setSelected:t},i.code)):w.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function EM(){const{t:e}=$e(),{portalSession:t}=He(),{vouchers:n}=Bp(),r=()=>t.events.filter(o=>o.type===Fo.VOUCHER_REDEEMED);return n?w.jsx("div",{children:w.jsx(Xv,{children:r().map((o,i)=>w.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:w.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:w.jsxs("div",{className:"overflow-hidden",children:[w.jsx("p",{className:"font-semibold",children:o.data.name}),w.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",e("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):w.jsx(w.Fragment,{})}function CM(){const{t:e}=$e(),{errorToast:t,successToast:n}=Kt(),{uuid:r}=He(),{onRedeemVoucher:o}=gn(),{post:i}=dc(),{mutate:s}=Bp(),[a,c]=k.useState(),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=qt();k.useEffect(()=>{a&&f(!0)},[a]);const l=()=>{d(!0),p.post(`${r}/vouchers/redeem`,{code:a.code}).then(g=>{i(),o&&o(g.data.data),n(e("voucherSuccessfullyRedeemed")),s()}).catch(t).finally(()=>{m(),d(!1)})},m=()=>{f(!1),c(void 0)};return w.jsxs("div",{className:"h-full md:container",children:[w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx(wM,{})}),w.jsx(Vt,{children:w.jsx(bM,{selected:a,setSelected:c})}),w.jsx(mn,{children:w.jsx(EM,{})})]}),w.jsx(ni,{title:e("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:e("confirm"),action:l,loading:u},secondaryAction:{label:e("cancel"),action:m},onClose:m,children:w.jsxs("div",{className:"flex flex-col gap-4",children:[w.jsx("p",{children:e("redeemTitle",{title:a==null?void 0:a.name})}),a&&w.jsx(Mp,{voucher:a,setSelected:c})]})})]})}function _M(){const{t:e}=$e(),[t,n]=k.useState(1),r=on(),o=[{id:0,label:e("profile"),icon:"user",pathname:"profile"},{id:1,label:e("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:e("vouchers"),icon:"mail",pathname:"vouchers"}];return k.useEffect(()=>{r(o[t].pathname)},[]),w.jsx(Op,{children:w.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[w.jsx(uO,{children:o.map(i=>w.jsx(lO,{id:i.id,label:i.label,icon:i.icon,activeTab:t,setActiveTab:n,pathname:i.pathname},i.id))}),w.jsxs(tM,{children:[w.jsx(pM,{}),w.jsxs(So,{children:[w.jsx(Je,{path:"/rewards",element:w.jsx(vM,{})}),w.jsx(Je,{path:"/vouchers",element:w.jsx(CM,{})})]})]})]})})}function SM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(eM,{})}),w.jsx(Je,{path:"/overview/*",element:w.jsx(_M,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.PORTAL})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.PORTAL})})]})}function Pb(){const{uuid:e}=He(),[t,n]=k.useState(),{isLoading:r,pending:o,mutate:i}=_r({url:`${e}/prepaid`,onData:n});return{prepaidBalance:t,isLoading:r,pending:o,mutate:i}}function AM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=Kt(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=gn(),{prepaidBalance:c,mutate:u}=Pb(),[d,h]=k.useState(!1),f=qt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(_b,{title:s.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function IM({title:e,balance:t,balanceName:n,transaction:r,pending:o}){const{t:i}=$e(),{portalSession:s}=He(),a=s.inputData.amount_in_cents??0,c=()=>{let d=0;return s.events.filter(f=>Object.values(Fo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(a+c(),t);return w.jsxs($t,{children:[e&&w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex h-full flex-col gap-4",children:[w.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:w.jsxs("div",{className:"flex justify-between",children:[w.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),w.jsx(ti,{value:t,start:t+c(),currency:s.currency,asCurrency:!0})]})}),w.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:w.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[w.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),w.jsx("div",{className:"text-5xl font-bold",children:w.jsx(ti,{value:u(),start:a,currency:s.currency,asCurrency:!0})})]})})]})}),w.jsx(mn,{children:w.jsx(dt,{label:i("confirmAndPay",{amount:Qi(u(),s.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!a||!!c(),pending:o})})]})}function TM(){const{t:e}=$e(),{state:t}=yr(),{errorToast:n,successToast:r}=Kt(),{uuid:o,mutate:i}=He(),{contact:s}=Er(),{onCreatePrepaidTransaction:a}=gn(),{prepaidBalance:c,mutate:u}=Pb(),[d,h]=k.useState(!1),f=qt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(t==null?void 0:t.contactIdentifier)??void 0}).then(m=>{u(),i(),a(m.data.data),r(e("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?w.jsx(Fn,{children:w.jsx(IM,{title:s.getDisplayName(),balance:c.balance_in_cents,balanceName:e("prepaidBalance"),transaction:p,pending:d})}):w.jsx(Fr,{})}function xM({setType:e}){const{t}=$e();return w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:t("Choose type")})})}),w.jsx(Vt,{children:w.jsxs("div",{className:"flex gap-2",children:[w.jsx(dt,{className:"grow",label:t("pay"),onClick:()=>e(rn.PAY_PREPAID)}),w.jsx(dt,{className:"grow",label:t("topUp"),onClick:()=>e(rn.TOP_UP_PREPAID)})]})})]})})}function kM(){const{portalSession:e}=He(),{primaryIdentificationMethod:t}=gn(),[n,r]=k.useState(e.type);if(!e.contact)return t&&t===zi.EMAIL?w.jsx(kr,{to:`${je.PREPAID}/email`}):w.jsx(kr,{to:`${je.PREPAID}/identifier`});const o=()=>n===rn.TOP_UP_PREPAID?w.jsx(AM,{}):n===rn.PAY_PREPAID?w.jsx(TM,{}):w.jsx(xM,{setType:r});return w.jsx(Op,{children:o()})}function OM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(kM,{})}),w.jsx(Je,{path:"/email",element:w.jsx(Hl,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier",element:w.jsx(Pp,{redirectRoute:je.PREPAID})}),w.jsx(Je,{path:"/identifier/link",element:w.jsx(Rp,{redirectRoute:je.PREPAID})})]})}function PM(){const{t:e}=$e(),{errorToast:t}=Kt(),{uuid:n,portalSession:r}=He(),[o,i]=k.useState(""),[s,a]=k.useState(!1),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt(),l=()=>{a(!0),p.get(`${n}/vouchers/check/${o}`).then(m=>{m.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(t).finally(()=>a(!1))};return k.useEffect(()=>{!c&&o&&l()},[o]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:e("voucherCode").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Gs,{data:o,dataSetter:i,setDefer:u,label:e("code")})}),w.jsx(mn,{children:w.jsx(dt,{label:e("submit"),className:"w-full",onClick:l,pending:s})})]})}),w.jsx(ni,{title:e("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:e("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:e("cancel"),action:()=>h(!1)},children:w.jsx("p",{children:e("linkVoucherWithCodeToContact",{code:o})})})]})}function RM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{uuid:r}=He(),{onRedeemVoucher:o}=gn(),{post:i}=dc(),{voucher:s,mutate:a}=Eb(n),[c,u]=k.useState(!1),d=qt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),a()}).catch(t).finally(()=>u(!1))};return s?w.jsx(Fn,{children:w.jsxs($t,{children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:"Voucher"})})}),w.jsx(Vt,{children:w.jsx("div",{children:w.jsx(Mp,{voucher:s,setSelected:()=>{}})})}),w.jsx(mn,{children:w.jsx(dt,{label:e("redeemVoucher"),className:"w-full",onClick:h,disabled:s.status!==oa.ACTIVE||c,pending:c})})]})}):w.jsx(Fr,{})}function NM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{portalSession:r,mutate:o}=He(),{onContactLink:i}=gn(),[s,a]=k.useState(""),[c,u]=k.useState(!1),[d,h]=k.useState(!1),f=on(),p=qt(),l=g=>p.get(`${r.uuid}/contacts`,{contact_uuid:g}),m=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:s}).then(g=>{i&&l(g.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(`${je.VOUCHER}/${n}/redeem`))}).catch(t).finally(()=>u(!1))};return k.useEffect(()=>{!d&&s&&m()},[s]),w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:m,children:w.jsx(Gs,{data:s,dataSetter:a,setDefer:h,label:e("contactIdentifier")})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),onClick:m,pending:c}),r.inputData.enable_email_identification&&w.jsx(dt,{label:e("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function BM(){const{t:e}=$e(),{errorToast:t}=Kt(),{code:n}=_o(),{onContactLink:r}=gn(),{portalSession:o,mutate:i}=He(),{publish:s}=Da(),[a,c]=k.useState(""),[u,d]=k.useState(!1),[h,f]=k.useState(!1),p=on(),l=qt(),m=v=>l.get(`${o.uuid}/contacts`,{contact_uuid:v}),g=()=>{d(!0),l.put(o.uuid,{email:a}).then(v=>{r&&m(v.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${je.VOUCHER}/${n}/redeem`))}).catch(v=>{v.response.data.code===jc.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},y=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:a}).then(g).catch(t).finally(()=>d(!1))};return k.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),w.jsxs(w.Fragment,{children:[w.jsx(Fn,{children:w.jsxs($t,{id:Or,children:[w.jsx(Ut,{children:w.jsx("div",{className:"flex h-16 items-center",children:w.jsx("p",{children:e("fillInXBelow",{x:e("emailAddress").toLowerCase()})})})}),w.jsx(Vt,{children:w.jsx(Ni,{onSubmit:()=>a&&!u&&g(),children:w.jsx(Oi,{id:"via-email-address-input",label:e("emailAddress"),autoFocus:!0,onChange:v=>c(v.target.value),beforeIcon:"mail"})})}),w.jsx(mn,{children:w.jsxs("div",{className:"flex flex-col gap-2",children:[w.jsx(dt,{label:e("continue"),className:"w-full",onClick:g,pending:u,disabled:!a||u}),w.jsx(dt,{label:e("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),w.jsx(ni,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:e("confirm"),action:y,disabled:u},secondaryAction:{label:e("cancel"),action:()=>f(!1)},children:w.jsx("p",{children:e("continueWithEmail",{email:a})})})]})}function MM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(PM,{})}),w.jsx(Je,{path:":code/redeem",element:w.jsx(RM,{})}),w.jsx(Je,{path:":code/email",element:w.jsx(BM,{})}),w.jsx(Je,{path:":code/identifier",element:w.jsx(NM,{})})]})}function DM(){return w.jsxs(So,{children:[w.jsx(Je,{path:"/",element:w.jsx(lx,{})}),w.jsx(Je,{path:`${je.GENERIC}/*`,element:w.jsx(GB,{})}),w.jsx(Je,{path:`${je.GIFTCARD}/*`,element:w.jsx(XB,{})}),w.jsx(Je,{path:`${je.POINTS_TRANSACTION}/*`,element:w.jsx(ZB,{})}),w.jsx(Je,{path:`${je.PORTAL}/*`,element:w.jsx(SM,{})}),w.jsx(Je,{path:`${je.PREPAID}/*`,element:w.jsx(OM,{})}),w.jsx(Je,{path:`${je.VOUCHER}/*`,element:w.jsx(MM,{})})]})}function LM(){const{t:e}=$e(),[t,n]=k.useState(!1);return w.jsx("div",{className:"default-bg-colors flex h-screen items-center justify-center",children:w.jsxs("div",{className:"overflow-hidden rounded-lg border border-gray-300 bg-white shadow-lg",children:[w.jsx("div",{className:"border-b border-gray-200 bg-gray-50 px-6 pb-3 pt-4 shadow",children:w.jsx("h2",{className:"text-3xl",children:"Oops!"})}),w.jsx("p",{className:"mt-4 px-6 text-gray-900",children:e("sorrySomethingWentWrong")}),w.jsx("div",{className:"mt-10 p-6",children:w.jsx(dt,{onClick:()=>{n(!0),window.location.replace("/")},pending:t,label:e("back")})})]})})}function Dp(e){"@babel/helpers - typeof";return Dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dp(e)}function Rb(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Dp(XMLHttpRequest))==="object"}function FM(e){return!!e&&typeof e.then=="function"}function jM(e){return FM(e)?e:Promise.resolve(e)}function VM(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Lp={exports:{}},ql={exports:{}},Nb;function UM(){return Nb||(Nb=1,function(e,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof $i<"u"&&$i,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a=typeof i<"u"&&i||typeof self<"u"&&self||typeof a<"u"&&a,c={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function u(P){return P&&DataView.prototype.isPrototypeOf(P)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(P){return P&&d.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function p(P){return typeof P!="string"&&(P=String(P)),P}function l(P){var V={next:function(){var z=P.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function m(P){this.map={},P instanceof m?P.forEach(function(V,z){this.append(z,V)},this):Array.isArray(P)?P.forEach(function(V){this.append(V[0],V[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(V){this.append(V,P[V])},this)}m.prototype.append=function(P,V){P=f(P),V=p(V);var z=this.map[P];this.map[P]=z?z+", "+V:V},m.prototype.delete=function(P){delete this.map[f(P)]},m.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},m.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},m.prototype.set=function(P,V){this.map[f(P)]=p(V)},m.prototype.forEach=function(P,V){for(var z in this.map)this.map.hasOwnProperty(z)&&P.call(V,this.map[z],z,this)},m.prototype.keys=function(){var P=[];return this.forEach(function(V,z){P.push(z)}),l(P)},m.prototype.values=function(){var P=[];return this.forEach(function(V){P.push(V)}),l(P)},m.prototype.entries=function(){var P=[];return this.forEach(function(V,z){P.push([z,V])}),l(P)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function g(P){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}function y(P){return new Promise(function(V,z){P.onload=function(){V(P.result)},P.onerror=function(){z(P.error)}})}function v(P){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(P),z}function b(P){var V=new FileReader,z=y(V);return V.readAsText(P),z}function E(P){for(var V=new Uint8Array(P),z=new Array(V.length),X=0;X<V.length;X++)z[X]=String.fromCharCode(V[X]);return z.join("")}function C(P){if(P.slice)return P.slice(0);var V=new Uint8Array(P.byteLength);return V.set(new Uint8Array(P)),V.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:c.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:c.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():c.arrayBuffer&&c.blob&&u(P)?(this._bodyArrayBuffer=C(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||h(P))?this._bodyArrayBuffer=C(P):this._bodyText=P=Object.prototype.toString.call(P):this._bodyText="",this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var P=g(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=g(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(v)}),this.text=function(){var P=g(this);if(P)return P;if(this._bodyBlob)return b(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(E(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(B)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function x(P){var V=P.toUpperCase();return T.indexOf(V)>-1?V:P}function R(P,V){if(!(this instanceof R))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V=V||{};var z=V.body;if(P instanceof R){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,V.headers||(this.headers=new m(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!z&&P._bodyInit!=null&&(z=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new m(V.headers)),this.method=x(V.method||this.method||"GET"),this.mode=V.mode||this.mode||null,this.signal=V.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&z)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(z),(this.method==="GET"||this.method==="HEAD")&&(V.cache==="no-store"||V.cache==="no-cache")){var X=/([?&])_=[^&]*/;if(X.test(this.url))this.url=this.url.replace(X,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function B(P){var V=new FormData;return P.trim().split("&").forEach(function(z){if(z){var X=z.split("="),re=X.shift().replace(/\+/g," "),oe=X.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(oe))}}),V}function F(P){var V=new m,z=P.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(X){return X.indexOf(`
158
158
  `)===0?X.substr(1,X.length):X}).forEach(function(X){var re=X.split(":"),oe=re.shift().trim();if(oe){var ce=re.join(":").trim();V.append(oe,ce)}}),V}A.call(R.prototype);function j(P,V){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');V||(V={}),this.type="default",this.status=V.status===void 0?200:V.status,this.ok=this.status>=200&&this.status<300,this.statusText=V.statusText===void 0?"":""+V.statusText,this.headers=new m(V.headers),this.url=V.url||"",this._initBody(P)}A.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},j.error=function(){var P=new j(null,{status:0,statusText:""});return P.type="error",P};var G=[301,302,303,307,308];j.redirect=function(P,V){if(G.indexOf(V)===-1)throw new RangeError("Invalid status code");return new j(null,{status:V,headers:{location:P}})},s.DOMException=a.DOMException;try{new s.DOMException}catch{s.DOMException=function(V,z){this.message=V,this.name=z;var X=Error(V);this.stack=X.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function H(P,V){return new Promise(function(z,X){var re=new R(P,V);if(re.signal&&re.signal.aborted)return X(new s.DOMException("Aborted","AbortError"));var oe=new XMLHttpRequest;function ce(){oe.abort()}oe.onload=function(){var de={status:oe.status,statusText:oe.statusText,headers:F(oe.getAllResponseHeaders()||"")};de.url="responseURL"in oe?oe.responseURL:de.headers.get("X-Request-URL");var Ee="response"in oe?oe.response:oe.responseText;setTimeout(function(){z(new j(Ee,de))},0)},oe.onerror=function(){setTimeout(function(){X(new TypeError("Network request failed"))},0)},oe.ontimeout=function(){setTimeout(function(){X(new TypeError("Network request failed"))},0)},oe.onabort=function(){setTimeout(function(){X(new s.DOMException("Aborted","AbortError"))},0)};function we(de){try{return de===""&&a.location.href?a.location.href:de}catch{return de}}oe.open(re.method,we(re.url),!0),re.credentials==="include"?oe.withCredentials=!0:re.credentials==="omit"&&(oe.withCredentials=!1),"responseType"in oe&&(c.blob?oe.responseType="blob":c.arrayBuffer&&re.headers.get("Content-Type")&&re.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(oe.responseType="arraybuffer")),V&&typeof V.headers=="object"&&!(V.headers instanceof m)?Object.getOwnPropertyNames(V.headers).forEach(function(de){oe.setRequestHeader(de,p(V.headers[de]))}):re.headers.forEach(function(de,Ee){oe.setRequestHeader(Ee,de)}),re.signal&&(re.signal.addEventListener("abort",ce),oe.onreadystatechange=function(){oe.readyState===4&&re.signal.removeEventListener("abort",ce)}),oe.send(typeof re._bodyInit>"u"?null:re._bodyInit)})}return H.polyfill=!0,a.fetch||(a.fetch=H,a.Headers=m,a.Request=R,a.Response=j),s.Headers=m,s.Request=R,s.Response=j,s.fetch=H,s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(ql,ql.exports)),ql.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof $i<"u"&&$i.fetch?n=$i.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof VM<"u"&&typeof window>"u"){var r=n||UM();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(Lp,Lp.exports);var Bb=Lp.exports;const Mb=td(Bb),Db=IE({__proto__:null,default:Mb},[Bb]);function Lb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Fb(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Lb(Object(n),!0).forEach(function(r){HM(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Lb(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function HM(e,t,n){return t=GM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function GM(e){var t=qM(e,"string");return Ui(t)=="symbol"?t:t+""}function qM(e,t){if(Ui(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Ui(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ui(e){"@babel/helpers - typeof";return Ui=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ui(e)}var To;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?To=global.fetch:typeof window<"u"&&window.fetch?To=window.fetch:To=fetch);var pc;Rb()&&(typeof global<"u"&&global.XMLHttpRequest?pc=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(pc=window.XMLHttpRequest));var $l;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?$l=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&($l=window.ActiveXObject)),!To&&Db&&!pc&&!$l&&(To=Mb||Db),typeof To!="function"&&(To=void 0);var Fp=function(t,n){if(n&&Ui(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},jb=function(t,n,r,o){var i=function(c){if(!c.ok)return r(c.statusText||"Error",{status:c.status});c.text().then(function(u){r(null,{status:c.status,data:u})}).catch(r)};if(o){var s=o(t,n);if(s instanceof Promise){s.then(i).catch(r);return}}typeof fetch=="function"?fetch(t,n).then(i).catch(r):To(t,n).then(i).catch(r)},Vb=!1,$M=function(t,n,r,o){t.queryStringParams&&(n=Fp(n,t.queryStringParams));var i=Fb({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);typeof window>"u"&&typeof global<"u"&&typeof global.process<"u"&&global.process.versions&&global.process.versions.node&&(i["User-Agent"]="i18next-http-backend (node/".concat(global.process.version,"; ").concat(global.process.platform," ").concat(global.process.arch,")")),r&&(i["Content-Type"]="application/json");var s=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,a=Fb({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:i},Vb?{}:s),c=typeof t.alternateFetch=="function"&&t.alternateFetch.length>=1?t.alternateFetch:void 0;try{jb(n,a,o,c)}catch(u){if(!s||Object.keys(s).length===0||!u.message||u.message.indexOf("not implemented")<0)return o(u);try{Object.keys(s).forEach(function(d){delete a[d]}),jb(n,a,o,c),Vb=!0}catch(d){o(d)}}},WM=function(t,n,r,o){r&&Ui(r)==="object"&&(r=Fp("",r).slice(1)),t.queryStringParams&&(n=Fp(n,t.queryStringParams));try{var i;pc?i=new pc:i=new $l("MSXML2.XMLHTTP.3.0"),i.open(r?"POST":"GET",n,1),t.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!t.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var s=t.customHeaders;if(s=typeof s=="function"?s():s,s)for(var a in s)i.setRequestHeader(a,s[a]);i.onreadystatechange=function(){i.readyState>3&&o(i.status>=400?i.statusText:null,{status:i.status,data:i.responseText})},i.send(r)}catch(c){console&&console.log(c)}},YM=function(t,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},To&&n.indexOf("file:")!==0)return $M(t,n,r,o);if(Rb()||typeof ActiveXObject=="function")return WM(t,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function qs(e){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qs(e)}function Ub(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function jp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ub(Object(n),!0).forEach(function(r){Hb(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ub(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function KM(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Gb(r.key),r)}}function XM(e,t,n){return t&&KM(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Hb(e,t,n){return t=Gb(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gb(e){var t=QM(e,"string");return qs(t)=="symbol"?t:t+""}function QM(e,t){if(qs(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var JM=function(){return{loadPath:"/locales/{{lng}}/{{ns}}.json",addPath:"/locales/add/{{lng}}/{{ns}}",parse:function(n){return JSON.parse(n)},stringify:JSON.stringify,parsePayload:function(n,r,o){return Hb({},r,o||"")},parseLoadPayload:function(n,r){},request:YM,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},qb=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};zM(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return XM(e,[{key:"init",value:function(n){var r=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.services=n,this.options=jp(jp(jp({},JM()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var s=setInterval(function(){return r.reload()},this.options.reloadInterval);qs(s)==="object"&&typeof s.unref=="function"&&s.unref()}}},{key:"readMulti",value:function(n,r,o){this._readAny(n,n,r,r,o)}},{key:"read",value:function(n,r,o){this._readAny([n],n,[r],r,o)}},{key:"_readAny",value:function(n,r,o,i,s){var a=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,o)),c=jM(c),c.then(function(u){if(!u)return s(null,{});var d=a.services.interpolator.interpolate(u,{lng:n.join("+"),ns:o.join("+")});a.loadUrl(d,s,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var s=this,a=typeof o=="string"?[o]:o,c=typeof i=="string"?[i]:i,u=this.options.parseLoadPayload(a,c);this.options.request(this.options,n,u,function(d,h){if(h&&(h.status>=500&&h.status<600||!h.status))return r("failed loading "+n+"; status code: "+h.status,!0);if(h&&h.status>=400&&h.status<500)return r("failed loading "+n+"; status code: "+h.status,!1);if(!h&&d&&d.message&&d.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+d.message,!0);if(d)return r(d,!1);var f,p;try{typeof h.data=="string"?f=s.options.parse(h.data,o,i):f=h.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,f)})}},{key:"create",value:function(n,r,o,i,s){var a=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,o,i),u=0,d=[],h=[];n.forEach(function(f){var p=a.options.addPath;typeof a.options.addPath=="function"&&(p=a.options.addPath(f,r));var l=a.services.interpolator.interpolate(p,{lng:f,ns:r});a.options.request(a.options,l,c,function(m,g){u+=1,d.push(m),h.push(g),u===n.length&&typeof s=="function"&&s(d,h)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,s=r.logger,a=o.language;if(!(a&&a.toLowerCase()==="cimode")){var c=[],u=function(h){var f=i.toResolveHierarchy(h);f.forEach(function(p){c.indexOf(p)<0&&c.push(p)})};u(a),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),c.forEach(function(d){n.allOptions.ns.forEach(function(h){o.read(d,h,"read",null,null,function(f,p){f&&s.warn("loading namespace ".concat(h," for language ").concat(d," failed"),f),!f&&p&&s.log("loaded namespace ".concat(h," for language ").concat(d),p),o.loaded("".concat(d,"|").concat(h),f,p)})})})}}}])}();qb.type="backend";const{slice:ZM,forEach:eD}=[];function tD(e){return eD.call(ZM.call(arguments,1),t=>{if(t)for(const n in t)e[n]===void 0&&(e[n]=t[n])}),e}const $b=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,nD=(e,t,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(t);let i=`${e}=${o}`;if(r.maxAge>0){const s=r.maxAge-0;if(Number.isNaN(s))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(s)}`}if(r.domain){if(!$b.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!$b.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},Wb={create(e,t,n,r){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+n*60*1e3)),r&&(o.domain=r),document.cookie=nD(e,encodeURIComponent(t),o)},read(e){const t=`${e}=`,n=document.cookie.split(";");for(let r=0;r<n.length;r++){let o=n[r];for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null},remove(e){this.create(e,"",-1)}};var rD={name:"cookie",lookup(e){let{lookupCookie:t}=e;if(t&&typeof document<"u")return Wb.read(t)||void 0},cacheUserLanguage(e,t){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=t;n&&typeof document<"u"&&Wb.create(n,e,r,o,i)}},oD={name:"querystring",lookup(e){var r;let{lookupQuerystring:t}=e,n;if(typeof window<"u"){let{search:o}=window.location;!window.location.search&&((r=window.location.hash)==null?void 0:r.indexOf("?"))>-1&&(o=window.location.hash.substring(window.location.hash.indexOf("?")));const s=o.substring(1).split("&");for(let a=0;a<s.length;a++){const c=s[a].indexOf("=");c>0&&s[a].substring(0,c)===t&&(n=s[a].substring(c+1))}}return n}};let mc=null;const Yb=()=>{if(mc!==null)return mc;try{mc=window!=="undefined"&&window.localStorage!==null;const e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{mc=!1}return mc};var iD={name:"localStorage",lookup(e){let{lookupLocalStorage:t}=e;if(t&&Yb())return window.localStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupLocalStorage:n}=t;n&&Yb()&&window.localStorage.setItem(n,e)}};let gc=null;const zb=()=>{if(gc!==null)return gc;try{gc=window!=="undefined"&&window.sessionStorage!==null;const e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{gc=!1}return gc};var sD={name:"sessionStorage",lookup(e){let{lookupSessionStorage:t}=e;if(t&&zb())return window.sessionStorage.getItem(t)||void 0},cacheUserLanguage(e,t){let{lookupSessionStorage:n}=t;n&&zb()&&window.sessionStorage.setItem(n,e)}},aD={name:"navigator",lookup(e){const t=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)t.push(n[i]);r&&t.push(r),o&&t.push(o)}return t.length>0?t:void 0}},cD={name:"htmlTag",lookup(e){let{htmlTag:t}=e,n;const r=t||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},uD={name:"path",lookup(e){var o;let{lookupFromPathIndex:t}=e;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof t=="number"?t:0])==null?void 0:o.replace("/",""):void 0}},lD={name:"subdomain",lookup(e){var o,i;let{lookupFromSubdomainIndex:t}=e;const n=typeof t=="number"?t+1:1,r=typeof window<"u"&&((i=(o=window.location)==null?void 0:o.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};function dD(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:e=>e}}class Kb{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=tD(n,this.options||{},dD()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=o=>o.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(rD),this.addDetector(oD),this.addDetector(iD),this.addDetector(sD),this.addDetector(aD),this.addDetector(cD),this.addDetector(uD),this.addDetector(lD)}addDetector(t){return this.detectors[t.name]=t,this}detect(t){t||(t=this.options.order);let n=[];return t.forEach(r=>{if(this.detectors[r]){let o=this.detectors[r].lookup(this.options);o&&typeof o=="string"&&(o=[o]),o&&(n=n.concat(o))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(t,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(t,this.options)}))}}Kb.type="languageDetector",dn.use(qb).use(Kb).use(tC).init({fallbackLng:"en",lng:navigator.language&&navigator.language.substring(0,2),interpolation:{escapeValue:!1},backend:{loadPath:"https://translations.piggy.eu/portal-sessions/{{lng}}.json"}});function Xb(){const{uuid:e,portalSession:t}=He(),[n,r]=k.useState();return _r({url:`${e}/brand-kit`,onData:r}),k.useEffect(()=>{n&&cx(n)},[n]),w.jsx(k.StrictMode,{children:w.jsxs(mh,{fallback:LM,children:[w.jsx(MT,{children:w.jsx(DM,{})}),w.jsx(xx,{enabled:t.inputData.enable_on_screen_keyboard}),w.jsx(U3,{className:"lg:top-14"})]})})}function Qb(e){const{uuid:t,portalSession:n,error:r}=He();return n.uuid?w.jsx(Bw.Provider,{value:{...e,cameraService:n.inputData.camera_service,cameraFacingMode:n.inputData.facing_mode,primaryIdentificationMethod:n.inputData.primary_identification_method},children:e.children}):w.jsx(Fr,{message:r&&`No portal session found with uuid: ${t}.`})}function fD(e){const{portalSession:t}=PC(e);return t?w.jsx(rd.Provider,{value:{apiKey:e.apiKey,host:e.host},children:w.jsx(p0,{uuid:t.uuid,children:w.jsx(Qb,{...e,children:w.jsx(Xb,{})})})}):w.jsx(Fr,{})}const hD="data:image/svg+xml,%3csvg%20width='24'%20height='25'%20viewBox='0%200%2024%2025'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M1.37482%209.55838C0.802045%2011.696%200.887351%2013.9567%201.61959%2016.045C2.35183%2018.1334%203.69695%2019.9524%205.47921%2021.2642C7.26146%2022.5761%209.39798%2023.3199%2011.6096%2023.3985C13.8212%2023.477%2016.0051%2022.8866%2017.876%2021.7045C19.7468%2020.5223%2021.2175%2018.8034%2022.0961%2016.7722C22.9746%2014.7411%2023.2201%2012.4921%2022.8004%2010.3193C22.3807%208.1464%2021.3154%206.15066%2019.7436%204.59277C18.1718%203.03489%2016.1667%201.98732%2013.9902%201.58693M7.14096%202.53681C5.21049%203.48732%203.60119%204.98315%202.51232%206.8391M10.7049%201.48193C10.452%201.51191%2010.2003%201.55066%209.95012%201.59811M18.1995%2015.656C18.757%2014.5927%2019.0317%2013.4039%2018.9971%2012.2038C18.9625%2011.0037%2018.6198%209.83263%2018.002%208.8032C17.3842%207.77377%2016.512%206.92055%2015.4692%206.32553C14.4264%205.73051%2013.2481%205.4137%2012.0476%205.40554C10.847%205.39739%209.66449%205.69816%208.61372%206.27895C7.56295%206.85974%206.67923%207.70104%206.04747%208.72198C5.41572%209.74292%205.05717%2010.9092%205.00628%2012.1087C4.9554%2013.3082%205.21389%2014.5007%205.75691%2015.5714M9.15764%2013.3648C9.00624%2012.9162%208.96314%2012.4382%209.03189%2011.9698C9.10064%2011.5014%209.27926%2011.0559%209.55317%2010.6697C9.82708%2010.2836%2010.1885%209.96774%2010.6079%209.74803C11.0272%209.52832%2011.4926%209.41098%2011.966%209.4056C12.4394%209.40023%2012.9074%209.50697%2013.3316%209.71709C13.7559%209.92722%2014.1244%2010.2348%2014.407%2010.6146C14.6896%2010.9944%2014.8783%2011.4358%2014.9576%2011.9025C15.037%2012.3692%2015.0048%2012.8481%2014.8636%2013.3M14.0993%2010.2622C14.0043%2010.1691%2013.9032%2010.0825%2013.7967%2010.0028M8.2478%2018.3147C9.32147%2018.9965%2010.5606%2019.3728%2011.832%2019.4033C13.1035%2019.4339%2014.3592%2019.1174%2015.4644%2018.488'%20stroke='%233430FF'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e";function pD({message:e}){return w.jsxs("div",{className:"flex h-screen flex-col justify-center gap-12 text-center",children:[w.jsxs("div",{className:"flex items-center justify-center gap-3",children:[w.jsx("img",{alt:"logo",src:hD,className:"z-10 h-16 w-16 hover:animate-spin"}),w.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",w.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),w.jsx("p",{className:"text-core-red-500",children:e})]})}function mD({uuid:e,host:t}){return e?w.jsx(rd.Provider,{value:{host:t},children:w.jsx(p0,{uuid:e,children:w.jsx(Qb,{children:w.jsx(Xb,{})})})}):w.jsx(pD,{message:"No uuid provided."})}const gD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M8 4.75V8.25M16 4.75V8.25M7.75 10.75H16.25M6.75 19.25H17.25C18.3546 19.25 19.25 18.3546 19.25 17.25V8.75C19.25 7.64543 18.3546 6.75 17.25 6.75H6.75C5.64543 6.75 4.75 7.64543 4.75 8.75V17.25C4.75 18.3546 5.64543 19.25 6.75 19.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),yD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("path",{d:"m21.25 7.5c.3796958 0 .693491.28215388.7431534.64822944l.0068466.10177056v8.5c0 1.7330315-1.3564548 3.1492459-3.0655761 3.2448552l-.1844239.0051448h-12.689l.71933009.7196699c.26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184c-.26626657.2662665-.68293025.2904726-.97654174.0726181l-.08411844-.0726181-2-2-.06339799-.0720275c-.00244939-.0031685-.00487398-.0063571-.00727348-.0095656l.07067147.0815931c-.03705327-.0370533-.06941902-.077019-.09709724-.1191603-.01316484-.0201549-.025545-.0411423-.03690171-.0627516-.00483354-.0091218-.00919014-.0178526-.01336588-.0266478-.01274712-.0267885-.02425172-.0552483-.03400215-.0845099-.00225837-.0069437-.00418282-.0130149-.00602813-.019105-.02092163-.0684786-.0322748-.1419912-.0322748-.2181555 0-.0383922.00288471-.0761107.00844919-.1129505.00180466-.0115676.0038603-.0232773.00619514-.0349422.00494363-.0250031.01111685-.0492994.01844184-.073091.00362656-.0116598.00765847-.0237092.01200456-.0356703.00848426-.0232976.01778613-.0453662.02808241-.0668678.00549219-.0116011.01179514-.0239381.01846187-.0361292.01323523-.0240158.02734042-.0467392.04258121-.0686124.00392129-.0057417.00832657-.0118713.01283554-.0179483.0251194-.0332177.04801831-.0595185.07261815-.0841184l2-2c.29289322-.2928932.76776696-.2928932 1.06066018 0 .26626656.2662666.29047261.6829303.07261815.9765418l-.07261815.0841184-.72033009.7196699h12.69c.9181734 0 1.6711923-.7071103 1.7441988-1.6064728l.0058012-.1435272v-8.5c0-.41421356.3357864-.75.75-.75zm-3.0537883-5.35294824.0841184.07261815 2 2c.0254481.02544812.049076.05271652.0706715.08159313l-.0706715-.08159313c.0370533.03705328.069419.07701901.0970972.1191603.0131649.02015493.025545.04114226.0369017.06275154.0048336.00912187.0091902.01785262.0133659.02664784.0127471.02678853.0242517.0552483.0340022.08450994.0022583.00694369.0041828.01301489.0060281.01910493.0209216.06847868.0322748.14199127.0322748.21815554 0 .03839224-.0028847.07611073-.0084492.11295053-.0014988.0095454-.0031606.01924362-.0050138.02891241-.0051364.02710922-.0117072.05340972-.0196232.07912072-.0036265.0116598-.0076584.02370928-.0120045.03567032-.0084843.02329763-.0177862.04536621-.0280824.06686781-.0054922.01160108-.0117952.02393815-.0184619.03612923-.0132352.02401575-.0273404.04673917-.0425812.06861233-.0039213.00574174-.0083266.01187138-.0128356.0179483-.023778.03144192-.0451015.05615345-.0679264.07938506l-.0046917.00473338-2 2c-.2928932.29289321-.767767.29289321-1.0606602 0-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844.7183301-.71966991h-12.688c-.9181734 0-1.67119234.70711027-1.7441988 1.60647279l-.0058012.14352721v8.5c0 .4142136-.33578644.75-.75.75-.37969577 0-.69349096-.2821539-.74315338-.6482294l-.00684662-.1017706v-8.5c0-1.73303146 1.35645477-3.14924593 3.06557609-3.24485521l.18442391-.00514479h12.689l-.7193301-.71966991c-.2662665-.26626657-.2904726-.68293025-.0726181-.97654174l.0726181-.08411844c.2662666-.26626656.6829303-.29047261.9765418-.07261815zm-6.1962117 5.85294824c2.209139 0 4 1.790861 4 4s-1.790861 4-4 4-4-1.790861-4-4 1.790861-4 4-4zm0 1.5c-1.3807119 0-2.5 1.1192881-2.5 2.5s1.1192881 2.5 2.5 2.5 2.5-1.1192881 2.5-2.5-1.1192881-2.5-2.5-2.5z",fill:"#212121"}))},Symbol.toStringTag,{value:"Module"})),vD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M13.25 8.75L9.75 12L13.25 15.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),wD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M17.25 6.75L6.75 17.25M6.75 6.75L17.25 17.25",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),bD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("path",{d:"M4.7002 4.70016L11.2999 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M11.2998 4.70016L4.70014 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),ED=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M14.25 8.75H11.375C10.4775 8.75 9.75 9.47754 9.75 10.375V10.375C9.75 11.2725 10.4775 12 11.375 12H12.625C13.5225 12 14.25 12.7275 14.25 13.625V13.625C14.25 14.5225 13.5225 15.25 12.625 15.25H9.75"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 7.75V8.25"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15.75V16.25"}))},Symbol.toStringTag,{value:"Module"})),CD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M19.25 19.25H13.75M9 18.25L4.75 19.25L5.75 15L15.0429 5.70711C15.4334 5.31658 16.0666 5.31658 16.4571 5.70711L18.2929 7.54289C18.6834 7.93342 18.6834 8.56658 18.2929 8.95711L9 18.25Z",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),_D=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M6.75024 19.2502H17.2502C18.3548 19.2502 19.2502 18.3548 19.2502 17.2502V9.75025L12.0002 4.75024L4.75024 9.75025V17.2502C4.75024 18.3548 5.64568 19.2502 6.75024 19.2502Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M9.74963 15.7493C9.74963 14.6447 10.6451 13.7493 11.7496 13.7493H12.2496C13.3542 13.7493 14.2496 14.6447 14.2496 15.7493V19.2493H9.74963V15.7493Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),SD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 13V15"}),ue.createElement("circle",{cx:12,cy:9,r:.5}),ue.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}))},Symbol.toStringTag,{value:"Module"})),AD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...e},ue.createElement("path",{d:"M5.5 6.5L12 12.25L18.5 6.5M6.75 18.25H17.25C18.3546 18.25 19.25 17.3546 19.25 16.25V7.75C19.25 6.64543 18.3546 5.75 17.25 5.75H6.75C5.64543 5.75 4.75 6.64543 4.75 7.75V16.25C4.75 17.3546 5.64543 18.25 6.75 18.25Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),ID=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_17_95)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#FEF3F2"}),ue.createElement("path",{d:"M12.0003 12L20.0003 20M12.0003 20L20.0003 12",stroke:"#E02731",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_17_95"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),TD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_15_20)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#E7FBF4"}),ue.createElement("path",{d:"M10.6668 17.3333L14.6668 20L21.3335 12",stroke:"#039855",strokeWidth:1.6875,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_15_20"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0V0C24.8366 0 32 7.16344 32 16V16C32 24.8366 24.8366 32 16 32V32C7.16344 32 0 24.8366 0 16V16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),xD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},ue.createElement("g",{clipPath:"url(#clip0_17_99)"},ue.createElement("rect",{width:32,height:32,rx:4,fill:"#FFFAEB"}),ue.createElement("path",{d:"M16.0002 17.3333V13.3333M16.0002 20V20.0067M23.0353 19.3333L17.942 10.456C17.0833 8.95867 14.9167 8.95867 14.058 10.456L8.96533 19.3333C8.11266 20.8187 9.18933 22.6667 10.9073 22.6667H21.0933C22.8107 22.6667 23.8873 20.8187 23.0353 19.3333Z",stroke:"#CFAA25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ue.createElement("defs",null,ue.createElement("clipPath",{id:"clip0_17_99"},ue.createElement("path",{d:"M0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16Z",fill:"white"}))))},Symbol.toStringTag,{value:"Module"})),kD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M13.1191 5.61336C13.0508 5.11856 12.6279 4.75 12.1285 4.75H11.8715C11.3721 4.75 10.9492 5.11856 10.8809 5.61336L10.7938 6.24511C10.7382 6.64815 10.4403 6.96897 10.0622 7.11922C10.006 7.14156 9.95021 7.16484 9.89497 7.18905C9.52217 7.3524 9.08438 7.3384 8.75876 7.09419L8.45119 6.86351C8.05307 6.56492 7.49597 6.60451 7.14408 6.9564L6.95641 7.14408C6.60452 7.49597 6.56492 8.05306 6.86351 8.45118L7.09419 8.75876C7.33841 9.08437 7.3524 9.52216 7.18905 9.89497C7.16484 9.95021 7.14156 10.006 7.11922 10.0622C6.96897 10.4403 6.64815 10.7382 6.24511 10.7938L5.61336 10.8809C5.11856 10.9492 4.75 11.372 4.75 11.8715V12.1285C4.75 12.6279 5.11856 13.0508 5.61336 13.1191L6.24511 13.2062C6.64815 13.2618 6.96897 13.5597 7.11922 13.9378C7.14156 13.994 7.16484 14.0498 7.18905 14.105C7.3524 14.4778 7.3384 14.9156 7.09419 15.2412L6.86351 15.5488C6.56492 15.9469 6.60451 16.504 6.9564 16.8559L7.14408 17.0436C7.49597 17.3955 8.05306 17.4351 8.45118 17.1365L8.75876 16.9058C9.08437 16.6616 9.52216 16.6476 9.89496 16.811C9.95021 16.8352 10.006 16.8584 10.0622 16.8808C10.4403 17.031 10.7382 17.3519 10.7938 17.7549L10.8809 18.3866C10.9492 18.8814 11.3721 19.25 11.8715 19.25H12.1285C12.6279 19.25 13.0508 18.8814 13.1191 18.3866L13.2062 17.7549C13.2618 17.3519 13.5597 17.031 13.9378 16.8808C13.994 16.8584 14.0498 16.8352 14.105 16.8109C14.4778 16.6476 14.9156 16.6616 15.2412 16.9058L15.5488 17.1365C15.9469 17.4351 16.504 17.3955 16.8559 17.0436L17.0436 16.8559C17.3955 16.504 17.4351 15.9469 17.1365 15.5488L16.9058 15.2412C16.6616 14.9156 16.6476 14.4778 16.811 14.105C16.8352 14.0498 16.8584 13.994 16.8808 13.9378C17.031 13.5597 17.3519 13.2618 17.7549 13.2062L18.3866 13.1191C18.8814 13.0508 19.25 12.6279 19.25 12.1285V11.8715C19.25 11.3721 18.8814 10.9492 18.3866 10.8809L17.7549 10.7938C17.3519 10.7382 17.031 10.4403 16.8808 10.0622C16.8584 10.006 16.8352 9.95021 16.8109 9.89496C16.6476 9.52216 16.6616 9.08437 16.9058 8.75875L17.1365 8.4512C17.4351 8.05308 17.3955 7.49599 17.0436 7.1441L16.8559 6.95642C16.504 6.60453 15.9469 6.56494 15.5488 6.86353L15.2412 7.09419C14.9156 7.33841 14.4778 7.3524 14.105 7.18905C14.0498 7.16484 13.994 7.14156 13.9378 7.11922C13.5597 6.96897 13.2618 6.64815 13.2062 6.24511L13.1191 5.61336Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),ue.createElement("path",{d:"M13.25 12C13.25 12.6904 12.6904 13.25 12 13.25C11.3096 13.25 10.75 12.6904 10.75 12C10.75 11.3096 11.3096 10.75 12 10.75C12.6904 10.75 13.25 11.3096 13.25 12Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),OD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75H5.75V16.75L4.75 19.25H19.25L18.25 16.75V7.75Z"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75L16.25 4.75H7.75L5.75 7.75"}),ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 10.75V11.75C9.75 12.9926 10.7574 14 12 14V14C13.2426 14 14.25 12.9926 14.25 11.75V10.75"}))},Symbol.toStringTag,{value:"Module"})),PD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},ue.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 4.75L13.75 10.25H19.25L14.75 13.75L16.25 19.25L12 15.75L7.75 19.25L9.25 13.75L4.75 10.25H10.25L12 4.75Z"}))},Symbol.toStringTag,{value:"Module"})),RD=Object.freeze(Object.defineProperty({__proto__:null,default:e=>ue.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",...e},ue.createElement("path",{d:"M15.25 8C15.25 9.79493 13.7949 11.25 12 11.25C10.205 11.25 8.74997 9.79493 8.74997 8C8.74997 6.20507 10.205 4.75 12 4.75C13.7949 4.75 15.25 6.20507 15.25 8Z"}),ue.createElement("path",{d:"M6.84748 19.25H17.1525C18.2944 19.25 19.174 18.2681 18.6407 17.2584C17.8563 15.7731 16.068 14 12 14C7.93198 14 6.14364 15.7731 5.35921 17.2584C4.82594 18.2681 5.70556 19.25 6.84748 19.25Z"}))},Symbol.toStringTag,{value:"Module"})),ND=Object.freeze(Object.defineProperty({__proto__:null,createWorker:()=>new Worker(URL.createObjectURL(new Blob([`class x{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new x(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;f<b+d;f++)for(let g=a;g<a+c;g++)this.set(g,f,!!e)}}
159
159
  class A{constructor(a,b,c){this.width=a;a*=b;if(c&&c.length!==a)throw Error("Wrong buffer size");this.data=c||new Uint8ClampedArray(a)}get(a,b){return this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c}}
160
160
  class ba{constructor(a){this.bitOffset=this.byteOffset=0;this.bytes=a}readBits(a){if(1>a||32<a||a>this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0<this.bitOffset){b=8-this.bitOffset;var c=a<b?a:b;b-=c;b=(this.bytes[this.byteOffset]&255>>8-c<<b)>>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0<a){for(;8<=a;)b=b<<8|this.bytes[this.byteOffset]&255,this.byteOffset++,a-=8;0<a&&(c=8-a,b=b<<a|(this.bytes[this.byteOffset]&255>>c<<c)>>c,