@leatcom/portal-sessions 0.0.95-beta.2 → 0.0.96
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(yt,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(yt=typeof globalThis<"u"?globalThis:yt||self,x(yt.PortalSessions={},yt.React,yt.ReactDOM))})(this,function(yt,x,ki){"use strict";var uR=Object.defineProperty;var lR=(yt,x,ki)=>x in yt?uR(yt,x,{enumerable:!0,configurable:!0,writable:!0,value:ki}):yt[x]=ki;var sr=(yt,x,ki)=>lR(yt,typeof x!="symbol"?x+"":x,ki);try{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new yt.Error().stack;x&&(yt._sentryDebugIds=yt._sentryDebugIds||{},yt._sentryDebugIds[x]="
|
|
1
|
+
(function(yt,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],x):(yt=typeof globalThis<"u"?globalThis:yt||self,x(yt.PortalSessions={},yt.React,yt.ReactDOM))})(this,function(yt,x,ki){"use strict";var uR=Object.defineProperty;var lR=(yt,x,ki)=>x in yt?uR(yt,x,{enumerable:!0,configurable:!0,writable:!0,value:ki}):yt[x]=ki;var sr=(yt,x,ki)=>lR(yt,typeof x!="symbol"?x+"":x,ki);try{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new yt.Error().stack;x&&(yt._sentryDebugIds=yt._sentryDebugIds||{},yt._sentryDebugIds[x]="0ae7115d-1cab-41f2-a0f0-49820f77a416",yt._sentryDebugIdIdentifier="sentry-dbid-0ae7115d-1cab-41f2-a0f0-49820f77a416")}catch{}{let yt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};yt._sentryModuleMetadata=yt._sentryModuleMetadata||{},yt._sentryModuleMetadata[new yt.Error().stack]=Object.assign({},yt._sentryModuleMetadata[new yt.Error().stack],{"_sentryBundlerPluginAppKey:portal-sessions-application-key":!0})}function Iw(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}function Tw(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}const ce=Iw(x);{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"a10714ecb475a0ef90e2768fe086d6e8e7984bd7"}}var Zo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sl(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cl={exports:{}},_a={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -151,7 +151,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
151
151
|
matrix: null
|
|
152
152
|
`),e.append(`>>
|
|
153
153
|
`),e.toString()},t.prototype.setMode=function(e){this.mode=e},t.prototype.setECLevel=function(e){this.ecLevel=e},t.prototype.setVersion=function(e){this.version=e},t.prototype.setMaskPattern=function(e){this.maskPattern=e},t.prototype.setMatrix=function(e){this.matrix=e},t.isValidMaskPattern=function(e){return e>=0&&e<t.NUM_MASK_PATTERNS},t.NUM_MASK_PATTERNS=8,t}(),WO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ii=function(t){function e(){return t!==null&&t.apply(this,arguments)||this}return WO(e,t),e.kind="WriterException",e}(tr);(function(){function t(){}return t.clearMatrix=function(e){e.clear(255)},t.buildMatrix=function(e,n,r,o,i){t.clearMatrix(i),t.embedBasicPatterns(r,i),t.embedTypeInfo(n,o,i),t.maybeEmbedVersionInfo(r,i),t.embedDataBits(e,o,i)},t.embedBasicPatterns=function(e,n){t.embedPositionDetectionPatternsAndSeparators(n),t.embedDarkDotAtLeftBottomCorner(n),t.maybeEmbedPositionAdjustmentPatterns(e,n),t.embedTimingPatterns(n)},t.embedTypeInfo=function(e,n,r){var o=new Jr;t.makeTypeInfoBits(e,n,o);for(var i=0,a=o.getSize();i<a;++i){var s=o.get(o.getSize()-1-i),c=t.TYPE_INFO_COORDINATES[i],l=c[0],f=c[1];if(r.setBoolean(l,f,s),i<8){var h=r.getWidth()-i-1,d=8;r.setBoolean(h,d,s)}else h=8,d=r.getHeight()-7+(i-8),r.setBoolean(h,d,s)}},t.maybeEmbedVersionInfo=function(e,n){if(!(e.getVersionNumber()<7)){var r=new Jr;t.makeVersionInfoBits(e,r);for(var o=17,i=0;i<6;++i)for(var a=0;a<3;++a){var s=r.get(o);o--,n.setBoolean(i,n.getHeight()-11+a,s),n.setBoolean(n.getHeight()-11+a,i,s)}}},t.embedDataBits=function(e,n,r){for(var o=0,i=-1,a=r.getWidth()-1,s=r.getHeight()-1;a>0;){for(a===6&&(a-=1);s>=0&&s<r.getHeight();){for(var c=0;c<2;++c){var l=a-c;if(t.isEmpty(r.get(l,s))){var f=void 0;o<e.getSize()?(f=e.get(o),++o):f=!1,n!==255&&qO.getDataMaskBit(n,l,s)&&(f=!f),r.setBoolean(l,s,f)}}s+=i}s+=i=-i,a-=2}if(o!==e.getSize())throw new Ii("Not all bits consumed: "+o+"/"+e.getSize())},t.findMSBSet=function(e){return 32-Tn.numberOfLeadingZeros(e)},t.calculateBCHCode=function(e,n){if(n===0)throw new Ke("0 polynomial");var r=t.findMSBSet(n);for(e<<=r-1;t.findMSBSet(e)>=r;)e^=n<<t.findMSBSet(e)-r;return e},t.makeTypeInfoBits=function(e,n,r){if(!HO.isValidMaskPattern(n))throw new Ii("Invalid mask pattern");var o=e.getBits()<<3|n;r.appendBits(o,5);var i=t.calculateBCHCode(o,t.TYPE_INFO_POLY);r.appendBits(i,10);var a=new Jr;if(a.appendBits(t.TYPE_INFO_MASK_PATTERN,15),r.xor(a),r.getSize()!==15)throw new Ii("should not happen but we got: "+r.getSize())},t.makeVersionInfoBits=function(e,n){n.appendBits(e.getVersionNumber(),6);var r=t.calculateBCHCode(e.getVersionNumber(),t.VERSION_INFO_POLY);if(n.appendBits(r,12),n.getSize()!==18)throw new Ii("should not happen but we got: "+n.getSize())},t.isEmpty=function(e){return e===255},t.embedTimingPatterns=function(e){for(var n=8;n<e.getWidth()-8;++n){var r=(n+1)%2;t.isEmpty(e.get(n,6))&&e.setNumber(n,6,r),t.isEmpty(e.get(6,n))&&e.setNumber(6,n,r)}},t.embedDarkDotAtLeftBottomCorner=function(e){if(e.get(8,e.getHeight()-8)===0)throw new Ii;e.setNumber(8,e.getHeight()-8,1)},t.embedHorizontalSeparationPattern=function(e,n,r){for(var o=0;o<8;++o){if(!t.isEmpty(r.get(e+o,n)))throw new Ii;r.setNumber(e+o,n,0)}},t.embedVerticalSeparationPattern=function(e,n,r){for(var o=0;o<7;++o){if(!t.isEmpty(r.get(e,n+o)))throw new Ii;r.setNumber(e,n+o,0)}},t.embedPositionAdjustmentPattern=function(e,n,r){for(var o=0;o<5;++o)for(var i=t.POSITION_ADJUSTMENT_PATTERN[o],a=0;a<5;++a)r.setNumber(e+a,n+o,i[a])},t.embedPositionDetectionPattern=function(e,n,r){for(var o=0;o<7;++o)for(var i=t.POSITION_DETECTION_PATTERN[o],a=0;a<7;++a)r.setNumber(e+a,n+o,i[a])},t.embedPositionDetectionPatternsAndSeparators=function(e){var n=t.POSITION_DETECTION_PATTERN[0].length;t.embedPositionDetectionPattern(0,0,e),t.embedPositionDetectionPattern(e.getWidth()-n,0,e),t.embedPositionDetectionPattern(0,e.getWidth()-n,e),t.embedHorizontalSeparationPattern(0,7,e),t.embedHorizontalSeparationPattern(e.getWidth()-8,7,e),t.embedHorizontalSeparationPattern(0,e.getWidth()-8,e),t.embedVerticalSeparationPattern(7,0,e),t.embedVerticalSeparationPattern(e.getHeight()-7-1,0,e),t.embedVerticalSeparationPattern(7,e.getHeight()-7,e)},t.maybeEmbedPositionAdjustmentPatterns=function(e,n){if(!(e.getVersionNumber()<2))for(var r=e.getVersionNumber()-1,o=t.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[r],i=0,a=o.length;i!==a;i++){var s=o[i];if(s>=0)for(var c=0;c!==a;c++){var l=o[c];l>=0&&t.isEmpty(n.get(l,s))&&t.embedPositionAdjustmentPattern(l-2,s-2,n)}}},t.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])]),t.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])]),t.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])]),t.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])]),t.VERSION_INFO_POLY=7973,t.TYPE_INFO_POLY=1335,t.TYPE_INFO_MASK_PATTERN=21522,t})(),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]),nr.UTF8.getName()}();var YO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o,i,a,s,c,l){var f=t.call(this,s,c)||this;if(f.yuvData=n,f.dataWidth=r,f.dataHeight=o,f.left=i,f.top=a,i+s>r||a+c>o)throw new Ke("Crop rectangle does not fit within image data.");return l&&f.reverseHorizontal(s,c),f}YO(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("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 Ft.arraycopy(this.yuvData,i,r,0,o),r},e.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),a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ft.arraycopy(this.yuvData,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Ft.arraycopy(this.yuvData,a,i,c,n),a+=this.dataWidth}return i},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return new e(this.yuvData,this.dataWidth,this.dataHeight,this.left+n,this.top+r,o,i,!1)},e.prototype.renderThumbnail=function(){for(var n=this.getWidth()/e.THUMBNAIL_SCALE_FACTOR,r=this.getHeight()/e.THUMBNAIL_SCALE_FACTOR,o=new Int32Array(n*r),i=this.yuvData,a=this.top*this.dataWidth+this.left,s=0;s<r;s++){for(var c=s*n,l=0;l<n;l++){var f=255&i[a+l*e.THUMBNAIL_SCALE_FACTOR];o[c+l]=4278190080|65793*f}a+=this.dataWidth*e.THUMBNAIL_SCALE_FACTOR}return o},e.prototype.getThumbnailWidth=function(){return this.getWidth()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.getThumbnailHeight=function(){return this.getHeight()/e.THUMBNAIL_SCALE_FACTOR},e.prototype.reverseHorizontal=function(n,r){for(var o=this.yuvData,i=0,a=this.top*this.dataWidth+this.left;i<r;i++,a+=this.dataWidth)for(var s=a+n/2,c=a,l=a+n-1;c<s;c++,l--){var f=o[c];o[c]=o[l],o[l]=f}},e.prototype.invert=function(){return new ku(this)},e.THUMBNAIL_SCALE_FACTOR=2})(Os);var KO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o,i,a,s,c){var l=t.call(this,r,o)||this;if(l.dataWidth=i,l.dataHeight=a,l.left=s,l.top=c,n.BYTES_PER_ELEMENT===4){for(var f=r*o,h=new Uint8ClampedArray(f),d=0;d<f;d++){var p=n[d],u=p>>16&255,g=p>>7&510,m=255&p;h[d]=(u+g+m)/4&255}l.luminances=h}else l.luminances=n;if(i===void 0&&(l.dataWidth=r),a===void 0&&(l.dataHeight=o),s===void 0&&(l.left=0),c===void 0&&(l.top=0),l.left+r>l.dataWidth||l.top+o>l.dataHeight)throw new Ke("Crop rectangle does not fit within image data.");return l}KO(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("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 Ft.arraycopy(this.luminances,i,r,0,o),r},e.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),a=this.top*this.dataWidth+this.left;if(n===this.dataWidth)return Ft.arraycopy(this.luminances,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Ft.arraycopy(this.luminances,a,i,c,n),a+=this.dataWidth}return i},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return new e(this.luminances,o,i,this.dataWidth,this.dataHeight,this.left+n,this.top+r)},e.prototype.invert=function(){return new ku(this)}})(Os);var zO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(){return t!==null&&t.apply(this,arguments)||this}zO(e,t),e.forName=function(n){return this.getCharacterSetECIByName(n)}})(nr);var $O=function(){function t(e){this.previous=e}return t.prototype.getPrevious=function(){return this.previous},t}(),XO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),wv=function(t){function e(n,r,o){var i=t.call(this,n)||this;return i.value=r,i.bitCount=o,i}return XO(e,t),e.prototype.appendTo=function(n,r){n.appendBits(this.value,this.bitCount)},e.prototype.add=function(n,r){return new e(this,n,r)},e.prototype.addBinaryShift=function(n,r){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new e(this,n,r)},e.prototype.toString=function(){var n=this.value&(1<<this.bitCount)-1;return n|=1<<this.bitCount,"<"+Tn.toBinaryString(n|1<<this.bitCount).substring(1)+">"},e}($O),QO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r,o){var i=t.call(this,n,0,0)||this;return i.binaryShiftStart=r,i.binaryShiftByteCount=o,i}QO(e,t),e.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)},e.prototype.addBinaryShift=function(n,r){return new e(this,n,r)},e.prototype.toString=function(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}})(wv),new wv(null,0,0);var JO=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};(function(t){var e,n;try{for(var r=JO(t),o=r.next();!o.done;o=r.next()){var i=o.value;gr.fill(i,-1)}}catch(a){e={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}t[0][4]=0,t[1][4]=0,t[1][0]=28,t[3][4]=0,t[2][4]=0,t[2][0]=15})(gr.createInt32Array(6,6)),function(t){var e=bn.getCharCode(" "),n=bn.getCharCode("."),r=bn.getCharCode(",");t[0][e]=1;for(var o=bn.getCharCode("Z"),i=bn.getCharCode("A"),a=i;a<=o;a++)t[0][a]=a-i+2;t[1][e]=1;var s=bn.getCharCode("z"),c=bn.getCharCode("a");for(a=c;a<=s;a++)t[1][a]=a-c+2;t[2][e]=1;var l=bn.getCharCode("9"),f=bn.getCharCode("0");for(a=f;a<=l;a++)t[2][a]=a-f+2;t[2][r]=12,t[2][n]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
154
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],d=0;d<h.length;d++)t[3][bn.getCharCode(h[d])]=d;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(d=0;d<p.length;d++)bn.getCharCode(p[d])>0&&(t[4][bn.getCharCode(p[d])]=d)}(gr.createInt32Array(5,256));var ZO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),eP=function(t){function e(n){var r=t.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=e.makeBufferFromCanvasImageData(n),r}return ZO(e,t),e.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 e.toGrayscaleBuffer(o.data,n.width,n.height)},e.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),a=0,s=0,c=n.length;a<c;a+=4,s++){var l=void 0;n[a+3]===0?l=255:l=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=l}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("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},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return t.prototype.crop.call(this,n,r,o,i),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.invert=function(){return new ku(this)},e.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},e.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*e.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*a),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*a);r.width=s,r.height=c;var l=r.getContext("2d");if(!l)throw new Error("Could not create a Convas Context element.");return l.translate(s/2,c/2),l.rotate(o),l.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(Os);function bv(){return typeof navigator<"u"}function tP(){return!!(bv()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var va=function(){return va=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},va.apply(this,arguments)},Jt=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(l){try{c(r.next(l))}catch(f){i(f)}}function s(l){try{c(r.throw(l))}catch(f){i(f)}}function c(l){var f;l.done?o(l.value):(f=l.value,f instanceof n?f:new n(function(h){h(f)})).then(a,s)}c((r=r.apply(t,[])).next())})},Zt=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(l){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&f[0]?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[2&f[0],o.value]),f[0]){case 0:case 1:o=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,r=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){a.label=f[1];break}if(f[0]===6&&a.label<o[1]){a.label=o[1],o=f;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(f);break}o[2]&&a.ops.pop(),a.trys.pop();continue}f=e.call(t,a)}catch(h){f=[6,h],r=0}finally{n=o=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([c,l])}}},Yu=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nP={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},wa=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=va(va({},nP),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Dt.POSSIBLE_FORMATS,e)},enumerable:!1,configurable:!0}),t.addVideoSource=function(e,n){try{e.srcObject=n}catch{e.src=URL.createObjectURL(n)}},t.mediaStreamSetTorch=function(e,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,e.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},t.mediaStreamIsTorchCompatible=function(e){var n,r,o=e.getVideoTracks();try{for(var i=Yu(o),a=i.next();!a.done;a=i.next()){var s=a.value;if(t.mediaStreamIsTorchCompatibleTrack(s))return!0}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},t.mediaStreamIsTorchCompatibleTrack=function(e){try{return"torch"in e.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}},t.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&e.readyState>2},t.getMediaElement=function(e,n){var r=document.getElementById(e);if(!r)throw new Qt("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Qt("element with id '"+e+"' must be an "+n+" element");return r},t.createVideoElement=function(e){if(e instanceof HTMLVideoElement)return e;if(typeof e=="string")return t.getMediaElement(e,"video");if(!e&&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!")},t.prepareImageElement=function(e){if(e instanceof HTMLImageElement)return e;if(typeof e=="string")return t.getMediaElement(e,"img");if(e===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},t.prepareVideoElement=function(e){var n=t.createVideoElement(e);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},t.isImageLoaded=function(e){return!!e.complete&&e.naturalWidth!==0},t.createBinaryBitmapFromCanvas=function(e){var n=new eP(e),r=new jy(n);return new Ly(r)},t.drawImageOnCanvas=function(e,n){e.drawImage(n,0,0)},t.getMediaElementDimensions=function(e){if(e instanceof HTMLVideoElement)return{height:e.videoHeight,width:e.videoWidth};if(e instanceof HTMLImageElement)return{height:e.naturalHeight||e.height,width:e.naturalWidth||e.width};throw new Error("Couldn't find the Source's dimentions!")},t.createCaptureCanvas=function(e){if(!e)throw new Qt("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=t.getMediaElementDimensions(e),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},t.tryPlayVideo=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(e!=null&&e.ended)return console.error("Trying to play video that has ended."),[2,!1];if(t.isVideoPlaying(e))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,e.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]}})})},t.createCanvasFromMediaElement=function(e){var n=t.createCaptureCanvas(e),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return t.drawImageOnCanvas(r,e),n},t.createBinaryBitmapFromMediaElem=function(e){var n=t.createCanvasFromMediaElement(e);return t.createBinaryBitmapFromCanvas(n)},t.destroyImageElement=function(e){e.src="",e.removeAttribute("src"),e=void 0},t.listVideoInputDevices=function(){return Jt(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,l,f,h,d;return Zt(this,function(p){switch(p.label){case 0:if(!bv())throw new Error("Can't enumerate devices, navigator is not present.");if(!tP())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=Yu(e),o=r.next();!o.done;o=r.next())i=o.value,(a=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(s=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),l=i.groupId,f={deviceId:s,label:c,kind:a,groupId:l},n.push(f))}catch(u){h={error:u}}finally{try{o&&!o.done&&(d=r.return)&&d.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:return[4,t.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===e})]:[2]}})})},t.cleanVideoSource=function(e){if(e){try{e.srcObject=null}catch{e.src=""}e&&e.removeAttribute("src")}},t.playVideoOnLoadAsync=function(e,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,t.tryPlayVideo(e)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var a=setTimeout(function(){t.isVideoPlaying(e)||(i(!1),e.removeEventListener("canplay",s))},n),s=function(){t.tryPlayVideo(e).then(function(c){clearTimeout(a),e.removeEventListener("canplay",s),o(c)})};e.addEventListener("canplay",s)})]}})})},t.attachStreamToVideo=function(e,n,r){return r===void 0&&(r=5e3),Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return o=t.prepareVideoElement(n),t.addVideoSource(o,e),[4,t.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},t._waitImageLoad=function(e){return new Promise(function(n,r){var o=setTimeout(function(){t.isImageLoaded(e)||(e.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),e.removeEventListener("load",i),n()};e.addEventListener("load",i)})},t.checkCallbackFnOrThrow=function(e){if(!e)throw new Qt("`callbackFn` is a required parameter, you cannot capture results without it.")},t.disposeMediaStream=function(e){e.getVideoTracks().forEach(function(n){return n.stop()}),e=void 0},t.prototype.decode=function(e){var n=t.createCanvasFromMediaElement(e);return this.decodeFromCanvas(n)},t.prototype.decodeBitmap=function(e){return this.reader.decode(e,this.hints)},t.prototype.decodeFromCanvas=function(e){var n=t.createBinaryBitmapFromCanvas(e);return this.decodeBitmap(n)},t.prototype.decodeFromImageElement=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!e)throw new Qt("An image element must be provided.");return n=t.prepareImageElement(e),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},t.prototype.decodeFromImageUrl=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!e)throw new Qt("An URL must be provided.");(n=t.prepareImageElement()).src=e,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 t.destroyImageElement(n),[7];case 4:return[2]}})})},t.prototype.decodeFromConstraints=function(e,n,r){return Jt(this,void 0,void 0,function(){var o,i;return Zt(this,function(a){switch(a.label){case 0:return t.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(e)];case 1:o=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,a.sent()];case 4:throw i=a.sent(),t.disposeMediaStream(o),i;case 5:return[2]}})})},t.prototype.decodeFromStream=function(e,n,r){return Jt(this,void 0,void 0,function(){var o,i,a,s,c,l,f,h,d,p,u=this;return Zt(this,function(g){switch(g.label){case 0:return t.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,t.attachStreamToVideo(e,n,o)];case 1:return i=g.sent(),a=function(){var m,y;try{for(var w=Yu(e.getVideoTracks()),b=w.next();!b.done;b=w.next())b.value.stop()}catch(E){m={error:E}}finally{try{b&&!b.done&&(y=w.return)&&y.call(w)}finally{if(m)throw m.error}}e=void 0},s=function(){a(),t.cleanVideoSource(i)},c=this.scan(i,r,s),l=e.getVideoTracks(),f=va(va({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return Jt(this,void 0,void 0,function(){var w,b,E,C,S,T;return Zt(this,function(P){switch(P.label){case 0:w=y?l.filter(y):l,P.label=1;case 1:P.trys.push([1,6,7,8]),b=Yu(w),E=b.next(),P.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(m)];case 3:P.sent(),P.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=P.sent(),S={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(S)throw S.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return l.find(m).getConstraints()},streamVideoSettingsGet:function(m){return l.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return l.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=l==null?void 0:l.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),d=function(m){return Jt(u,void 0,void 0,function(){return Zt(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},f.switchTorch=d,p=function(){c.stop(),d(!1)},f.stop=p),[2,f]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return t.checkCallbackFnOrThrow(r),o={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},t.prototype.decodeFromVideoElement=function(e,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Qt("A video element must be provided.");return r=t.prepareVideoElement(e),o=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},t.prototype.decodeFromVideoUrl=function(e,n){return Jt(this,void 0,void 0,function(){var r,o,i;return Zt(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Qt("An URL must be provided.");return(r=t.prepareVideoElement()).src=e,o=function(){t.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,i)];case 1:return a.sent(),[2,this.scan(r,n,o)]}})})},t.prototype.decodeOnceFromConstraints=function(e,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromStream=function(e,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:return r=!!n,[4,t.attachStreamToVideo(e,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||t.cleanVideoSource(o),[7];case 5:return[2]}})})},t.prototype.decodeOnceFromVideoDevice=function(e,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return r={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoElement=function(e){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!e)throw new Qt("A video element must be provided.");return n=t.prepareVideoElement(e),r=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoUrl=function(e){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!e)throw new Qt("An URL must be provided.");(n=t.prepareVideoElement()).src=e,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 t.cleanVideoSource(n),[7];case 4:return[2]}})})},t.prototype.scanOneResult=function(e,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(a,s){i.scan(e,function(c,l,f){if(c)return a(c),void f.stop();if(l){if(l instanceof ge&&n||l instanceof pn&&r||l instanceof Ie&&o)return;f.stop(),s(l)}})})},t.prototype.scan=function(e,n,r){var o=this;t.checkCallbackFnOrThrow(n);var i=t.createCaptureCanvas(e),a=i.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var s,c=function(){a=void 0,i=void 0},l=!1,f={stop:function(){l=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!l)try{t.drawImageOnCanvas(a,e);var d=o.decodeFromCanvas(i);n(d,void 0,f),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,f),p instanceof pn||p instanceof Ie||p instanceof ge)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),f},t.prototype._decodeOnLoadImage=function(e){return Jt(this,void 0,void 0,function(){return Zt(this,function(n){switch(n.label){case 0:return t.isImageLoaded(e)?[3,2]:[4,t._waitImageLoad(e)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(e)]}})})},t}(),rP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Du,n,r)||this}rP(e,t)})(wa);var oP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new ma(n),n,r)||this}oP(e,t)})(wa);var iP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Uu,n,r)||this}iP(e,t)})(wa);var aP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){var o=this,i=new yv;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}aP(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Dt.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),e.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},e.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(wa);var sP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Wu,n,r)||this}sP(e,t)})(wa);var cP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),uP=function(t){function e(n,r){return t.call(this,new Hu,n,r)||this}return cP(e,t),e}(wa),Ku=function(t,e,n){var r=typeof t===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(e,'" to be a of type "').concat(n,'".')),r},lP=function(t){var e=t.scanDelay,n=t.constraints,r=t.onResult,o=t.videoId,i=x.useRef(null);x.useEffect(function(){var a=new uP(null,{delayBetweenScanAttempts:e});return!function(){var s=typeof navigator<"u"&&!!navigator.mediaDevices;return s||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s}()&&Ku(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"'),a),Ku(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Ku(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Ku(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},Ti=function(){return Ti=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ti.apply(this,arguments)},Ev={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}},uh=function(t){var e=t.videoContainerStyle,n=t.containerStyle,r=t.videoStyle,o=t.constraints,i=t.ViewFinder,a=t.scanDelay,s=t.className,c=t.onResult,l=t.videoId;return lP({constraints:o,scanDelay:a,onResult:c,videoId:l}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:Ti(Ti({},Ev.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:l,style:Ti(Ti(Ti({},Ev.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};uh.displayName="QrReader",uh.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function dP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n??An.USER),[i,a]=x.useState(!(Uf&&!Gf));return i?v.jsxs("div",{className:"relative w-full",children:[v.jsx(uh,{onResult:s=>{s&&t(s.getText())},constraints:{facingMode:r},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),v.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:()=>r===An.USER?o(An.ENVIRONMENT):o(An.USER),children:v.jsx("img",{src:xu,alt:"camera-switch"})})]}):v.jsx("div",{className:"flex max-h-[calc(100vh-381px)] min-h-[267px] items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:i,onClick:()=>a(!0)})})}class nt{constructor(e,n,r,o,i){this._legacyCanvasSize=nt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=e,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),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;if(e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),r=e.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(e),requestAnimationFrame(()=>{let s=window.getComputedStyle(e);s.display==="none"&&(e.style.setProperty("display","block","important"),a=!0),s.visibility!=="visible"&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity="0",e.style.width="0",e.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=nt.createQrEngine()}static set WORKER_PATH(e){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 nt.listCameras(!1)).length}catch{return!1}}static async listCameras(e=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{e&&(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"),nt._stopVideoStream(r))}}async hasFlash(){let e;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;e=this.$video.srcObject}else e=(await this._getCameraStream()).stream;return"torch"in e.getVideoTracks()[0].getSettings()}catch{return!1}finally{e&&e!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),nt._stopVideoStream(e))}}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(e){throw this._flashOn=!1,e}}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(),nt._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:e,facingMode:n}=await this._getCameraStream();!this._active||this._paused?nt._stopVideoStream(e):(this._setVideoMirror(n),this.$video.srcObject=e,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(e){if(!this._paused)throw this._active=!1,e}}stop(){this.pause(),this._active=!1}async pause(e=!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&&(nt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return e?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(e){e!==this._preferredCamera&&(this._preferredCamera=e,await this._restartVideoStream())}static async scanImage(e,n,r,o,i=!1,a=!1){let s,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(s=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,a=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||a?"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 l,f;[r,l]=await Promise.all([r||nt.createQrEngine(),nt._loadImage(e)]),[o,f]=nt._drawToCanvas(l,s,o,i);let h;if(r instanceof Worker){let d=r;n||nt._postWorkerMessageSync(d,"inversionMode","both"),h=await new Promise((p,u)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:nt._convertPoints(E.data.cornerPoints,s)}):u(nt.NO_QR_CODE_FOUND))},y=E=>{d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),u("Scanner error: "+(E?E.message||E:"Unknown Error"))},d.addEventListener("message",m),d.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=f.getImageData(0,0,o.width,o.height);w=nt._postWorkerMessageSync(d,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((d,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[d]=await r.detect(o);if(!d)throw nt.NO_QR_CODE_FOUND;return{data:d.rawValue,cornerPoints:nt._convertPoints(d.cornerPoints,s)}}catch(p){if(d=p.message||p,/not implemented|service unavailable/.test(d))return nt._disableBarcodeDetector=!0,nt.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${d}`}})()]);return c?h:h.data}catch(l){if(!s||!a)throw l;let f=await nt.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?f:f.data}finally{n||nt._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){nt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){nt._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static async createQrEngine(e){if(e&&console.warn("Specifying a worker path is not required and not supported anymore."),e=()=>Promise.resolve().then(()=>sB).then(r=>r.createWorker()),!(!nt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return e();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)?e():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(e){let n=Math.round(.6666666666666666*Math.min(e.videoWidth,e.videoHeight));return{x:Math.round((e.videoWidth-n)/2),y:Math.round((e.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var e=this.$video,n=e.videoWidth,r=e.videoHeight,o=e.offsetWidth,i=e.offsetHeight,a=e.offsetLeft,s=e.offsetTop,c=window.getComputedStyle(e),l=c.objectFit,f=n/r,h=o/i;switch(l){case"none":var d=n,p=r;break;case"fill":d=o,p=i;break;default:(l==="cover"?f>h:f<h)?(p=i,d=p*f):(d=o,p=d/f),l==="scale-down"&&(d=Math.min(d,n),p=Math.min(p,r))}var[u,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-d)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,l=this._scanRegion.x||0;var m=this._scanRegion.y||0;f=this.$overlay.style,f.width=`${c/n*d}px`,f.height=`${h/r*p}px`,f.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),f.left=`${a+(r?o-u-d:u)+(r?n-l-c:l)/n*d}px`,f.transform=e.style.transform}})}static _convertPoints(e,n){if(!n)return e;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 a of e)a.x=a.x*i+r,a.y=a.y*n+o;return e}_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 e=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;e<n&&await new Promise(o=>setTimeout(o,n-e)),this._lastScanTimestamp=Date.now();try{var r=await nt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!nt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=nt.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(e){e!==nt.NO_QR_CODE_FOUND&&console.log(e)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let e=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[e]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),a=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:a}}catch{}throw"Camera not found."}async _restartVideoStream(){let e=this._paused;await this.pause(!0)&&!e&&this._active&&await this.start()}static _stopVideoStream(e){for(let n of e.getTracks())n.stop(),e.removeTrack(n)}_setVideoMirror(e){this.$video.style.transform="scaleX("+(e==="user"?-1:1)+")"}_getFacingMode(e){return(e=e.getVideoTracks()[0])?/rear|back|environment/i.test(e.label)?"environment":/front|user|face/i.test(e.label)?"user":null:null}static _drawToCanvas(e,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,a=n&&n.y?n.y:0,s=n&&n.width?n.width:e.videoWidth||e.width,c=n&&n.height?n.height:e.videoHeight||e.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:s,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(e,i,a,s,c,0,0,r.width,r.height),[r,n]}static async _loadImage(e){if(e instanceof Image)return await nt._awaitImageLoad(e),e;if(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGImageElement||"OffscreenCanvas"in window&&e instanceof OffscreenCanvas||"ImageBitmap"in window&&e instanceof ImageBitmap)return e;if(e instanceof File||e instanceof Blob||e instanceof URL||typeof e=="string"){let n=new Image;n.src=e instanceof File||e instanceof Blob?URL.createObjectURL(e):e.toString();try{return await nt._awaitImageLoad(n),n}finally{(e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(e){e.complete&&e.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{e.removeEventListener("load",o),e.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};e.addEventListener("load",o),e.addEventListener("error",o)})}static async _postWorkerMessage(e,n,r,o){return nt._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=nt._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}nt.DEFAULT_CANVAS_SIZE=400,nt.NO_QR_CODE_FOUND="No QR code found",nt._disableBarcodeDetector=!1,nt._workerMessageId=0;function fP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),[l,f]=x.useState(!(Uf&&!Gf)),h=u=>{t(u==null?void 0:u.data)},d=u=>{};x.useEffect(()=>(l&&p(),()=>{var u;a!=null&&a.current||(u=i==null?void 0:i.current)==null||u.stop()}),[l]);const p=()=>{var u;a!=null&&a.current&&!i.current&&(i.current=new nt(a==null?void 0:a.current,h,{onDecodeError:d,preferredCamera:r}),(u=i==null?void 0:i.current)==null||u.start().then(()=>c(!0)).catch(g=>{g&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),l?v.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 g;const u=r===An.USER?An.ENVIRONMENT:An.USER;o(u),(g=i==null?void 0:i.current)==null||g.setCamera(u)},children:v.jsx("img",{src:xu,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:l,onClick:()=>f(!0)})})]})}function hP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),l=d=>{t(d==null?void 0:d.data)},f=d=>{};x.useEffect(()=>()=>{var d;a!=null&&a.current||(d=i==null?void 0:i.current)==null||d.stop()});const h=()=>{var d;a!=null&&a.current&&!i.current&&(i.current=new nt(a==null?void 0:a.current,l,{onDecodeError:f,preferredCamera:r}),(d=i==null?void 0:i.current)==null||d.start().then(()=>c(!0)).catch(p=>{p&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),s?v.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 p;const d=r===An.USER?An.ENVIRONMENT:An.USER;o(d),(p=i==null?void 0:i.current)==null||p.setCamera(d)},children:v.jsx("img",{src:xu,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function ba({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=u6()??[0,0],{subscribe:s,unsubscribe:c}=qa(),{cameraService:l}=rn(),f=d=>{e(d)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const d=p=>{e(p.detail.code)};return s("onCodeScan",d),()=>{c("onCodeScan",d)}},[a]);const h=()=>{switch(+l){case 1:return v.jsx(My,{onScan:f});case 2:return v.jsx(fP,{onScan:f});case 3:return v.jsx(dP,{onScan:f});case 4:return v.jsx(hP,{onScan:f});default:return v.jsx(My,{onScan:f})}};return v.jsxs("div",{ref:o,children:[v.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[h(),v.jsx("hr",{})]}),v.jsx(ii,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:d=>{n&&n(!0),e(d.target.value)}})]})}function pP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n,portalSession:r}=We(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),f=nn(),h=Vt(),d=()=>{l(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return f(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return f(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return f(`giftcard/${p.data.giftcard.hash}`);e(t("unknownCode",{code:o}))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{o&&!a&&d()},[o]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:d,children:v.jsx(ba,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),onClick:d,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:t("useEmail"),variant:"secondary",onClick:()=>f("email")})]})})]})})}function gP(){const{hash:t}=ro();return v.jsx(Cr,{to:`${qe.GIFTCARD}/select/${t}`})}function mP(){const{identifierValue:t}=ro(),{errorToast:e}=Yt(),{uuid:n,mutate:r}=We(),{onContactLink:o}=rn(),[i,a]=x.useState(!1),s=Vt(),c=f=>s.get(`${n}/contacts`,{contact_uuid:f}),l=()=>{s.put(n,{contact_identifier_value:t}).then(f=>{o&&c(f.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{l()},[]),i?v.jsx(Cr,{to:`${qe.PORTAL}/overview`}):v.jsx(Nr,{})}function Cv(t){const{portalSession:e}=We(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=wr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function yP(){const{t}=Ue(),{code:e}=ro(),{voucher:n}=Cv(e),{portalSession:r}=We(),[o,i]=x.useState(!1),[a,s]=x.useState(!1),c=nn(),l=()=>{n!=null&&n.contact||r.contact?i(!0):s(!0)};return x.useEffect(()=>{n&&l()},[n]),n?v.jsxs(v.Fragment,{children:[o?v.jsx(Cr,{to:`${qe.VOUCHER}/${n.code}/redeem`}):v.jsx(Nr,{}),v.jsx(ko,{title:t("noContactLinkedToVoucherTitle"),isOpen:a,onClose:()=>s(!1),primaryAction:{label:t("linkToContact"),action:()=>c(`${qe.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>s(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:n.code})})})]}):v.jsx(Nr,{})}function zu({redirectRoute:t}){const{state:e}=lr(),{t:n}=Ue(),{errorToast:r}=Yt(),{onContactLink:o}=rn(),{portalSession:i,mutate:a}=We(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=nn(),g=Vt(),m=b=>g.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),g.put(i.uuid,{email:c}).then(b=>{o&&m(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),a().then(()=>u(t))}).catch(b=>{b.response.data.code===fc.CONTACT_NOT_FOUND&&p(!0)}).finally(()=>h(!1))},w=()=>{h(!0),g.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return x.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>c&&!f&&y(),children:v.jsx(ii,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>l(b.target.value),beforeIcon:"mail"})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:f}),v.jsx(it,{label:n("useIdentifier"),variant:"secondary",onClick:()=>u("../identifier",{state:e})})]})})]})}),v.jsx(ko,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:f},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function vP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/*",element:v.jsx(pP,{})}),v.jsx(Je,{path:"/giftcard/:hash",element:v.jsx(gP,{})}),v.jsx(Je,{path:"/identifier/:identifierValue",element:v.jsx(mP,{})}),v.jsx(Je,{path:"/voucher/:code",element:v.jsx(yP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PORTAL})})]})}const wP={[tn.GIFTCARD]:`${qe.GIFTCARD}/select`,[tn.REDEEM_GIFTCARD]:`${qe.GIFTCARD}/redeem`,[tn.TOP_UP_GIFTCARD]:`${qe.GIFTCARD}/top-up`};function bP(){const{t}=Ue(),{portalSession:e}=We(),{errorToast:n}=Yt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),l=Vt(),f=nn(),h=()=>{a(!0),l.get(`${e.uuid}/giftcards/${r}`).then(d=>{const p=e.type;f(`${wP[p]}/${d.data.data.hash}`)}).catch(d=>{n(d),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(Mt,{children:v.jsx(ba,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(dn,{children:v.jsx(it,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function EP(){const{t}=Ue(),{hash:e}=ro(),n=nn();return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(it,{className:"grow",label:t("redeem"),onClick:()=>n(`${qe.GIFTCARD}/redeem/${e}`)}),v.jsx(it,{className:"grow",label:t("topUp"),onClick:()=>n(`${qe.GIFTCARD}/top-up/${e}`)})]})})]})})}function _v(t){const{portalSession:e}=We(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=wr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function Ms(){const{mutate:t}=We();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{B3(r.data.data.events)})}}}function CP(){const{t}=Ue(),{errorToast:e}=Yt(),{hash:n}=ro(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=We(),{onUseGiftcard:s}=rn(),{post:c}=Ms(),[l]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[f,h]=x.useState(!1),d=i.inputData.allow_multiple_giftcards??!0,p=nn(),u=Vt(),g=()=>{h(!0),u.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-m()}).then(E=>{o(),a(),c(),s==null||s(E.data.data)}).catch(e).finally(()=>h(!1))},m=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,w=()=>{let E=0;return i.events.filter(S=>S.type===To.GIFTCARD_TRANSACTION).forEach(S=>{S.data.giftcard.uuid===r.uuid&&(E+=S.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Li(m(),i.currency)}),onClick:g};if(d&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(qe.GIFTCARD),variant:"secondary"}};return r?v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("balance")}),v.jsx(Po,{value:r.amount_in_cents,start:r.amount_in_cents-w(),currency:i.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Po,{value:l+w(),start:l,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(dn,{children:v.jsx(it,{label:"",className:"w-full",...b(),pending:f})})]})}):v.jsx(Nr,{})}function _P({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{l(t?t.toString():"")},[]);const s=f=>{e(f?parseInt(f):0),l(f)},c=f=>{const{key:h}=f;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let d;if(h!=="Backspace")d=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);d=p.length?parseInt(p,10):0}e(d),l(d?d.toString():"")},l=f=>{a&&a.current&&(f?a.current.style.width=`${Math.max(f.length,3)*3}rem`:a.current.style.width="calc(3rem + 14px)")};return v.jsxs(v.Fragment,{children:[v.jsx("input",{ref:a,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:t?(t/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&v.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:v.jsx(jp,{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:s})})]})}function Av({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),[a,s]=x.useState(0),{portalSession:c}=We(),l=()=>{let f=0;return c.events.filter(d=>Object.values(To).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f};return v.jsxs(Ut,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Po,{value:e??0,start:e??0,currency:c.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:l()?v.jsx(Po,{value:0,start:a,currency:c.currency,asCurrency:!0}):v.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[v.jsx("p",{children:k3(c.currency)}),v.jsx(_P,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(dn,{children:v.jsx(it,{label:i("confirmAndPay",{amount:Li(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!l(),pending:o})})]})}function AP(){const{t}=Ue(),{errorToast:e}=Yt(),{hash:n}=ro(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=We(),{post:s}=Ms(),{onUseGiftcard:c}=rn(),[l,f]=x.useState(!1),h=Vt(),d=p=>{f(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(u=>{o(),a(),s(),c==null||c(u.data.data),Tt.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Li(u.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>f(!1))};return r?v.jsx(Rn,{children:v.jsx(Av,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:d,pending:l})}):v.jsx(Nr,{})}function SP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(bP,{})}),v.jsx(Je,{path:"/select/:hash",element:v.jsx(EP,{})}),v.jsx(Je,{path:"/redeem/:hash",element:v.jsx(CP,{})}),v.jsx(Je,{path:"/top-up/:hash",element:v.jsx(AP,{})})]})}class lh{constructor(){sr(this,"uuid");sr(this,"email");sr(this,"credit_balance");sr(this,"prepaid_balance");sr(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 Sv=x.createContext({contact:new lh,mutate:async()=>{}});function dh({children:t}){const{uuid:e}=We(),[n,r]=x.useState(new lh),{mutate:o}=wr({url:`${e}/contacts`,onData:a=>{const s=new lh;s.uuid=a.uuid,s.email=a.email,s.credit_balance=a.credit_balance,s.prepaid_balance=a.prepaid_balance,s.current_display_values=a.current_display_values,r(s)}}),i=x.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?v.jsx(Sv.Provider,{value:i,children:t}):v.jsx(Nr,{})}function yr(){const t=x.useContext(Sv);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function $u({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(Wl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function IP(){const{t}=Ue(),{errorToast:e}=Yt(),{contact:n,mutate:r}=yr(),{uuid:o,portalSession:i,mutate:a}=We(),s=Vt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},l=()=>{const f=i.events.filter(h=>h.type===To.CREDIT_RECEPTION);return f.length?f[0]:null};return x.useEffect(()=>{l()||c()},[]),v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?v.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:l()?v.jsxs(v.Fragment,{children:["+",v.jsx(Po,{value:l().data.credits,start:0})]}):v.jsx($u,{})}):v.jsx("p",{className:"text-core-red-500",children:t("xIsRequired",{x:"Amount in cents"})+"."})}),v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:`${t("new")} ${t("balance").toLowerCase()}`}),v.jsx(Po,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(l()?l().data.credits:0)})]})})]})})]})})}function TP(){const{portalSession:t}=We();return t.contact?v.jsx(dh,{children:v.jsx(IP,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ri.EMAIL?v.jsx(Cr,{to:`${qe.POINTS_TRANSACTION}/email`}):v.jsx(Cr,{to:`${qe.POINTS_TRANSACTION}/identifier`})}function fh({redirectRoute:t}){const{t:e}=Ue(),{state:n}=lr(),{portalSession:r,mutate:o}=We(),{onContactLink:i}=rn(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt();x.useEffect(()=>{!f&&a&&u()},[a]);const u=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&g(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(t,{state:{contactIdentifier:a}}))}).catch(()=>d("link",{state:{contactIdentifier:a}})).finally(()=>l(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>a&&u(),children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:e("continue"),onClick:u,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:e("useEmail"),variant:"secondary",onClick:()=>d("../email",{state:n})})]})})]})})}function hh({redirectRoute:t}){const{t:e}=Ue(),{errorToast:n}=Yt(),{uuid:r,mutate:o}=We(),{onContactLink:i}=rn(),{state:a}=lr(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=nn(),g=Vt();if(!a||!a.contactIdentifier)return v.jsx(Cr,{to:"../"});const m=()=>{h(!0),g.post(`${r}/contacts/link-identifier`,{contact_identifier_value:a.contactIdentifier,email:c}).then(w).catch(E=>{E.response.data.code===fc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},y=()=>{h(!0),g.post(`${r}/contacts`,{email:c}).then(m).catch(n).finally(()=>h(!1))},w=()=>{g.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>u(t))}).catch(n).finally(()=>h(!1))},b=E=>g.get(`${r}/contacts`,{contact_uuid:E});return x.useEffect(()=>{s("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),v.jsxs(Rn,{children:[v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(o6,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(bi,{onSubmit:m,children:v.jsx(ii,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:E=>l(E.target.value),beforeIcon:"mail"})})]})}),v.jsx(dn,{children:v.jsx(it,{label:e("continue"),className:"w-full",onClick:m,disabled:!c||f})})]}),v.jsx(ko,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:e("confirm"),action:y,loading:f},secondaryAction:{label:e("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:c})})})]})}function xP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(TP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.POINTS_TRANSACTION})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.POINTS_TRANSACTION})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.POINTS_TRANSACTION})})]})}function OP(){const{portalSession:t}=We(),{primaryIdentificationMethod:e}=rn();return t.contact?v.jsx(Cr,{to:`${qe.PORTAL}/overview`}):e&&e===Ri.EMAIL?v.jsx(Cr,{to:`${qe.PORTAL}/email`}):v.jsx(Cr,{to:`${qe.PORTAL}/identifier`})}function PP({children:t}){return v.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:v.jsx("div",{className:"h-full max-h-full",children:t})})}function kP({contact:t}){const{t:e}=Ue(),n=nn();return v.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(nd,{src:t.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsx("p",{className:"text-lg",children:t.getDisplayName()}),t.current_display_values.tier&&v.jsx(rd,{label:t.current_display_values.tier,size:"sm",stroke:!0})]}),v.jsx("p",{className:"text-sm text-core-gray-500 ",children:e("joinedAtDate",{date:new Date(t.current_display_values.created_at).toLocaleDateString(ln.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(it,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(it,{before:v.jsx(Sn,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function Ls({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function BP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:e.current_display_values.loyalty_balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Li(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function NP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We(),r=(o,i)=>sp(o,i)?`${sp(o,i)} ${t("yearsAgo")}`:ap(o,i)?`${ap(o,i)} ${t("weeksAgo")}`:ip(o,i)?`${ip(o,i)} ${t("daysAgo")}`:t("today");return v.jsx(Ls,{children:v.jsxs("div",{className:"h-full justify-between",children:[v.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:t("stats")}),v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"calendar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(e.current_display_values.loyalty_last_transaction_date))}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("lastVisit")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"shopping-bag"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_number_of_transactions} ${t("visits")}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalVisits")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"dollar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalCredits")})]})]})]})]})})}function Iv(){const{uuid:t}=We(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=wr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Tv({loyaltyTransaction:t}){const{t:e}=Ue();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs text-core-gray-500",children:t.type===W1.CREDIT_RECEPTION?e("transaction"):`${e("isRedeemed")} '${t.loyalty_transaction_data.title}'`}),v.jsx("p",{className:"text-xs font-semibold",children:t.credits>0?"+"+t.credits:t.credits})]})}function RP(){const{t}=Ue(),e=nn(),{loyaltyTransactions:n}=Iv();return n?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("activities")}),n&&n.length?v.jsx("div",{children:n.slice(0,5).map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(it,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx($u,{})}function xv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Ov({subscription:t,onChange:e,editable:n=!1}){const{t:r}=Ue();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs font-semibold",children:t.subscription_type.name}),n?v.jsx(Md,{defaultChecked:t.is_subscribed,disabled:t.subscription_type.strategy===Y1.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(rd,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function DP(){const{t}=Ue(),{subscriptions:e}=xv(),n=nn();return e?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("subscriptions")}),v.jsx("div",{children:e.map(r=>v.jsx(Ov,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(it,{label:t("change"),before:v.jsx(Sn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx($u,{})}function MP(){const{contact:t}=yr();return v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(kP,{contact:t})}),v.jsx(Mt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(BP,{}),v.jsx(NP,{}),v.jsx(RP,{}),v.jsx(DP,{})]})})]})}function Fs({label:t,path:e}){const n=nn();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(it,{label:t,variant:"link-gray",before:v.jsx(Sn,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function LP(){const{t}=Ue(),{loyaltyTransactions:e}=Iv(),{contact:n}=yr();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsx("p",{className:"text-sm font-medium",children:t("allActivities")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),v.jsx("div",{className:"overflow-auto",children:e==null?void 0:e.map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))})]})})]})})}function FP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{subscriptions:r,mutate:o}=xv(),[i,a]=x.useState({}),[s,c]=x.useState(!1),l=Vt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((u,g)=>({...u,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[r]);const f=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),l.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},d=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("subscriptions")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("manageEmailPreferences")}),r.map(p=>v.jsx(Ov,{subscription:p,onChange:f,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(dn,{children:v.jsx(it,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!d()||s})})]})}):v.jsx($u,{})}function jP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contact:r,mutate:o}=yr(),[i,a]=x.useState(),[s,c]=x.useState(!1),[l,f]=x.useState(),h=Vt();wr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const d=g=>{f({...l,[g.target.name]:g.target.value})},p=(g,m)=>{f({...l,[g]:m})},u=async()=>{c(!0),h.put(`${n}/contact-attributes`,l).then(()=>{o(),f(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[v.jsx(nd,{src:r.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{children:[v.jsx("div",{className:"flex flex-row items-center gap-2 ",children:v.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),v.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(g=>{if(!(g.type==="media_upload"||g.type==="email"))return g.type==="select"?v.jsx(v6,{name:g.name,label:g.label,value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(id,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(p6,{name:g.name,value:l&&l[g.name]?l[g.name]:g.defaultValue,label:g.label,onChange:p,disabled:g.disabled,options:g.options},g.id):g.type==="birth_date"||g.type==="date_time"?v.jsx(Up,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:d},g.id):v.jsx(ii,{disabled:g.disabled,label:g.label,name:g.name,value:l&&l[g.name]!=="undefined"?l[g.name]:r.current_display_values[g.name],onChange:d},g.id)}):v.jsx(Yc,{rows:10})]})}),v.jsx(dn,{children:v.jsx(it,{label:t("saveChanges"),className:"w-full",onClick:u,disabled:!l,pending:s})})]})})}function Pv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function VP({identifier:t,onClear:e}){const{t:n}=Ue();return v.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[v.jsxs("div",{className:"flex-col pl-4",children:[v.jsx("p",{className:"font-semibold",children:t.value}),v.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),v.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>e&&e(t.value),children:v.jsx(Sn,{className:"h-full",icon:"close"})})]})}function UP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contactIdentifiers:r,isLoading:o,mutate:i}=Pv(),[a,s]=x.useState(""),[c,l]=x.useState(!1),f=nn(),h=Vt(),d=u=>{s(u),l(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>l(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("contactIdentifiers")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("contactIdentifierDescription")})]}),o?v.jsx(Yc,{rows:10}):r==null?void 0:r.map(u=>v.jsx(VP,{identifier:u,onClear:d},u.value))]})})}),v.jsx(dn,{children:v.jsx(it,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>f("create")})})]}),v.jsx(ko,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>l(!1)},onClose:()=>l(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function GP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contact:r}=yr(),{mutate:o}=Pv(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=nn(),d=Vt(),p=()=>{c(!0),d.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(e).finally(()=>{a(""),c(!1)})};return x.useEffect(()=>{!l&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>i&&p(),children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsx(it,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function qP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/profile",element:v.jsx(MP,{})}),v.jsx(Je,{path:"/profile/activity",element:v.jsx(LP,{})}),v.jsx(Je,{path:"/profile/subscriptions",element:v.jsx(FP,{})}),v.jsx(Je,{path:"/profile/contact-identifiers",element:v.jsx(UP,{})}),v.jsx(Je,{path:"/profile/contact-identifiers/create",element:v.jsx(GP,{})}),v.jsx(Je,{path:"/profile/contact-attributes",element:v.jsx(jP,{})})]})}function HP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We();return v.jsxs("div",{className:"flex h-16 items-center justify-between",children:[v.jsx("h1",{children:t("rewards")}),v.jsxs("div",{className:"flex flex-col items-center",children:[v.jsx("p",{children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function kv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function ph({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=We(),{contact:a}=yr();return v.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[v.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(e==null?void 0:e.uuid)===t.uuid?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.media&&t.media.value?t.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:t.title??t.description})]}),v.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[t.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),t.required_credits-a.credit_balance.balance>0&&v.jsx(g6,{value:a.credit_balance.balance,max:t.required_credits})]})}function WP({selected:t,setSelected:e}){const{t:n}=Ue(),{contact:r}=yr(),{rewards:o,isLoading:i}=kv(),a=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),s=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return v.jsx(v.Fragment,{children:i?v.jsx(Yc,{rows:1}):v.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[v.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),a.map(c=>v.jsx(ph,{reward:c,selected:t,setSelected:e},c.uuid))]})}),v.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),s.map(c=>v.jsx(ph,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function YP(){const{portalSession:t}=We(),{rewards:e}=kv(),n=()=>t.events.filter(r=>r.type===To.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(H0,{children:n().map((r,o)=>v.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.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"}),v.jsx("p",{className:"truncate",children:r.title??r.description})]}),v.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",t.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):v.jsx(v.Fragment,{})}function KP(){const{t}=Ue(),{errorToast:e,successToast:n}=Yt(),{portalSession:r,mutate:o}=We(),{mutate:i}=yr(),{onClaimReward:a}=rn(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),{post:p}=Ms(),u=Vt();x.useEffect(()=>{s&&d(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===To.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,S)=>new Date(C.created_at)>new Date(S.created_at)?C:S);a==null||a(y,E.data.uuid)})},m=()=>{f(!0),u.post(`${r.uuid}/rewards/claim`,{uuid:s.uuid}).then(y=>{p(),i(),g(y.data.data),n(t("rewardClaimed",{name:y.data.data.title}))}).catch(e).finally(()=>{d(!1),c(void 0),f(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(HP,{})}),v.jsx(Mt,{children:v.jsx(WP,{selected:s,setSelected:c})}),v.jsx(dn,{children:v.jsx(YP,{})})]}),v.jsx(ko,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},onClose:()=>d(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(ph,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function gh(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function zP(){const{t}=Ue();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function mh({voucher:t,selected:e,setSelected:n}){const{t:r}=Ue();return v.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${t.status===Da.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(e==null?void 0:e.code)===t.code?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.promotion.image?t.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[v.jsx("p",{className:"font-semibold",children:t.name}),t.status===Da.REDEEMED?v.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):v.jsx("p",{className:"text-core-primary-500",children:t.expiration_date?`Valid until ${new Date(t.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),v.jsx("p",{className:`text-core-${t.status===Da.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function $P({selected:t,setSelected:e}){const{t:n}=Ue(),{vouchers:r,isLoading:o}=gh();return v.jsx(v.Fragment,{children:o?v.jsx(Yc,{rows:1}):v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>v.jsx(mh,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function XP(){const{t}=Ue(),{portalSession:e}=We(),{vouchers:n}=gh(),r=()=>e.events.filter(o=>o.type===To.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(H0,{children:r().map((o,i)=>v.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:v.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:v.jsxs("div",{className:"overflow-hidden",children:[v.jsx("p",{className:"font-semibold",children:o.data.name}),v.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",t("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):v.jsx(v.Fragment,{})}function QP(){const{t}=Ue(),{errorToast:e,successToast:n}=Yt(),{uuid:r}=We(),{onRedeemVoucher:o}=rn(),{post:i}=Ms(),{mutate:a}=gh(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Vt();x.useEffect(()=>{s&&d(!0)},[s]);const u=()=>{f(!0),p.post(`${r}/vouchers/redeem`,{code:s.code}).then(m=>{i(),o&&o(m.data.data),n(t("voucherSuccessfullyRedeemed")),a()}).catch(e).finally(()=>{g(),f(!1)})},g=()=>{d(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(zP,{})}),v.jsx(Mt,{children:v.jsx($P,{selected:s,setSelected:c})}),v.jsx(dn,{children:v.jsx(XP,{})})]}),v.jsx(ko,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:u,loading:l},secondaryAction:{label:t("cancel"),action:g},onClose:g,children:v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{children:t("redeemTitle",{title:s==null?void 0:s.name})}),s&&v.jsx(mh,{voucher:s,setSelected:c})]})})]})}function JP(){const{t}=Ue(),[e,n]=x.useState(1),r=nn(),o=[{id:0,label:t("profile"),icon:"user",pathname:"profile"},{id:1,label:t("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:t("vouchers"),icon:"mail",pathname:"vouchers"}];return x.useEffect(()=>{r(o[e].pathname)},[]),v.jsx(dh,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(K8,{children:o.map(i=>v.jsx(z8,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(PP,{children:[v.jsx(qP,{}),v.jsxs(oo,{children:[v.jsx(Je,{path:"/rewards",element:v.jsx(KP,{})}),v.jsx(Je,{path:"/vouchers",element:v.jsx(QP,{})})]})]})]})})}function ZP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(OP,{})}),v.jsx(Je,{path:"/overview/*",element:v.jsx(JP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PORTAL})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.PORTAL})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.PORTAL})})]})}function Bv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function ek(){const{t}=Ue(),{state:e}=lr(),{errorToast:n,successToast:r}=Yt(),{uuid:o,mutate:i}=We(),{contact:a}=yr(),{onCreatePrepaidTransaction:s}=rn(),{prepaidBalance:c,mutate:l}=Bv(),[f,h]=x.useState(!1),d=Vt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Rn,{children:v.jsx(Av,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Nr,{})}function tk({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),{portalSession:a}=We(),s=a.inputData.amount_in_cents??0,c=()=>{let f=0;return a.events.filter(d=>Object.values(To).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f},l=()=>Math.min(s+c(),e);return v.jsxs(Ut,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Po,{value:e,start:e+c(),currency:a.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Po,{value:l(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(dn,{children:v.jsx(it,{label:i("confirmAndPay",{amount:Li(l(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-l()),disabled:!s||!!c(),pending:o})})]})}function nk(){const{t}=Ue(),{state:e}=lr(),{errorToast:n,successToast:r}=Yt(),{uuid:o,mutate:i}=We(),{contact:a}=yr(),{onCreatePrepaidTransaction:s}=rn(),{prepaidBalance:c,mutate:l}=Bv(),[f,h]=x.useState(!1),d=Vt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Rn,{children:v.jsx(tk,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Nr,{})}function rk({setType:t}){const{t:e}=Ue();return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(it,{className:"grow",label:e("pay"),onClick:()=>t(tn.PAY_PREPAID)}),v.jsx(it,{className:"grow",label:e("topUp"),onClick:()=>t(tn.TOP_UP_PREPAID)})]})})]})})}function ok(){const{portalSession:t}=We(),{primaryIdentificationMethod:e}=rn(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ri.EMAIL?v.jsx(Cr,{to:`${qe.PREPAID}/email`}):v.jsx(Cr,{to:`${qe.PREPAID}/identifier`});const o=()=>n===tn.TOP_UP_PREPAID?v.jsx(ek,{}):n===tn.PAY_PREPAID?v.jsx(nk,{}):v.jsx(rk,{setType:r});return v.jsx(dh,{children:o()})}function ik(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(ok,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PREPAID})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.PREPAID})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.PREPAID})})]})}function ak(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n,portalSession:r}=We(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt(),u=()=>{s(!0),p.get(`${n}/vouchers/check/${o}`).then(g=>{g.data.data.contact||r.contact?d(`${o}/redeem`):h(!0)}).catch(e).finally(()=>s(!1))};return x.useEffect(()=>{!c&&o&&u()},[o]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(ba,{data:o,dataSetter:i,setDefer:l,label:t("code")})}),v.jsx(dn,{children:v.jsx(it,{label:t("submit"),className:"w-full",onClick:u,pending:a})})]})}),v.jsx(ko,{title:t("noContactLinkedToVoucherTitle"),isOpen:f,onClose:()=>h(!1),primaryAction:{label:t("linkToContact"),action:()=>d(`${o}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>h(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:o})})})]})}function sk(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{uuid:r}=We(),{onRedeemVoucher:o}=rn(),{post:i}=Ms(),{voucher:a,mutate:s}=Cv(n),[c,l]=x.useState(!1),f=Vt(),h=()=>{l(!0),f.post(`${r}/vouchers/redeem`,{code:n}).then(d=>{o==null||o(d.data.data),i(),s()}).catch(e).finally(()=>l(!1))};return a?v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(Mt,{children:v.jsx("div",{children:v.jsx(mh,{voucher:a,setSelected:()=>{}})})}),v.jsx(dn,{children:v.jsx(it,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Da.ACTIVE||c,pending:c})})]})}):v.jsx(Nr,{})}function ck(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{portalSession:r,mutate:o}=We(),{onContactLink:i}=rn(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt(),u=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&u(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(`${qe.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{!f&&a&&g()},[a]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:g,children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:t("useEmail"),variant:"secondary",onClick:()=>d(`../${n}/email`)})]})})]})})}function uk(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{onContactLink:r}=rn(),{portalSession:o,mutate:i}=We(),{publish:a}=qa(),[s,c]=x.useState(""),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=nn(),u=Vt(),g=w=>u.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{f(!0),u.put(o.uuid,{email:s}).then(w=>{r&&g(w.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${qe.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===fc.CONTACT_NOT_FOUND&&d(!0)}).finally(()=>f(!1))},y=()=>{f(!0),u.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>f(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>s&&!l&&m(),children:v.jsx(ii,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),className:"w-full",onClick:m,pending:l,disabled:!s||l}),v.jsx(it,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(ko,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("confirm"),action:y,disabled:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function lk(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(ak,{})}),v.jsx(Je,{path:":code/redeem",element:v.jsx(sk,{})}),v.jsx(Je,{path:":code/email",element:v.jsx(uk,{})}),v.jsx(Je,{path:":code/identifier",element:v.jsx(ck,{})})]})}function dk(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(b7,{})}),v.jsx(Je,{path:`${qe.GENERIC}/*`,element:v.jsx(vP,{})}),v.jsx(Je,{path:`${qe.GIFTCARD}/*`,element:v.jsx(SP,{})}),v.jsx(Je,{path:`${qe.POINTS_TRANSACTION}/*`,element:v.jsx(xP,{})}),v.jsx(Je,{path:`${qe.PORTAL}/*`,element:v.jsx(ZP,{})}),v.jsx(Je,{path:`${qe.PREPAID}/*`,element:v.jsx(ik,{})}),v.jsx(Je,{path:`${qe.VOUCHER}/*`,element:v.jsx(lk,{})})]})}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function Nv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":yh(XMLHttpRequest))==="object"}function fk(t){return!!t&&typeof t.then=="function"}function hk(t){return fk(t)?t:Promise.resolve(t)}function pk(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vh={exports:{}},Xu={exports:{}},Rv;function gk(){return Rv||(Rv=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Zo<"u"&&Zo,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(a){var s=typeof i<"u"&&i||typeof self<"u"&&self||typeof s<"u"&&s,c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&f.indexOf(Object.prototype.toString.call(k))>-1};function d(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function u(k){var V={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function g(k){this.map={},k instanceof g?k.forEach(function(V,z){this.append(z,V)},this):Array.isArray(k)?k.forEach(function(V){this.append(V[0],V[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(V){this.append(V,k[V])},this)}g.prototype.append=function(k,V){k=d(k),V=p(V);var z=this.map[k];this.map[k]=z?z+", "+V:V},g.prototype.delete=function(k){delete this.map[d(k)]},g.prototype.get=function(k){return k=d(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(d(k))},g.prototype.set=function(k,V){this.map[d(k)]=p(V)},g.prototype.forEach=function(k,V){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(V,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(V,z){k.push(z)}),u(k)},g.prototype.values=function(){var k=[];return this.forEach(function(V){k.push(V)}),u(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(V,z){k.push([z,V])}),u(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function m(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function y(k){return new Promise(function(V,z){k.onload=function(){V(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(k),z}function b(k){var V=new FileReader,z=y(V);return V.readAsText(k),z}function E(k){for(var V=new Uint8Array(k),z=new Array(V.length),te=0;te<V.length;te++)z[te]=String.fromCharCode(V[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var V=new Uint8Array(k.byteLength);return V.set(new Uint8Array(k)),V.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=C(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||h(k))?this._bodyArrayBuffer=C(k):this._bodyText=k=Object.prototype.toString.call(k):this._bodyText="",this.headers.get("content-type")||(typeof k=="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(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=m(this);if(k)return k;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 k=m(this);return k||(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(w)}),this.text=function(){var k=m(this);if(k)return k;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(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(k){var V=k.toUpperCase();return T.indexOf(V)>-1?V:k}function N(k,V){if(!(this instanceof N))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(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,V.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!z&&k._bodyInit!=null&&(z=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new g(V.headers)),this.method=P(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 te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var V=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),re=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(ne))}}),V}function U(k){var V=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
154
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],d=0;d<h.length;d++)t[3][bn.getCharCode(h[d])]=d;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(d=0;d<p.length;d++)bn.getCharCode(p[d])>0&&(t[4][bn.getCharCode(p[d])]=d)}(gr.createInt32Array(5,256));var ZO=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),eP=function(t){function e(n){var r=t.call(this,n.width,n.height)||this;return r.canvas=n,r.buffer=e.makeBufferFromCanvasImageData(n),r}return ZO(e,t),e.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 e.toGrayscaleBuffer(o.data,n.width,n.height)},e.toGrayscaleBuffer=function(n,r,o){for(var i=new Uint8ClampedArray(r*o),a=0,s=0,c=n.length;a<c;a+=4,s++){var l=void 0;n[a+3]===0?l=255:l=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=l}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ke("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},e.prototype.getMatrix=function(){return this.buffer},e.prototype.isCropSupported=function(){return!0},e.prototype.crop=function(n,r,o,i){return t.prototype.crop.call(this,n,r,o,i),this},e.prototype.isRotateSupported=function(){return!0},e.prototype.rotateCounterClockwise=function(){return this.rotate(-90),this},e.prototype.rotateCounterClockwise45=function(){return this.rotate(-45),this},e.prototype.invert=function(){return new ku(this)},e.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},e.prototype.rotate=function(n){var r=this.getTempCanvasElement();if(!r)throw new Error("Could not create a Canvas element.");var o=n*e.DEGREE_TO_RADIANS,i=this.canvas.width,a=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(o))*i+Math.abs(Math.sin(o))*a),c=Math.ceil(Math.abs(Math.sin(o))*i+Math.abs(Math.cos(o))*a);r.width=s,r.height=c;var l=r.getContext("2d");if(!l)throw new Error("Could not create a Convas Context element.");return l.translate(s/2,c/2),l.rotate(o),l.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(Os);function bv(){return typeof navigator<"u"}function tP(){return!!(bv()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var va=function(){return va=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},va.apply(this,arguments)},Jt=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(l){try{c(r.next(l))}catch(f){i(f)}}function s(l){try{c(r.throw(l))}catch(f){i(f)}}function c(l){var f;l.done?o(l.value):(f=l.value,f instanceof n?f:new n(function(h){h(f)})).then(a,s)}c((r=r.apply(t,[])).next())})},Zt=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(c){return function(l){return function(f){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&f[0]?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[2&f[0],o.value]),f[0]){case 0:case 1:o=f;break;case 4:return a.label++,{value:f[1],done:!1};case 5:a.label++,r=f[1],f=[0];continue;case 7:f=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){a=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){a.label=f[1];break}if(f[0]===6&&a.label<o[1]){a.label=o[1],o=f;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(f);break}o[2]&&a.ops.pop(),a.trys.pop();continue}f=e.call(t,a)}catch(h){f=[6,h],r=0}finally{n=o=0}if(5&f[0])throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}([c,l])}}},Yu=function(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},nP={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},wa=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=va(va({},nP),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Dt.POSSIBLE_FORMATS,e)},enumerable:!1,configurable:!0}),t.addVideoSource=function(e,n){try{e.srcObject=n}catch{e.src=URL.createObjectURL(n)}},t.mediaStreamSetTorch=function(e,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,e.applyConstraints({advanced:[{fillLightMode:n?"flash":"off",torch:!!n}]})];case 1:return r.sent(),[2]}})})},t.mediaStreamIsTorchCompatible=function(e){var n,r,o=e.getVideoTracks();try{for(var i=Yu(o),a=i.next();!a.done;a=i.next()){var s=a.value;if(t.mediaStreamIsTorchCompatibleTrack(s))return!0}}catch(c){n={error:c}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!1},t.mediaStreamIsTorchCompatibleTrack=function(e){try{return"torch"in e.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}},t.isVideoPlaying=function(e){return e.currentTime>0&&!e.paused&&e.readyState>2},t.getMediaElement=function(e,n){var r=document.getElementById(e);if(!r)throw new Qt("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Qt("element with id '"+e+"' must be an "+n+" element");return r},t.createVideoElement=function(e){if(e instanceof HTMLVideoElement)return e;if(typeof e=="string")return t.getMediaElement(e,"video");if(!e&&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!")},t.prepareImageElement=function(e){if(e instanceof HTMLImageElement)return e;if(typeof e=="string")return t.getMediaElement(e,"img");if(e===void 0){var n=document.createElement("img");return n.width=200,n.height=200,n}throw new Error("Couldn't get imageElement from imageSource!")},t.prepareVideoElement=function(e){var n=t.createVideoElement(e);return n.setAttribute("autoplay","true"),n.setAttribute("muted","true"),n.setAttribute("playsinline","true"),n},t.isImageLoaded=function(e){return!!e.complete&&e.naturalWidth!==0},t.createBinaryBitmapFromCanvas=function(e){var n=new eP(e),r=new jy(n);return new Ly(r)},t.drawImageOnCanvas=function(e,n){e.drawImage(n,0,0)},t.getMediaElementDimensions=function(e){if(e instanceof HTMLVideoElement)return{height:e.videoHeight,width:e.videoWidth};if(e instanceof HTMLImageElement)return{height:e.naturalHeight||e.height,width:e.naturalWidth||e.width};throw new Error("Couldn't find the Source's dimentions!")},t.createCaptureCanvas=function(e){if(!e)throw new Qt("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=t.getMediaElementDimensions(e),o=r.width,i=r.height;return n.style.width=o+"px",n.style.height=i+"px",n.width=o,n.height=i,n},t.tryPlayVideo=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(e!=null&&e.ended)return console.error("Trying to play video that has ended."),[2,!1];if(t.isVideoPlaying(e))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,e.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]}})})},t.createCanvasFromMediaElement=function(e){var n=t.createCaptureCanvas(e),r=n.getContext("2d");if(!r)throw new Error("Couldn't find Canvas 2D Context.");return t.drawImageOnCanvas(r,e),n},t.createBinaryBitmapFromMediaElem=function(e){var n=t.createCanvasFromMediaElement(e);return t.createBinaryBitmapFromCanvas(n)},t.destroyImageElement=function(e){e.src="",e.removeAttribute("src"),e=void 0},t.listVideoInputDevices=function(){return Jt(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,l,f,h,d;return Zt(this,function(p){switch(p.label){case 0:if(!bv())throw new Error("Can't enumerate devices, navigator is not present.");if(!tP())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=Yu(e),o=r.next();!o.done;o=r.next())i=o.value,(a=i.kind==="video"?"videoinput":i.kind)==="videoinput"&&(s=i.deviceId||i.id,c=i.label||"Video device "+(n.length+1),l=i.groupId,f={deviceId:s,label:c,kind:a,groupId:l},n.push(f))}catch(u){h={error:u}}finally{try{o&&!o.done&&(d=r.return)&&d.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:return[4,t.listVideoInputDevices()];case 1:return(n=r.sent())?[2,n.find(function(o){return o.deviceId===e})]:[2]}})})},t.cleanVideoSource=function(e){if(e){try{e.srcObject=null}catch{e.src=""}e&&e.removeAttribute("src")}},t.playVideoOnLoadAsync=function(e,n){return Jt(this,void 0,void 0,function(){return Zt(this,function(r){switch(r.label){case 0:return[4,t.tryPlayVideo(e)];case 1:return r.sent()?[2,!0]:[2,new Promise(function(o,i){var a=setTimeout(function(){t.isVideoPlaying(e)||(i(!1),e.removeEventListener("canplay",s))},n),s=function(){t.tryPlayVideo(e).then(function(c){clearTimeout(a),e.removeEventListener("canplay",s),o(c)})};e.addEventListener("canplay",s)})]}})})},t.attachStreamToVideo=function(e,n,r){return r===void 0&&(r=5e3),Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return o=t.prepareVideoElement(n),t.addVideoSource(o,e),[4,t.playVideoOnLoadAsync(o,r)];case 1:return i.sent(),[2,o]}})})},t._waitImageLoad=function(e){return new Promise(function(n,r){var o=setTimeout(function(){t.isImageLoaded(e)||(e.removeEventListener("load",i),r())},1e4),i=function(){clearTimeout(o),e.removeEventListener("load",i),n()};e.addEventListener("load",i)})},t.checkCallbackFnOrThrow=function(e){if(!e)throw new Qt("`callbackFn` is a required parameter, you cannot capture results without it.")},t.disposeMediaStream=function(e){e.getVideoTracks().forEach(function(n){return n.stop()}),e=void 0},t.prototype.decode=function(e){var n=t.createCanvasFromMediaElement(e);return this.decodeFromCanvas(n)},t.prototype.decodeBitmap=function(e){return this.reader.decode(e,this.hints)},t.prototype.decodeFromCanvas=function(e){var n=t.createBinaryBitmapFromCanvas(e);return this.decodeBitmap(n)},t.prototype.decodeFromImageElement=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!e)throw new Qt("An image element must be provided.");return n=t.prepareImageElement(e),[4,this._decodeOnLoadImage(n)];case 1:return[2,r.sent()]}})})},t.prototype.decodeFromImageUrl=function(e){return Jt(this,void 0,void 0,function(){var n;return Zt(this,function(r){switch(r.label){case 0:if(!e)throw new Qt("An URL must be provided.");(n=t.prepareImageElement()).src=e,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 t.destroyImageElement(n),[7];case 4:return[2]}})})},t.prototype.decodeFromConstraints=function(e,n,r){return Jt(this,void 0,void 0,function(){var o,i;return Zt(this,function(a){switch(a.label){case 0:return t.checkCallbackFnOrThrow(r),[4,navigator.mediaDevices.getUserMedia(e)];case 1:o=a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.decodeFromStream(o,n,r)];case 3:return[2,a.sent()];case 4:throw i=a.sent(),t.disposeMediaStream(o),i;case 5:return[2]}})})},t.prototype.decodeFromStream=function(e,n,r){return Jt(this,void 0,void 0,function(){var o,i,a,s,c,l,f,h,d,p,u=this;return Zt(this,function(g){switch(g.label){case 0:return t.checkCallbackFnOrThrow(r),o=this.options.tryPlayVideoTimeout,[4,t.attachStreamToVideo(e,n,o)];case 1:return i=g.sent(),a=function(){var m,y;try{for(var w=Yu(e.getVideoTracks()),b=w.next();!b.done;b=w.next())b.value.stop()}catch(E){m={error:E}}finally{try{b&&!b.done&&(y=w.return)&&y.call(w)}finally{if(m)throw m.error}}e=void 0},s=function(){a(),t.cleanVideoSource(i)},c=this.scan(i,r,s),l=e.getVideoTracks(),f=va(va({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return Jt(this,void 0,void 0,function(){var w,b,E,C,S,T;return Zt(this,function(P){switch(P.label){case 0:w=y?l.filter(y):l,P.label=1;case 1:P.trys.push([1,6,7,8]),b=Yu(w),E=b.next(),P.label=2;case 2:return E.done?[3,5]:[4,E.value.applyConstraints(m)];case 3:P.sent(),P.label=4;case 4:return E=b.next(),[3,2];case 5:return[3,8];case 6:return C=P.sent(),S={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(S)throw S.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return l.find(m).getConstraints()},streamVideoSettingsGet:function(m){return l.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return l.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=l==null?void 0:l.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),d=function(m){return Jt(u,void 0,void 0,function(){return Zt(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},f.switchTorch=d,p=function(){c.stop(),d(!1)},f.stop=p),[2,f]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return Jt(this,void 0,void 0,function(){var o;return Zt(this,function(i){switch(i.label){case 0:return t.checkCallbackFnOrThrow(r),o={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeFromConstraints(o,n,r)];case 1:return[2,i.sent()]}})})},t.prototype.decodeFromVideoElement=function(e,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Qt("A video element must be provided.");return r=t.prepareVideoElement(e),o=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,o)];case 1:return i.sent(),[2,this.scan(r,n)]}})})},t.prototype.decodeFromVideoUrl=function(e,n){return Jt(this,void 0,void 0,function(){var r,o,i;return Zt(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Qt("An URL must be provided.");return(r=t.prepareVideoElement()).src=e,o=function(){t.cleanVideoSource(r)},i=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(r,i)];case 1:return a.sent(),[2,this.scan(r,n,o)]}})})},t.prototype.decodeOnceFromConstraints=function(e,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return[4,navigator.mediaDevices.getUserMedia(e)];case 1:return r=o.sent(),[4,this.decodeOnceFromStream(r,n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromStream=function(e,n){return Jt(this,void 0,void 0,function(){var r,o;return Zt(this,function(i){switch(i.label){case 0:return r=!!n,[4,t.attachStreamToVideo(e,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||t.cleanVideoSource(o),[7];case 5:return[2]}})})},t.prototype.decodeOnceFromVideoDevice=function(e,n){return Jt(this,void 0,void 0,function(){var r;return Zt(this,function(o){switch(o.label){case 0:return r={video:e?{deviceId:{exact:e}}:{facingMode:"environment"}},[4,this.decodeOnceFromConstraints(r,n)];case 1:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoElement=function(e){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!e)throw new Qt("A video element must be provided.");return n=t.prepareVideoElement(e),r=this.options.tryPlayVideoTimeout,[4,t.playVideoOnLoadAsync(n,r)];case 1:return o.sent(),[4,this.scanOneResult(n)];case 2:return[2,o.sent()]}})})},t.prototype.decodeOnceFromVideoUrl=function(e){return Jt(this,void 0,void 0,function(){var n,r;return Zt(this,function(o){switch(o.label){case 0:if(!e)throw new Qt("An URL must be provided.");(n=t.prepareVideoElement()).src=e,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 t.cleanVideoSource(n),[7];case 4:return[2]}})})},t.prototype.scanOneResult=function(e,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(a,s){i.scan(e,function(c,l,f){if(c)return a(c),void f.stop();if(l){if(l instanceof ge&&n||l instanceof pn&&r||l instanceof Ie&&o)return;f.stop(),s(l)}})})},t.prototype.scan=function(e,n,r){var o=this;t.checkCallbackFnOrThrow(n);var i=t.createCaptureCanvas(e),a=i.getContext("2d");if(!a)throw new Error("Couldn't create canvas for visual element scan.");var s,c=function(){a=void 0,i=void 0},l=!1,f={stop:function(){l=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!l)try{t.drawImageOnCanvas(a,e);var d=o.decodeFromCanvas(i);n(d,void 0,f),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,f),p instanceof pn||p instanceof Ie||p instanceof ge)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),f},t.prototype._decodeOnLoadImage=function(e){return Jt(this,void 0,void 0,function(){return Zt(this,function(n){switch(n.label){case 0:return t.isImageLoaded(e)?[3,2]:[4,t._waitImageLoad(e)];case 1:n.sent(),n.label=2;case 2:return[2,this.decode(e)]}})})},t}(),rP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Du,n,r)||this}rP(e,t)})(wa);var oP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new ma(n),n,r)||this}oP(e,t)})(wa);var iP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Uu,n,r)||this}iP(e,t)})(wa);var aP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){var o=this,i=new yv;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}aP(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Dt.POSSIBLE_FORMATS,n),this.reader.setHints(this.hints)},enumerable:!1,configurable:!0}),e.prototype.decodeBitmap=function(n){return this.reader.decodeWithState(n)},e.prototype.setHints=function(n){this.hints=n,this.reader.setHints(this.hints)}})(wa);var sP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();(function(t){function e(n,r){return t.call(this,new Wu,n,r)||this}sP(e,t)})(wa);var cP=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),uP=function(t){function e(n,r){return t.call(this,new Hu,n,r)||this}return cP(e,t),e}(wa),Ku=function(t,e,n){var r=typeof t===n;return r||console.warn('[ReactQrReader]: Expected "'.concat(e,'" to be a of type "').concat(n,'".')),r},lP=function(t){var e=t.scanDelay,n=t.constraints,r=t.onResult,o=t.videoId,i=x.useRef(null);x.useEffect(function(){var a=new uP(null,{delayBetweenScanAttempts:e});return!function(){var s=typeof navigator<"u"&&!!navigator.mediaDevices;return s||console.warn('[ReactQrReader]: MediaDevices API has no support for your browser. You can fix this by running "npm i webrtc-adapter"'),s}()&&Ku(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"'),a),Ku(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Ku(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Ku(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},Ti=function(){return Ti=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ti.apply(this,arguments)},Ev={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}},uh=function(t){var e=t.videoContainerStyle,n=t.containerStyle,r=t.videoStyle,o=t.constraints,i=t.ViewFinder,a=t.scanDelay,s=t.className,c=t.onResult,l=t.videoId;return lP({constraints:o,scanDelay:a,onResult:c,videoId:l}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:Ti(Ti({},Ev.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:l,style:Ti(Ti(Ti({},Ev.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};uh.displayName="QrReader",uh.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function dP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n??An.USER),[i,a]=x.useState(!(Uf&&!Gf));return i?v.jsxs("div",{className:"relative w-full",children:[v.jsx(uh,{onResult:s=>{s&&t(s.getText())},constraints:{facingMode:r},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),v.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:()=>r===An.USER?o(An.ENVIRONMENT):o(An.USER),children:v.jsx("img",{src:xu,alt:"camera-switch"})})]}):v.jsx("div",{className:"flex max-h-[calc(100vh-381px)] min-h-[267px] items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:i,onClick:()=>a(!0)})})}class nt{constructor(e,n,r,o,i){this._legacyCanvasSize=nt.DEFAULT_CANVAS_SIZE,this._preferredCamera="environment",this._maxScansPerSecond=25,this._lastScanTimestamp=-1,this._destroyed=this._flashOn=this._paused=this._active=!1,this.$video=e,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),e.disablePictureInPicture=!0,e.playsInline=!0,e.muted=!0;let a=!1;if(e.hidden&&(e.hidden=!1,a=!0),document.body.contains(e)||(document.body.appendChild(e),a=!0),r=e.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(e),requestAnimationFrame(()=>{let s=window.getComputedStyle(e);s.display==="none"&&(e.style.setProperty("display","block","important"),a=!0),s.visibility!=="visible"&&(e.style.setProperty("visibility","visible","important"),a=!0),a&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),e.style.opacity="0",e.style.width="0",e.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),delete this.$overlay,delete this.$codeOutlineHighlight),this.$overlay&&this._updateOverlay()}),e.addEventListener("play",this._onPlay),e.addEventListener("loadedmetadata",this._onLoadedMetaData),document.addEventListener("visibilitychange",this._onVisibilityChange),window.addEventListener("resize",this._updateOverlay),this._qrEnginePromise=nt.createQrEngine()}static set WORKER_PATH(e){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 nt.listCameras(!1)).length}catch{return!1}}static async listCameras(e=!1){if(!navigator.mediaDevices)return[];let n=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput"),r;try{e&&(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"),nt._stopVideoStream(r))}}async hasFlash(){let e;try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return!1;e=this.$video.srcObject}else e=(await this._getCameraStream()).stream;return"torch"in e.getVideoTracks()[0].getSettings()}catch{return!1}finally{e&&e!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),nt._stopVideoStream(e))}}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(e){throw this._flashOn=!1,e}}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(),nt._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:e,facingMode:n}=await this._getCameraStream();!this._active||this._paused?nt._stopVideoStream(e):(this._setVideoMirror(n),this.$video.srcObject=e,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})))}catch(e){if(!this._paused)throw this._active=!1,e}}stop(){this.pause(),this._active=!1}async pause(e=!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&&(nt._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null)};return e?(n(),!0):(await new Promise(r=>setTimeout(r,300)),this._paused?(n(),!0):!1)}async setCamera(e){e!==this._preferredCamera&&(this._preferredCamera=e,await this._restartVideoStream())}static async scanImage(e,n,r,o,i=!1,a=!1){let s,c=!1;n&&("scanRegion"in n||"qrEngine"in n||"canvas"in n||"disallowCanvasResizing"in n||"alsoTryWithoutScanRegion"in n||"returnDetailedScanResult"in n)?(s=n.scanRegion,r=n.qrEngine,o=n.canvas,i=n.disallowCanvasResizing||!1,a=n.alsoTryWithoutScanRegion||!1,c=!0):console.warn(n||r||o||i||a?"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 l,f;[r,l]=await Promise.all([r||nt.createQrEngine(),nt._loadImage(e)]),[o,f]=nt._drawToCanvas(l,s,o,i);let h;if(r instanceof Worker){let d=r;n||nt._postWorkerMessageSync(d,"inversionMode","both"),h=await new Promise((p,u)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:nt._convertPoints(E.data.cornerPoints,s)}):u(nt.NO_QR_CODE_FOUND))},y=E=>{d.removeEventListener("message",m),d.removeEventListener("error",y),clearTimeout(g),u("Scanner error: "+(E?E.message||E:"Unknown Error"))},d.addEventListener("message",m),d.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=f.getImageData(0,0,o.width,o.height);w=nt._postWorkerMessageSync(d,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((d,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[d]=await r.detect(o);if(!d)throw nt.NO_QR_CODE_FOUND;return{data:d.rawValue,cornerPoints:nt._convertPoints(d.cornerPoints,s)}}catch(p){if(d=p.message||p,/not implemented|service unavailable/.test(d))return nt._disableBarcodeDetector=!0,nt.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${d}`}})()]);return c?h:h.data}catch(l){if(!s||!a)throw l;let f=await nt.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?f:f.data}finally{n||nt._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){nt._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){nt._postWorkerMessage(this._qrEnginePromise,"inversionMode",e)}static async createQrEngine(e){if(e&&console.warn("Specifying a worker path is not required and not supported anymore."),e=()=>Promise.resolve().then(()=>sB).then(r=>r.createWorker()),!(!nt._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return e();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)?e():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(e){let n=Math.round(.6666666666666666*Math.min(e.videoWidth,e.videoHeight));return{x:Math.round((e.videoWidth-n)/2),y:Math.round((e.videoHeight-n)/2),width:n,height:n,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var e=this.$video,n=e.videoWidth,r=e.videoHeight,o=e.offsetWidth,i=e.offsetHeight,a=e.offsetLeft,s=e.offsetTop,c=window.getComputedStyle(e),l=c.objectFit,f=n/r,h=o/i;switch(l){case"none":var d=n,p=r;break;case"fill":d=o,p=i;break;default:(l==="cover"?f>h:f<h)?(p=i,d=p*f):(d=o,p=d/f),l==="scale-down"&&(d=Math.min(d,n),p=Math.min(p,r))}var[u,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-d)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,l=this._scanRegion.x||0;var m=this._scanRegion.y||0;f=this.$overlay.style,f.width=`${c/n*d}px`,f.height=`${h/r*p}px`,f.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),f.left=`${a+(r?o-u-d:u)+(r?n-l-c:l)/n*d}px`,f.transform=e.style.transform}})}static _convertPoints(e,n){if(!n)return e;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 a of e)a.x=a.x*i+r,a.y=a.y*n+o;return e}_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 e=Date.now()-this._lastScanTimestamp,n=1e3/this._maxScansPerSecond;e<n&&await new Promise(o=>setTimeout(o,n-e)),this._lastScanTimestamp=Date.now();try{var r=await nt.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!nt._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=nt.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(e){e!==nt.NO_QR_CODE_FOUND&&console.log(e)}async _getCameraStream(){if(!navigator.mediaDevices)throw"Camera not found.";let e=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":"deviceId",n=[{width:{min:1024}},{width:{min:768}},{}],r=n.map(o=>Object.assign({},o,{[e]:{exact:this._preferredCamera}}));for(let o of[...r,...n])try{let i=await navigator.mediaDevices.getUserMedia({video:o,audio:!1}),a=this._getFacingMode(i)||(o.facingMode?this._preferredCamera:this._preferredCamera==="environment"?"user":"environment");return{stream:i,facingMode:a}}catch{}throw"Camera not found."}async _restartVideoStream(){let e=this._paused;await this.pause(!0)&&!e&&this._active&&await this.start()}static _stopVideoStream(e){for(let n of e.getTracks())n.stop(),e.removeTrack(n)}_setVideoMirror(e){this.$video.style.transform="scaleX("+(e==="user"?-1:1)+")"}_getFacingMode(e){return(e=e.getVideoTracks()[0])?/rear|back|environment/i.test(e.label)?"environment":/front|user|face/i.test(e.label)?"user":null:null}static _drawToCanvas(e,n,r,o=!1){r=r||document.createElement("canvas");let i=n&&n.x?n.x:0,a=n&&n.y?n.y:0,s=n&&n.width?n.width:e.videoWidth||e.width,c=n&&n.height?n.height:e.videoHeight||e.height;return o||(o=n&&n.downScaledWidth?n.downScaledWidth:s,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(e,i,a,s,c,0,0,r.width,r.height),[r,n]}static async _loadImage(e){if(e instanceof Image)return await nt._awaitImageLoad(e),e;if(e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof SVGImageElement||"OffscreenCanvas"in window&&e instanceof OffscreenCanvas||"ImageBitmap"in window&&e instanceof ImageBitmap)return e;if(e instanceof File||e instanceof Blob||e instanceof URL||typeof e=="string"){let n=new Image;n.src=e instanceof File||e instanceof Blob?URL.createObjectURL(e):e.toString();try{return await nt._awaitImageLoad(n),n}finally{(e instanceof File||e instanceof Blob)&&URL.revokeObjectURL(n.src)}}else throw"Unsupported image type."}static async _awaitImageLoad(e){e.complete&&e.naturalWidth!==0||await new Promise((n,r)=>{let o=i=>{e.removeEventListener("load",o),e.removeEventListener("error",o),i instanceof ErrorEvent?r("Image load error"):n()};e.addEventListener("load",o),e.addEventListener("error",o)})}static async _postWorkerMessage(e,n,r,o){return nt._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=nt._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}nt.DEFAULT_CANVAS_SIZE=400,nt.NO_QR_CODE_FOUND="No QR code found",nt._disableBarcodeDetector=!1,nt._workerMessageId=0;function fP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),[l,f]=x.useState(!(Uf&&!Gf)),h=u=>{t(u==null?void 0:u.data)},d=u=>{};x.useEffect(()=>(l&&p(),()=>{var u;a!=null&&a.current||(u=i==null?void 0:i.current)==null||u.stop()}),[l]);const p=()=>{var u;a!=null&&a.current&&!i.current&&(i.current=new nt(a==null?void 0:a.current,h,{onDecodeError:d,preferredCamera:r}),(u=i==null?void 0:i.current)==null||u.start().then(()=>c(!0)).catch(g=>{g&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),l?v.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 g;const u=r===An.USER?An.ENVIRONMENT:An.USER;o(u),(g=i==null?void 0:i.current)==null||g.setCamera(u)},children:v.jsx("img",{src:xu,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:l,onClick:()=>f(!0)})})]})}function hP({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=rn(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),l=d=>{t(d==null?void 0:d.data)},f=d=>{};x.useEffect(()=>()=>{var d;a!=null&&a.current||(d=i==null?void 0:i.current)==null||d.stop()});const h=()=>{var d;a!=null&&a.current&&!i.current&&(i.current=new nt(a==null?void 0:a.current,l,{onDecodeError:f,preferredCamera:r}),(d=i==null?void 0:i.current)==null||d.start().then(()=>c(!0)).catch(p=>{p&&c(!1)}))};return v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:a,autoPlay:!0,playsInline:!0}),s?v.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 p;const d=r===An.USER?An.ENVIRONMENT:An.USER;o(d),(p=i==null?void 0:i.current)==null||p.setCamera(d)},children:v.jsx("img",{src:xu,alt:"camera-switch"})}):v.jsx("div",{className:"absolute left-1/2 right-1/2 top-1/2 flex items-center justify-center",children:v.jsx(it,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function ba({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=u6()??[0,0],{subscribe:s,unsubscribe:c}=qa(),{cameraService:l}=rn(),f=d=>{e(d)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const d=p=>{e(p.detail.code)};return s("onCodeScan",d),()=>{c("onCodeScan",d)}},[a]);const h=()=>{switch(+l){case 1:return v.jsx(My,{onScan:f});case 2:return v.jsx(fP,{onScan:f});case 3:return v.jsx(dP,{onScan:f});case 4:return v.jsx(hP,{onScan:f});default:return v.jsx(My,{onScan:f})}};return v.jsxs("div",{ref:o,children:[v.jsxs("div",{className:"mb-4 flex flex-col gap-4",children:[h(),v.jsx("hr",{})]}),v.jsx(ii,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:d=>{n&&n(!0),e(d.target.value)}})]})}function pP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n,portalSession:r}=We(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),f=nn(),h=Vt(),d=()=>{l(!0),h.get(`${n}/check-code/${o}`,{code:o}).then(p=>{if(p.data.identifier)return f(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return f(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return f(`giftcard/${p.data.giftcard.hash}`);e(t("unknownCode",{code:o}))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{o&&!a&&d()},[o]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:d,children:v.jsx(ba,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),onClick:d,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:t("useEmail"),variant:"secondary",onClick:()=>f("email")})]})})]})})}function gP(){const{hash:t}=ro();return v.jsx(Cr,{to:`${qe.GIFTCARD}/select/${t}`})}function mP(){const{identifierValue:t}=ro(),{errorToast:e}=Yt(),{uuid:n,mutate:r}=We(),{onContactLink:o}=rn(),[i,a]=x.useState(!1),s=Vt(),c=f=>s.get(`${n}/contacts`,{contact_uuid:f}),l=()=>{s.put(n,{contact_identifier_value:t}).then(f=>{o&&c(f.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{l()},[]),i?v.jsx(Cr,{to:`${qe.PORTAL}/overview`}):v.jsx(Nr,{})}function Cv(t){const{portalSession:e}=We(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=wr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function yP(){const{t}=Ue(),{code:e}=ro(),{voucher:n}=Cv(e),{portalSession:r}=We(),[o,i]=x.useState(!1),[a,s]=x.useState(!1),c=nn(),l=()=>{n!=null&&n.contact||r.contact?i(!0):s(!0)};return x.useEffect(()=>{n&&l()},[n]),n?v.jsxs(v.Fragment,{children:[o?v.jsx(Cr,{to:`${qe.VOUCHER}/${n.code}/redeem`}):v.jsx(Nr,{}),v.jsx(ko,{title:t("noContactLinkedToVoucherTitle"),isOpen:a,onClose:()=>s(!1),primaryAction:{label:t("linkToContact"),action:()=>c(`${qe.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>s(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:n.code})})})]}):v.jsx(Nr,{})}function zu({redirectRoute:t}){const{state:e}=lr(),{t:n}=Ue(),{errorToast:r}=Yt(),{onContactLink:o}=rn(),{portalSession:i,mutate:a}=We(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=nn(),g=Vt(),m=b=>g.get(`${i.uuid}/contacts`,{contact_uuid:b}),y=()=>{h(!0),g.put(i.uuid,{email:c}).then(b=>{o&&m(b.data.data.contact.uuid).then(E=>{o==null||o(E.data.data)}),a().then(()=>u(t))}).catch(b=>{b.response.data.code===fc.CONTACT_NOT_FOUND&&p(!0)}).finally(()=>h(!1))},w=()=>{h(!0),g.post(`${i.uuid}/contacts`,{email:c}).then(y).catch(r).finally(()=>h(!1))};return x.useEffect(()=>{s("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>c&&!f&&y(),children:v.jsx(ii,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>l(b.target.value),beforeIcon:"mail"})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:f}),v.jsx(it,{label:n("useIdentifier"),variant:"secondary",onClick:()=>u("../identifier",{state:e})})]})})]})}),v.jsx(ko,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:f},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function vP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/*",element:v.jsx(pP,{})}),v.jsx(Je,{path:"/giftcard/:hash",element:v.jsx(gP,{})}),v.jsx(Je,{path:"/identifier/:identifierValue",element:v.jsx(mP,{})}),v.jsx(Je,{path:"/voucher/:code",element:v.jsx(yP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PORTAL})})]})}const wP={[tn.GIFTCARD]:`${qe.GIFTCARD}/select`,[tn.REDEEM_GIFTCARD]:`${qe.GIFTCARD}/redeem`,[tn.TOP_UP_GIFTCARD]:`${qe.GIFTCARD}/top-up`};function bP(){const{t}=Ue(),{portalSession:e}=We(),{errorToast:n}=Yt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),l=Vt(),f=nn(),h=()=>{a(!0),l.get(`${e.uuid}/giftcards/${r}`).then(d=>{const p=e.type;f(`${wP[p]}/${d.data.data.hash}`)}).catch(d=>{n(d),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(Mt,{children:v.jsx(ba,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(dn,{children:v.jsx(it,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function EP(){const{t}=Ue(),{hash:e}=ro(),n=nn();return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(it,{className:"grow",label:t("redeem"),onClick:()=>n(`${qe.GIFTCARD}/redeem/${e}`)}),v.jsx(it,{className:"grow",label:t("topUp"),onClick:()=>n(`${qe.GIFTCARD}/top-up/${e}`)})]})})]})})}function _v(t){const{portalSession:e}=We(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=wr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function Ms(){const{mutate:t}=We();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{B3(r.data.data.events)})}}}function CP(){const{t}=Ue(),{errorToast:e}=Yt(),{hash:n}=ro(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=We(),{onUseGiftcard:s}=rn(),{post:c}=Ms(),[l]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[f,h]=x.useState(!1),d=i.inputData.allow_multiple_giftcards??!0,p=nn(),u=Vt(),g=()=>{h(!0),u.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:-m()}).then(E=>{o(),a(),c(),s==null||s(E.data.data)}).catch(e).finally(()=>h(!1))},m=()=>Math.min(y(),r.amount_in_cents),y=()=>i.results.remaining_amount??i.inputData.amount_in_cents,w=()=>{let E=0;return i.events.filter(S=>S.type===To.GIFTCARD_TRANSACTION).forEach(S=>{S.data.giftcard.uuid===r.uuid&&(E+=S.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Li(m(),i.currency)}),onClick:g};if(d&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(qe.GIFTCARD),variant:"secondary"}};return r?v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("balance")}),v.jsx(Po,{value:r.amount_in_cents,start:r.amount_in_cents-w(),currency:i.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"font-light text-gray-500",children:t("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Po,{value:l+w(),start:l,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(dn,{children:v.jsx(it,{label:"",className:"w-full",...b(),pending:f})})]})}):v.jsx(Nr,{})}function _P({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{l(t?t.toString():"")},[]);const s=f=>{e(f?parseInt(f):0),l(f)},c=f=>{const{key:h}=f;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let d;if(h!=="Backspace")d=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);d=p.length?parseInt(p,10):0}e(d),l(d?d.toString():"")},l=f=>{a&&a.current&&(f?a.current.style.width=`${Math.max(f.length,3)*3}rem`:a.current.style.width="calc(3rem + 14px)")};return v.jsxs(v.Fragment,{children:[v.jsx("input",{ref:a,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:t?(t/100).toFixed(2):"",onKeyDown:c,onChange:()=>{},onFocus:()=>o(!0),onBlur:()=>o(!1)}),n&&v.jsx("div",{className:`mobile:hidden bottom-2 left-2 right-2 z-50 mx-auto w-[98vw] max-w-[1200px] ${!r&&"hidden"} absolute`,children:v.jsx(jp,{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:s})})]})}function Av({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),[a,s]=x.useState(0),{portalSession:c}=We(),l=()=>{let f=0;return c.events.filter(d=>Object.values(To).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f};return v.jsxs(Ut,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Po,{value:e??0,start:e??0,currency:c.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsx("div",{className:"flex items-center justify-center gap-1 p-4 text-5xl font-bold",children:l()?v.jsx(Po,{value:0,start:a,currency:c.currency,asCurrency:!0}):v.jsxs("div",{className:"flex items-center justify-center gap-1 ",children:[v.jsx("p",{children:k3(c.currency)}),v.jsx(_P,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(dn,{children:v.jsx(it,{label:i("confirmAndPay",{amount:Li(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!l(),pending:o})})]})}function AP(){const{t}=Ue(),{errorToast:e}=Yt(),{hash:n}=ro(),{giftcard:r,mutate:o}=_v(n),{portalSession:i,mutate:a}=We(),{post:s}=Ms(),{onUseGiftcard:c}=rn(),[l,f]=x.useState(!1),h=Vt(),d=p=>{f(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(u=>{o(),a(),s(),c==null||c(u.data.data),Tt.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Li(u.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>f(!1))};return r?v.jsx(Rn,{children:v.jsx(Av,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:d,pending:l})}):v.jsx(Nr,{})}function SP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(bP,{})}),v.jsx(Je,{path:"/select/:hash",element:v.jsx(EP,{})}),v.jsx(Je,{path:"/redeem/:hash",element:v.jsx(CP,{})}),v.jsx(Je,{path:"/top-up/:hash",element:v.jsx(AP,{})})]})}class lh{constructor(){sr(this,"uuid");sr(this,"email");sr(this,"credit_balance");sr(this,"prepaid_balance");sr(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 Sv=x.createContext({contact:new lh,mutate:async()=>{}});function dh({children:t}){const{uuid:e}=We(),[n,r]=x.useState(new lh),{mutate:o}=wr({url:`${e}/contacts`,onData:a=>{const s=new lh;s.uuid=a.uuid,s.email=a.email,s.credit_balance=a.credit_balance,s.prepaid_balance=a.prepaid_balance,s.current_display_values=a.current_display_values,r(s)}}),i=x.useMemo(()=>({contact:n,mutate:o}),[n,o]);return n.uuid?v.jsx(Sv.Provider,{value:i,children:t}):v.jsx(Nr,{})}function yr(){const t=x.useContext(Sv);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function $u({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(Wl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function IP(){const{t}=Ue(),{errorToast:e}=Yt(),{contact:n,mutate:r}=yr(),{uuid:o,portalSession:i,mutate:a}=We(),s=Vt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},l=()=>{const f=i.events.filter(h=>h.type===To.CREDIT_RECEPTION);return f.length?f[0]:null};return x.useEffect(()=>{l()||c()},[]),v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsx("div",{className:"flex h-full flex-col items-center gap-2 p-6",children:i.inputData.amount_in_cents?v.jsx("div",{className:"flex h-full items-center justify-center gap-1 text-4xl font-bold",children:l()?v.jsxs(v.Fragment,{children:["+",v.jsx(Po,{value:l().data.credits,start:0})]}):v.jsx($u,{})}):v.jsx("p",{className:"text-core-red-500",children:t("xIsRequired",{x:"Amount in cents"})+"."})}),v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:`${t("new")} ${t("balance").toLowerCase()}`}),v.jsx(Po,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(l()?l().data.credits:0)})]})})]})})]})})}function TP(){const{portalSession:t}=We();return t.contact?v.jsx(dh,{children:v.jsx(IP,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ri.EMAIL?v.jsx(Cr,{to:`${qe.POINTS_TRANSACTION}/email`}):v.jsx(Cr,{to:`${qe.POINTS_TRANSACTION}/identifier`})}function fh({redirectRoute:t}){const{t:e}=Ue(),{state:n}=lr(),{portalSession:r,mutate:o}=We(),{onContactLink:i}=rn(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt();x.useEffect(()=>{!f&&a&&u()},[a]);const u=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&g(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(t,{state:{contactIdentifier:a}}))}).catch(()=>d("link",{state:{contactIdentifier:a}})).finally(()=>l(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>a&&u(),children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:e("continue"),onClick:u,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:e("useEmail"),variant:"secondary",onClick:()=>d("../email",{state:n})})]})})]})})}function hh({redirectRoute:t}){const{t:e}=Ue(),{errorToast:n}=Yt(),{uuid:r,mutate:o}=We(),{onContactLink:i}=rn(),{state:a}=lr(),{publish:s}=qa(),[c,l]=x.useState(""),[f,h]=x.useState(!1),[d,p]=x.useState(!1),u=nn(),g=Vt();if(!a||!a.contactIdentifier)return v.jsx(Cr,{to:"../"});const m=()=>{h(!0),g.post(`${r}/contacts/link-identifier`,{contact_identifier_value:a.contactIdentifier,email:c}).then(w).catch(E=>{E.response.data.code===fc.CONTACT_NOT_FOUND?p(!0):n(E)}).finally(()=>h(!1))},y=()=>{h(!0),g.post(`${r}/contacts`,{email:c}).then(m).catch(n).finally(()=>h(!1))},w=()=>{g.put(r,{email:c}).then(E=>{i&&b(E.data.data.contact.uuid).then(C=>{i==null||i(C.data.data)}),o().then(()=>u(t))}).catch(n).finally(()=>h(!1))},b=E=>g.get(`${r}/contacts`,{contact_uuid:E});return x.useEffect(()=>{s("openKeyboard",{inputId:"new-contact-identifier-input",inputValue:""})},[]),v.jsxs(Rn,{children:[v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(o6,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(bi,{onSubmit:m,children:v.jsx(ii,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:E=>l(E.target.value),beforeIcon:"mail"})})]})}),v.jsx(dn,{children:v.jsx(it,{label:e("continue"),className:"w-full",onClick:m,disabled:!c||f})})]}),v.jsx(ko,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:d,onClose:()=>p(!1),primaryAction:{label:e("confirm"),action:y,loading:f},secondaryAction:{label:e("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:c})})})]})}function xP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(TP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.POINTS_TRANSACTION})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.POINTS_TRANSACTION})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.POINTS_TRANSACTION})})]})}function OP(){const{portalSession:t}=We(),{primaryIdentificationMethod:e}=rn();return t.contact?v.jsx(Cr,{to:`${qe.PORTAL}/overview`}):e&&e===Ri.EMAIL?v.jsx(Cr,{to:`${qe.PORTAL}/email`}):v.jsx(Cr,{to:`${qe.PORTAL}/identifier`})}function PP({children:t}){return v.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:v.jsx("div",{className:"h-full max-h-full",children:t})})}function kP({contact:t}){const{t:e}=Ue(),n=nn();return v.jsxs("div",{className:"inline-grid w-full items-center gap-4 py-4 lg:grid-cols-2",children:[v.jsxs("div",{className:"flex items-center gap-4",children:[v.jsx(nd,{src:t.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{className:"flex flex-col gap-1",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsx("p",{className:"text-lg",children:t.getDisplayName()}),t.current_display_values.tier&&v.jsx(rd,{label:t.current_display_values.tier,size:"sm",stroke:!0})]}),v.jsx("p",{className:"text-sm text-core-gray-500 ",children:e("joinedAtDate",{date:new Date(t.current_display_values.created_at).toLocaleDateString(ln.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(it,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(it,{before:v.jsx(Sn,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function Ls({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function BP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:e.current_display_values.loyalty_balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})}),v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Li(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function NP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We(),r=(o,i)=>sp(o,i)?`${sp(o,i)} ${t("yearsAgo")}`:ap(o,i)?`${ap(o,i)} ${t("weeksAgo")}`:ip(o,i)?`${ip(o,i)} ${t("daysAgo")}`:t("today");return v.jsx(Ls,{children:v.jsxs("div",{className:"h-full justify-between",children:[v.jsx("p",{className:"mb-4 text-lg font-semibold leading-7",children:t("stats")}),v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"calendar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:r(new Date,new Date(e.current_display_values.loyalty_last_transaction_date))}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("lastVisit")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"shopping-bag"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_number_of_transactions} ${t("visits")}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalVisits")})]})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Sn,{icon:"dollar"}),v.jsxs("div",{children:[v.jsx("p",{className:"text-xs font-semibold",children:`${e.current_display_values.loyalty_total_credits_received} ${n.loyaltyProgram.custom_credit_name}`}),v.jsx("p",{className:"text-xs text-core-gray-500",children:t("totalCredits")})]})]})]})]})})}function Iv(){const{uuid:t}=We(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=wr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Tv({loyaltyTransaction:t}){const{t:e}=Ue();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs text-core-gray-500",children:t.type===W1.CREDIT_RECEPTION?e("transaction"):`${e("isRedeemed")} '${t.loyalty_transaction_data.title}'`}),v.jsx("p",{className:"text-xs font-semibold",children:t.credits>0?"+"+t.credits:t.credits})]})}function RP(){const{t}=Ue(),e=nn(),{loyaltyTransactions:n}=Iv();return n?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between gap-4",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("activities")}),n&&n.length?v.jsx("div",{children:n.slice(0,5).map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(it,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx($u,{})}function xv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function Ov({subscription:t,onChange:e,editable:n=!1}){const{t:r}=Ue();return v.jsxs("div",{className:"mb-2 flex justify-between",children:[v.jsx("p",{className:"text-xs font-semibold",children:t.subscription_type.name}),n?v.jsx(Md,{defaultChecked:t.is_subscribed,disabled:t.subscription_type.strategy===Y1.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(rd,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function DP(){const{t}=Ue(),{subscriptions:e}=xv(),n=nn();return e?v.jsx(Ls,{children:v.jsxs("div",{className:"flex h-full flex-col justify-between",children:[v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{className:"text-lg font-semibold leading-7",children:t("subscriptions")}),v.jsx("div",{children:e.map(r=>v.jsx(Ov,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(it,{label:t("change"),before:v.jsx(Sn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx($u,{})}function MP(){const{contact:t}=yr();return v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(kP,{contact:t})}),v.jsx(Mt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(BP,{}),v.jsx(NP,{}),v.jsx(RP,{}),v.jsx(DP,{})]})})]})}function Fs({label:t,path:e}){const n=nn();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(it,{label:t,variant:"link-gray",before:v.jsx(Sn,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function LP(){const{t}=Ue(),{loyaltyTransactions:e}=Iv(),{contact:n}=yr();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsx("p",{className:"text-sm font-medium",children:t("allActivities")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("checkOutAllActivitiesOfName",{name:n.getDisplayName()})}),v.jsx("div",{className:"overflow-auto",children:e==null?void 0:e.map(r=>v.jsx(Tv,{loyaltyTransaction:r},r.uuid))})]})})]})})}function FP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{subscriptions:r,mutate:o}=xv(),[i,a]=x.useState({}),[s,c]=x.useState(!1),l=Vt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((u,g)=>({...u,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[r]);const f=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),l.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},d=()=>r&&r.some(p=>i[p.subscription_type.name]!==p.is_subscribed);return r?v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("subscriptions")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("manageEmailPreferences")}),r.map(p=>v.jsx(Ov,{subscription:p,onChange:f,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(dn,{children:v.jsx(it,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!d()||s})})]})}):v.jsx($u,{})}function jP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contact:r,mutate:o}=yr(),[i,a]=x.useState(),[s,c]=x.useState(!1),[l,f]=x.useState(),h=Vt();wr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const d=g=>{f({...l,[g.target.name]:g.target.value})},p=(g,m)=>{f({...l,[g]:m})},u=async()=>{c(!0),h.put(`${n}/contact-attributes`,l).then(()=>{o(),f(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsxs("div",{className:"md:max-h-[528px]",children:[v.jsxs("div",{className:"mb-4 flex flex-row items-center gap-4 border-b border-b-core-gray-200 px-1 pb-4",children:[v.jsx(nd,{src:r.current_display_values.avatar,size:"2xl"}),v.jsxs("div",{children:[v.jsx("div",{className:"flex flex-row items-center gap-2 ",children:v.jsxs("h1",{className:"text-lg text-core-gray-900",children:[r.current_display_values.firstname," ",r.current_display_values.lastname]})}),v.jsx("p",{className:"text-sm text-core-gray-500",children:r.current_display_values.email})]})]}),i?i.map(g=>{if(!(g.type==="media_upload"||g.type==="email"))return g.type==="select"?v.jsx(v6,{name:g.name,label:g.label,value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(id,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(p6,{name:g.name,value:l&&l[g.name]?l[g.name]:g.defaultValue,label:g.label,onChange:p,disabled:g.disabled,options:g.options},g.id):g.type==="birth_date"||g.type==="date_time"?v.jsx(Up,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:l&&l[g.name]?l[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:d},g.id):v.jsx(ii,{disabled:g.disabled,label:g.label,name:g.name,value:l&&l[g.name]!=="undefined"?l[g.name]:r.current_display_values[g.name],onChange:d},g.id)}):v.jsx(Yc,{rows:10})]})}),v.jsx(dn,{children:v.jsx(it,{label:t("saveChanges"),className:"w-full",onClick:u,disabled:!l,pending:s})})]})})}function Pv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function VP({identifier:t,onClear:e}){const{t:n}=Ue();return v.jsxs("div",{className:"flex items-center justify-between rounded-lg border text-xs",children:[v.jsxs("div",{className:"flex-col pl-4",children:[v.jsx("p",{className:"font-semibold",children:t.value}),v.jsx("p",{className:"text-core-gray-500",children:n("contactIdentifier")})]}),v.jsx("div",{className:"h-full border-l p-4 hover:cursor-pointer hover:bg-core-gray-50",onClick:()=>e&&e(t.value),children:v.jsx(Sn,{className:"h-full",icon:"close"})})]})}function UP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contactIdentifiers:r,isLoading:o,mutate:i}=Pv(),[a,s]=x.useState(""),[c,l]=x.useState(!1),f=nn(),h=Vt(),d=u=>{s(u),l(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>l(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile"})}),v.jsx(Mt,{children:v.jsx("div",{className:"md:max-h-[528px]",children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsxs("div",{children:[v.jsx("p",{className:"text-sm font-medium",children:t("contactIdentifiers")}),v.jsx("p",{className:"mb-4 text-sm text-core-gray-500",children:t("contactIdentifierDescription")})]}),o?v.jsx(Yc,{rows:10}):r==null?void 0:r.map(u=>v.jsx(VP,{identifier:u,onClear:d},u.value))]})})}),v.jsx(dn,{children:v.jsx(it,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>f("create")})})]}),v.jsx(ko,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>l(!1)},onClose:()=>l(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function GP(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n}=We(),{contact:r}=yr(),{mutate:o}=Pv(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[l,f]=x.useState(!1),h=nn(),d=Vt(),p=()=>{c(!0),d.post(`${n}/contacts/link-identifier`,{contact_identifier_value:i,email:r.email}).then(()=>{o(),h("../profile/contact-identifiers")}).catch(e).finally(()=>{a(""),c(!1)})};return x.useEffect(()=>{!l&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx(Fs,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>i&&p(),children:v.jsx(ba,{data:i,dataSetter:a,setDefer:f,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsx(it,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function qP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/profile",element:v.jsx(MP,{})}),v.jsx(Je,{path:"/profile/activity",element:v.jsx(LP,{})}),v.jsx(Je,{path:"/profile/subscriptions",element:v.jsx(FP,{})}),v.jsx(Je,{path:"/profile/contact-identifiers",element:v.jsx(UP,{})}),v.jsx(Je,{path:"/profile/contact-identifiers/create",element:v.jsx(GP,{})}),v.jsx(Je,{path:"/profile/contact-attributes",element:v.jsx(jP,{})})]})}function HP(){const{t}=Ue(),{contact:e}=yr(),{portalSession:n}=We();return v.jsxs("div",{className:"flex h-16 items-center justify-between",children:[v.jsx("h1",{children:t("rewards")}),v.jsxs("div",{className:"flex flex-col items-center",children:[v.jsx("p",{children:e.credit_balance.balance}),v.jsx("p",{className:"text-sm text-core-gray-500",children:n.loyaltyProgram.custom_credit_name})]})]})}function kv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function ph({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=We(),{contact:a}=yr();return v.jsxs("div",{className:`max-h-[48px] rounded-lg border ${r?"pointer-events-none opacity-40":!o&&"cursor-pointer"}`,children:[v.jsxs("div",{className:`flex items-center justify-between rounded-lg text-xs ${r?"px-2 pt-2":"p-2"}`,onClick:o?void 0:()=>(e==null?void 0:e.uuid)===t.uuid?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.media&&t.media.value?t.media.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsx("p",{className:"truncate",children:t.title??t.description})]}),v.jsxs("p",{className:"whitespace-nowrap text-core-primary-500",children:[t.required_credits," ",i.loyaltyProgram.custom_credit_name]})]}),t.required_credits-a.credit_balance.balance>0&&v.jsx(g6,{value:a.credit_balance.balance,max:t.required_credits})]})}function WP({selected:t,setSelected:e}){const{t:n}=Ue(),{contact:r}=yr(),{rewards:o,isLoading:i}=kv(),a=o==null?void 0:o.filter(c=>c.required_credits<=r.credit_balance.balance),s=o==null?void 0:o.filter(c=>c.required_credits>r.credit_balance.balance);return v.jsx(v.Fragment,{children:i?v.jsx(Yc,{rows:1}):v.jsxs("div",{className:"flex flex-col gap-3 md:max-h-[528px]",children:[v.jsx("div",{className:"flex flex-col gap-1",children:(a==null?void 0:a.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("redeemableRewards")}),a.map(c=>v.jsx(ph,{reward:c,selected:t,setSelected:e},c.uuid))]})}),v.jsx("div",{className:"flex flex-col gap-1",children:(s==null?void 0:s.length)>0&&v.jsxs(v.Fragment,{children:[v.jsx("p",{className:"text-sm font-light text-core-gray-500",children:n("saveABitMore")}),s.map(c=>v.jsx(ph,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function YP(){const{portalSession:t}=We(),{rewards:e}=kv(),n=()=>t.events.filter(r=>r.type===To.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(H0,{children:n().map((r,o)=>v.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-core-primary-100 bg-core-primary-50 p-2 text-xs",children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.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"}),v.jsx("p",{className:"truncate",children:r.title??r.description})]}),v.jsxs("p",{className:"text-core-primary-500",children:[r.required_credits," ",t.loyaltyProgram.custom_credit_name]})]},`${o}-${r.uuid}`))},n().length)}):v.jsx(v.Fragment,{})}function KP(){const{t}=Ue(),{errorToast:e,successToast:n}=Yt(),{portalSession:r,mutate:o}=We(),{mutate:i}=yr(),{onClaimReward:a}=rn(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),{post:p}=Ms(),u=Vt();x.useEffect(()=>{s&&d(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===To.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,S)=>new Date(C.created_at)>new Date(S.created_at)?C:S);a==null||a(y,E.data.uuid)})},m=()=>{f(!0),u.post(`${r.uuid}/rewards/claim`,{uuid:s.uuid}).then(y=>{p(),i(),g(y.data.data),n(t("rewardClaimed",{name:y.data.data.title}))}).catch(e).finally(()=>{d(!1),c(void 0),f(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(HP,{})}),v.jsx(Mt,{children:v.jsx(WP,{selected:s,setSelected:c})}),v.jsx(dn,{children:v.jsx(YP,{})})]}),v.jsx(ko,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},onClose:()=>d(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(ph,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function gh(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function zP(){const{t}=Ue();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function mh({voucher:t,selected:e,setSelected:n}){const{t:r}=Ue();return v.jsxs("div",{className:`flex cursor-pointer items-center justify-between gap-4 rounded-lg ${t.status===Da.REDEEMED?"border border-core-primary-100 bg-core-primary-50":"border bg-white"} p-2 text-xs`,onClick:()=>(e==null?void 0:e.code)===t.code?n(void 0):n(t),children:[v.jsxs("div",{className:"mr-4 flex items-center gap-4 overflow-hidden",children:[v.jsx("img",{src:t.promotion.image?t.promotion.image.value:"https://static.piggy.nl/images/fallback_image.png",alt:"voucher_image",className:"h-[32px] w-[32px] rounded object-cover object-center"}),v.jsxs("div",{className:"overflow-hidden overflow-ellipsis ",children:[v.jsx("p",{className:"font-semibold",children:t.name}),t.status===Da.REDEEMED?v.jsx("p",{className:"text-core-gray-500",children:r("redeemed")}):v.jsx("p",{className:"text-core-primary-500",children:t.expiration_date?`Valid until ${new Date(t.expiration_date).toLocaleDateString()}`:r("nonExpiring")})]})]}),v.jsx("p",{className:`text-core-${t.status===Da.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function $P({selected:t,setSelected:e}){const{t:n}=Ue(),{vouchers:r,isLoading:o}=gh();return v.jsx(v.Fragment,{children:o?v.jsx(Yc,{rows:1}):v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:v.jsx("div",{className:"flex flex-col gap-1 md:max-h-[528px]",children:r&&r.length?r.map(i=>v.jsx(mh,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function XP(){const{t}=Ue(),{portalSession:e}=We(),{vouchers:n}=gh(),r=()=>e.events.filter(o=>o.type===To.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(H0,{children:r().map((o,i)=>v.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-core-primary-100 bg-core-primary-50 p-2",children:v.jsx("div",{className:"flex h-full flex-col justify-between text-xs",children:v.jsxs("div",{className:"overflow-hidden",children:[v.jsx("p",{className:"font-semibold",children:o.data.name}),v.jsxs("p",{className:"overflow-ellipsis text-core-gray-500",children:[o.data.code," - ",t("applied")]})]})})},`${i}-${o.data.uuid}`))},r().length)}):v.jsx(v.Fragment,{})}function QP(){const{t}=Ue(),{errorToast:e,successToast:n}=Yt(),{uuid:r}=We(),{onRedeemVoucher:o}=rn(),{post:i}=Ms(),{mutate:a}=gh(),[s,c]=x.useState(),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=Vt();x.useEffect(()=>{s&&d(!0)},[s]);const u=()=>{f(!0),p.post(`${r}/vouchers/redeem`,{code:s.code}).then(m=>{i(),o&&o(m.data.data),n(t("voucherSuccessfullyRedeemed")),a()}).catch(e).finally(()=>{g(),f(!1)})},g=()=>{d(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx(zP,{})}),v.jsx(Mt,{children:v.jsx($P,{selected:s,setSelected:c})}),v.jsx(dn,{children:v.jsx(XP,{})})]}),v.jsx(ko,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:u,loading:l},secondaryAction:{label:t("cancel"),action:g},onClose:g,children:v.jsxs("div",{className:"flex flex-col gap-4",children:[v.jsx("p",{children:t("redeemTitle",{title:s==null?void 0:s.name})}),s&&v.jsx(mh,{voucher:s,setSelected:c})]})})]})}function JP(){const{t}=Ue(),[e,n]=x.useState(1),r=nn(),o=[{id:0,label:t("profile"),icon:"user",pathname:"profile"},{id:1,label:t("rewards"),icon:"edit",pathname:"rewards"},{id:2,label:t("vouchers"),icon:"mail",pathname:"vouchers"}];return x.useEffect(()=>{r(o[e].pathname)},[]),v.jsx(dh,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(K8,{children:o.map(i=>v.jsx(z8,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(PP,{children:[v.jsx(qP,{}),v.jsxs(oo,{children:[v.jsx(Je,{path:"/rewards",element:v.jsx(KP,{})}),v.jsx(Je,{path:"/vouchers",element:v.jsx(QP,{})})]})]})]})})}function ZP(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(OP,{})}),v.jsx(Je,{path:"/overview/*",element:v.jsx(JP,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PORTAL})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.PORTAL})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.PORTAL})})]})}function Bv(){const{uuid:t}=We(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=wr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function ek(){const{t}=Ue(),{state:e}=lr(),{errorToast:n,successToast:r}=Yt(),{uuid:o,mutate:i}=We(),{contact:a}=yr(),{onCreatePrepaidTransaction:s}=rn(),{prepaidBalance:c,mutate:l}=Bv(),[f,h]=x.useState(!1),d=Vt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Rn,{children:v.jsx(Av,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Nr,{})}function tk({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),{portalSession:a}=We(),s=a.inputData.amount_in_cents??0,c=()=>{let f=0;return a.events.filter(d=>Object.values(To).includes(d.type)).forEach(d=>{f+=d.data.amount_in_cents}),f},l=()=>Math.min(s+c(),e);return v.jsxs(Ut,{children:[t&&v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsx("div",{className:"rounded-lg bg-core-primary-50 p-4",children:v.jsxs("div",{className:"flex justify-between",children:[v.jsx("p",{className:"font-light text-gray-500",children:n??i("balance")}),v.jsx(Po,{value:e,start:e+c(),currency:a.currency,asCurrency:!0})]})}),v.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-6",children:v.jsxs("div",{className:"flex flex-col items-center gap-2 p-4",children:[v.jsx("p",{className:"text-sm font-light text-gray-500",children:i("amountToPay")}),v.jsx("div",{className:"text-5xl font-bold",children:v.jsx(Po,{value:l(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(dn,{children:v.jsx(it,{label:i("confirmAndPay",{amount:Li(l(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-l()),disabled:!s||!!c(),pending:o})})]})}function nk(){const{t}=Ue(),{state:e}=lr(),{errorToast:n,successToast:r}=Yt(),{uuid:o,mutate:i}=We(),{contact:a}=yr(),{onCreatePrepaidTransaction:s}=rn(),{prepaidBalance:c,mutate:l}=Bv(),[f,h]=x.useState(!1),d=Vt(),p=u=>{h(!0),d.post(`${o}/prepaid/transaction`,{amount_in_cents:u,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{l(),i(),s==null||s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Rn,{children:v.jsx(tk,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:f})}):v.jsx(Nr,{})}function rk({setType:t}){const{t:e}=Ue();return v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(Mt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(it,{className:"grow",label:e("pay"),onClick:()=>t(tn.PAY_PREPAID)}),v.jsx(it,{className:"grow",label:e("topUp"),onClick:()=>t(tn.TOP_UP_PREPAID)})]})})]})})}function ok(){const{portalSession:t}=We(),{primaryIdentificationMethod:e}=rn(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ri.EMAIL?v.jsx(Cr,{to:`${qe.PREPAID}/email`}):v.jsx(Cr,{to:`${qe.PREPAID}/identifier`});const o=()=>n===tn.TOP_UP_PREPAID?v.jsx(ek,{}):n===tn.PAY_PREPAID?v.jsx(nk,{}):v.jsx(rk,{setType:r});return v.jsx(dh,{children:o()})}function ik(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(ok,{})}),v.jsx(Je,{path:"/email",element:v.jsx(zu,{redirectRoute:qe.PREPAID})}),v.jsx(Je,{path:"/identifier",element:v.jsx(fh,{redirectRoute:qe.PREPAID})}),v.jsx(Je,{path:"/identifier/link",element:v.jsx(hh,{redirectRoute:qe.PREPAID})})]})}function ak(){const{t}=Ue(),{errorToast:e}=Yt(),{uuid:n,portalSession:r}=We(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt(),u=()=>{s(!0),p.get(`${n}/vouchers/check/${o}`).then(g=>{g.data.data.contact||r.contact?d(`${o}/redeem`):h(!0)}).catch(e).finally(()=>s(!1))};return x.useEffect(()=>{!c&&o&&u()},[o]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(ba,{data:o,dataSetter:i,setDefer:l,label:t("code")})}),v.jsx(dn,{children:v.jsx(it,{label:t("submit"),className:"w-full",onClick:u,pending:a})})]})}),v.jsx(ko,{title:t("noContactLinkedToVoucherTitle"),isOpen:f,onClose:()=>h(!1),primaryAction:{label:t("linkToContact"),action:()=>d(`${o}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>h(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:o})})})]})}function sk(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{uuid:r}=We(),{onRedeemVoucher:o}=rn(),{post:i}=Ms(),{voucher:a,mutate:s}=Cv(n),[c,l]=x.useState(!1),f=Vt(),h=()=>{l(!0),f.post(`${r}/vouchers/redeem`,{code:n}).then(d=>{o==null||o(d.data.data),i(),s()}).catch(e).finally(()=>l(!1))};return a?v.jsx(Rn,{children:v.jsxs(Ut,{children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(Mt,{children:v.jsx("div",{children:v.jsx(mh,{voucher:a,setSelected:()=>{}})})}),v.jsx(dn,{children:v.jsx(it,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Da.ACTIVE||c,pending:c})})]})}):v.jsx(Nr,{})}function ck(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{portalSession:r,mutate:o}=We(),{onContactLink:i}=rn(),[a,s]=x.useState(""),[c,l]=x.useState(!1),[f,h]=x.useState(!1),d=nn(),p=Vt(),u=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{l(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&u(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>d(`${qe.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>l(!1))};return x.useEffect(()=>{!f&&a&&g()},[a]),v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:g,children:v.jsx(ba,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(it,{label:t("useEmail"),variant:"secondary",onClick:()=>d(`../${n}/email`)})]})})]})})}function uk(){const{t}=Ue(),{errorToast:e}=Yt(),{code:n}=ro(),{onContactLink:r}=rn(),{portalSession:o,mutate:i}=We(),{publish:a}=qa(),[s,c]=x.useState(""),[l,f]=x.useState(!1),[h,d]=x.useState(!1),p=nn(),u=Vt(),g=w=>u.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{f(!0),u.put(o.uuid,{email:s}).then(w=>{r&&g(w.data.data.contact.uuid).then(b=>{r==null||r(b.data.data)}),i().then(()=>p(`${qe.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===fc.CONTACT_NOT_FOUND&&d(!0)}).finally(()=>f(!1))},y=()=>{f(!0),u.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>f(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Rn,{children:v.jsxs(Ut,{id:_r,children:[v.jsx(Lt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(Mt,{children:v.jsx(bi,{onSubmit:()=>s&&!l&&m(),children:v.jsx(ii,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(dn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(it,{label:t("continue"),className:"w-full",onClick:m,pending:l,disabled:!s||l}),v.jsx(it,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(ko,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>d(!1),primaryAction:{label:t("confirm"),action:y,disabled:l},secondaryAction:{label:t("cancel"),action:()=>d(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function lk(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(ak,{})}),v.jsx(Je,{path:":code/redeem",element:v.jsx(sk,{})}),v.jsx(Je,{path:":code/email",element:v.jsx(uk,{})}),v.jsx(Je,{path:":code/identifier",element:v.jsx(ck,{})})]})}function dk(){return v.jsxs(oo,{children:[v.jsx(Je,{path:"/",element:v.jsx(b7,{})}),v.jsx(Je,{path:`${qe.GENERIC}/*`,element:v.jsx(vP,{})}),v.jsx(Je,{path:`${qe.GIFTCARD}/*`,element:v.jsx(SP,{})}),v.jsx(Je,{path:`${qe.POINTS_TRANSACTION}/*`,element:v.jsx(xP,{})}),v.jsx(Je,{path:`${qe.PORTAL}/*`,element:v.jsx(ZP,{})}),v.jsx(Je,{path:`${qe.PREPAID}/*`,element:v.jsx(ik,{})}),v.jsx(Je,{path:`${qe.VOUCHER}/*`,element:v.jsx(lk,{})})]})}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function Nv(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":yh(XMLHttpRequest))==="object"}function fk(t){return!!t&&typeof t.then=="function"}function hk(t){return fk(t)?t:Promise.resolve(t)}function pk(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vh={exports:{}},Xu={exports:{}},Rv;function gk(){return Rv||(Rv=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof Zo<"u"&&Zo,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(a){var s=typeof i<"u"&&i||typeof self<"u"&&self||typeof s<"u"&&s,c={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function l(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&f.indexOf(Object.prototype.toString.call(k))>-1};function d(k){if(typeof k!="string"&&(k=String(k)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(k)||k==="")throw new TypeError('Invalid character in header field name: "'+k+'"');return k.toLowerCase()}function p(k){return typeof k!="string"&&(k=String(k)),k}function u(k){var V={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(V[Symbol.iterator]=function(){return V}),V}function g(k){this.map={},k instanceof g?k.forEach(function(V,z){this.append(z,V)},this):Array.isArray(k)?k.forEach(function(V){this.append(V[0],V[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(V){this.append(V,k[V])},this)}g.prototype.append=function(k,V){k=d(k),V=p(V);var z=this.map[k];this.map[k]=z?z+", "+V:V},g.prototype.delete=function(k){delete this.map[d(k)]},g.prototype.get=function(k){return k=d(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(d(k))},g.prototype.set=function(k,V){this.map[d(k)]=p(V)},g.prototype.forEach=function(k,V){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(V,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(V,z){k.push(z)}),u(k)},g.prototype.values=function(){var k=[];return this.forEach(function(V){k.push(V)}),u(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(V,z){k.push([z,V])}),u(k)},c.iterable&&(g.prototype[Symbol.iterator]=g.prototype.entries);function m(k){if(k.bodyUsed)return Promise.reject(new TypeError("Already read"));k.bodyUsed=!0}function y(k){return new Promise(function(V,z){k.onload=function(){V(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var V=new FileReader,z=y(V);return V.readAsArrayBuffer(k),z}function b(k){var V=new FileReader,z=y(V);return V.readAsText(k),z}function E(k){for(var V=new Uint8Array(k),z=new Array(V.length),te=0;te<V.length;te++)z[te]=String.fromCharCode(V[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var V=new Uint8Array(k.byteLength);return V.set(new Uint8Array(k)),V.buffer}function S(){return this.bodyUsed=!1,this._initBody=function(k){this.bodyUsed=this.bodyUsed,this._bodyInit=k,k?typeof k=="string"?this._bodyText=k:c.blob&&Blob.prototype.isPrototypeOf(k)?this._bodyBlob=k:c.formData&&FormData.prototype.isPrototypeOf(k)?this._bodyFormData=k:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(k)?this._bodyText=k.toString():c.arrayBuffer&&c.blob&&l(k)?(this._bodyArrayBuffer=C(k.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(k)||h(k))?this._bodyArrayBuffer=C(k):this._bodyText=k=Object.prototype.toString.call(k):this._bodyText="",this.headers.get("content-type")||(typeof k=="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(k)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var k=m(this);if(k)return k;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 k=m(this);return k||(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(w)}),this.text=function(){var k=m(this);if(k)return k;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(L)}),this.json=function(){return this.text().then(JSON.parse)},this}var T=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(k){var V=k.toUpperCase();return T.indexOf(V)>-1?V:k}function N(k,V){if(!(this instanceof N))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(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,V.headers||(this.headers=new g(k.headers)),this.method=k.method,this.mode=k.mode,this.signal=k.signal,!z&&k._bodyInit!=null&&(z=k._bodyInit,k.bodyUsed=!0)}else this.url=String(k);if(this.credentials=V.credentials||this.credentials||"same-origin",(V.headers||!this.headers)&&(this.headers=new g(V.headers)),this.method=P(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 te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var re=/\?/;this.url+=(re.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var V=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),re=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");V.append(decodeURIComponent(re),decodeURIComponent(ne))}}),V}function U(k){var V=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
155
155
|
`)===0?te.substr(1,te.length):te}).forEach(function(te){var re=te.split(":"),ne=re.shift().trim();if(ne){var se=re.join(":").trim();V.append(ne,se)}}),V}S.call(N.prototype);function j(k,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 g(V.headers),this.url=V.url||"",this._initBody(k)}S.call(j.prototype),j.prototype.clone=function(){return new j(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new g(this.headers),url:this.url})},j.error=function(){var k=new j(null,{status:0,statusText:""});return k.type="error",k};var K=[301,302,303,307,308];j.redirect=function(k,V){if(K.indexOf(V)===-1)throw new RangeError("Invalid status code");return new j(null,{status:V,headers:{location:k}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(V,z){this.message=V,this.name=z;var te=Error(V);this.stack=te.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function G(k,V){return new Promise(function(z,te){var re=new N(k,V);if(re.signal&&re.signal.aborted)return te(new a.DOMException("Aborted","AbortError"));var ne=new XMLHttpRequest;function se(){ne.abort()}ne.onload=function(){var le={status:ne.status,statusText:ne.statusText,headers:U(ne.getAllResponseHeaders()||"")};le.url="responseURL"in ne?ne.responseURL:le.headers.get("X-Request-URL");var Ce="response"in ne?ne.response:ne.responseText;setTimeout(function(){z(new j(Ce,le))},0)},ne.onerror=function(){setTimeout(function(){te(new TypeError("Network request failed"))},0)},ne.ontimeout=function(){setTimeout(function(){te(new TypeError("Network request failed"))},0)},ne.onabort=function(){setTimeout(function(){te(new a.DOMException("Aborted","AbortError"))},0)};function we(le){try{return le===""&&s.location.href?s.location.href:le}catch{return le}}ne.open(re.method,we(re.url),!0),re.credentials==="include"?ne.withCredentials=!0:re.credentials==="omit"&&(ne.withCredentials=!1),"responseType"in ne&&(c.blob?ne.responseType="blob":c.arrayBuffer&&re.headers.get("Content-Type")&&re.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ne.responseType="arraybuffer")),V&&typeof V.headers=="object"&&!(V.headers instanceof g)?Object.getOwnPropertyNames(V.headers).forEach(function(le){ne.setRequestHeader(le,p(V.headers[le]))}):re.headers.forEach(function(le,Ce){ne.setRequestHeader(Ce,le)}),re.signal&&(re.signal.addEventListener("abort",se),ne.onreadystatechange=function(){ne.readyState===4&&re.signal.removeEventListener("abort",se)}),ne.send(typeof re._bodyInit>"u"?null:re._bodyInit)})}return G.polyfill=!0,s.fetch||(s.fetch=G,s.Headers=g,s.Request=N,s.Response=j),a.Headers=g,a.Request=N,a.Response=j,a.fetch=G,a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=n.fetch?n:r;e=o.fetch,e.default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}(Xu,Xu.exports)),Xu.exports}(function(t,e){var n;if(typeof fetch=="function"&&(typeof Zo<"u"&&Zo.fetch?n=Zo.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof pk<"u"&&typeof window>"u"){var r=n||gk();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(vh,vh.exports);var Dv=vh.exports;const Mv=sl(Dv),Lv=Tw({__proto__:null,default:Mv},[Dv]);function Fv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function jv(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fv(Object(n),!0).forEach(function(r){mk(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Fv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mk(t,e,n){return e=yk(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yk(t){var e=vk(t,"string");return xi(e)=="symbol"?e:e+""}function vk(t,e){if(xi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(xi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function xi(t){"@babel/helpers - typeof";return xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},xi(t)}var yo;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?yo=global.fetch:typeof window<"u"&&window.fetch?yo=window.fetch:yo=fetch);var js;Nv()&&(typeof global<"u"&&global.XMLHttpRequest?js=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(js=window.XMLHttpRequest));var Qu;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?Qu=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(Qu=window.ActiveXObject)),!yo&&Lv&&!js&&!Qu&&(yo=Mv||Lv),typeof yo!="function"&&(yo=void 0);var wh=function(e,n){if(n&&xi(n)==="object"){var r="";for(var o in n)r+="&"+encodeURIComponent(o)+"="+encodeURIComponent(n[o]);if(!r)return e;e=e+(e.indexOf("?")!==-1?"&":"?")+r.slice(1)}return e},Vv=function(e,n,r,o){var i=function(c){if(!c.ok)return r(c.statusText||"Error",{status:c.status});c.text().then(function(l){r(null,{status:c.status,data:l})}).catch(r)};if(o){var a=o(e,n);if(a instanceof Promise){a.then(i).catch(r);return}}typeof fetch=="function"?fetch(e,n).then(i).catch(r):yo(e,n).then(i).catch(r)},Uv=!1,wk=function(e,n,r,o){e.queryStringParams&&(n=wh(n,e.queryStringParams));var i=jv({},typeof e.customHeaders=="function"?e.customHeaders():e.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 a=typeof e.requestOptions=="function"?e.requestOptions(r):e.requestOptions,s=jv({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:i},Uv?{}:a),c=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{Vv(n,s,o,c)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return o(l);try{Object.keys(a).forEach(function(f){delete s[f]}),Vv(n,s,o,c),Uv=!0}catch(f){o(f)}}},bk=function(e,n,r,o){r&&xi(r)==="object"&&(r=wh("",r).slice(1)),e.queryStringParams&&(n=wh(n,e.queryStringParams));try{var i;js?i=new js:i=new Qu("MSXML2.XMLHTTP.3.0"),i.open(r?"POST":"GET",n,1),e.crossDomain||i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.withCredentials=!!e.withCredentials,r&&i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.overrideMimeType&&i.overrideMimeType("application/json");var a=e.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)i.setRequestHeader(s,a[s]);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)}},Ek=function(e,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},yo&&n.indexOf("file:")!==0)return wk(e,n,r,o);if(Nv()||typeof ActiveXObject=="function")return bk(e,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function Ea(t){"@babel/helpers - typeof";return Ea=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ea(t)}function Gv(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function bh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Gv(Object(n),!0).forEach(function(r){qv(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Gv(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _k(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hv(r.key),r)}}function Ak(t,e,n){return e&&_k(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function qv(t,e,n){return e=Hv(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Hv(t){var e=Sk(t,"string");return Ea(e)=="symbol"?e:e+""}function Sk(t,e){if(Ea(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Ea(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ik=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 qv({},r,o||"")},parseLoadPayload:function(n,r){},request:Ek,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},Wv=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Ck(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return Ak(t,[{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=bh(bh(bh({},Ik()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var a=setInterval(function(){return r.reload()},this.options.reloadInterval);Ea(a)==="object"&&typeof a.unref=="function"&&a.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,a){var s=this,c=this.options.loadPath;typeof this.options.loadPath=="function"&&(c=this.options.loadPath(n,o)),c=hk(c),c.then(function(l){if(!l)return a(null,{});var f=s.services.interpolator.interpolate(l,{lng:n.join("+"),ns:o.join("+")});s.loadUrl(f,a,r,i)})}},{key:"loadUrl",value:function(n,r,o,i){var a=this,s=typeof o=="string"?[o]:o,c=typeof i=="string"?[i]:i,l=this.options.parseLoadPayload(s,c);this.options.request(this.options,n,l,function(f,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&&f&&f.message&&f.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+f.message,!0);if(f)return r(f,!1);var d,p;try{typeof h.data=="string"?d=a.options.parse(h.data,o,i):d=h.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,d)})}},{key:"create",value:function(n,r,o,i,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,o,i),l=0,f=[],h=[];n.forEach(function(d){var p=s.options.addPath;typeof s.options.addPath=="function"&&(p=s.options.addPath(d,r));var u=s.services.interpolator.interpolate(p,{lng:d,ns:r});s.options.request(s.options,u,c,function(g,m){l+=1,f.push(g),h.push(m),l===n.length&&typeof a=="function"&&a(f,h)})})}}},{key:"reload",value:function(){var n=this,r=this.services,o=r.backendConnector,i=r.languageUtils,a=r.logger,s=o.language;if(!(s&&s.toLowerCase()==="cimode")){var c=[],l=function(h){var d=i.toResolveHierarchy(h);d.forEach(function(p){c.indexOf(p)<0&&c.push(p)})};l(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(f){return l(f)}),c.forEach(function(f){n.allOptions.ns.forEach(function(h){o.read(f,h,"read",null,null,function(d,p){d&&a.warn("loading namespace ".concat(h," for language ").concat(f," failed"),d),!d&&p&&a.log("loaded namespace ".concat(h," for language ").concat(f),p),o.loaded("".concat(f,"|").concat(h),d,p)})})})}}}])}();Wv.type="backend";const{slice:Tk,forEach:xk}=[];function Ok(t){return xk.call(Tk.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const Yv=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Pk=(t,e,n)=>{const r=n||{};r.path=r.path||"/";const o=encodeURIComponent(e);let i=`${t}=${o}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!Yv.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!Yv.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},Kv={create(t,e,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=Pk(t,encodeURIComponent(e),o)},read(t){const e=`${t}=`,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(e)===0)return o.substring(e.length,o.length)}return null},remove(t){this.create(t,"",-1)}};var kk={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return Kv.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=e;n&&typeof document<"u"&&Kv.create(n,t,r,o,i)}},Bk={name:"querystring",lookup(t){var r;let{lookupQuerystring:e}=t,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 a=o.substring(1).split("&");for(let s=0;s<a.length;s++){const c=a[s].indexOf("=");c>0&&a[s].substring(0,c)===e&&(n=a[s].substring(c+1))}}return n}};let Vs=null;const zv=()=>{if(Vs!==null)return Vs;try{Vs=window!=="undefined"&&window.localStorage!==null;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Vs=!1}return Vs};var Nk={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&zv())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&zv()&&window.localStorage.setItem(n,t)}};let Us=null;const $v=()=>{if(Us!==null)return Us;try{Us=window!=="undefined"&&window.sessionStorage!==null;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Us=!1}return Us};var Rk={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&$v())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&$v()&&window.sessionStorage.setItem(n,t)}},Dk={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:o}=navigator;if(n)for(let i=0;i<n.length;i++)e.push(n[i]);r&&e.push(r),o&&e.push(o)}return e.length>0?e:void 0}},Mk={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},Lk={name:"path",lookup(t){var o;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(o=n[typeof e=="number"?e:0])==null?void 0:o.replace("/",""):void 0}},Fk={name:"subdomain",lookup(t){var o,i;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+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 jk(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t}}class Xv{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e||{languageUtils:{}},this.options=Ok(n,this.options||{},jk()),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(kk),this.addDetector(Bk),this.addDetector(Nk),this.addDetector(Rk),this.addDetector(Dk),this.addDetector(Mk),this.addDetector(Lk),this.addDetector(Fk)}addDetector(e){return this.detectors[e.name]=e,this}detect(e){e||(e=this.options.order);let n=[];return e.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(e,n){n||(n=this.options.caches),n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}Xv.type="languageDetector",ln.use(Wv).use(Xv).use(r3).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 Qv(){const{uuid:t,portalSession:e}=We(),[n,r]=x.useState();return wr({url:`${t}/brand-kit`,onData:r}),x.useEffect(()=>{n&&zE(n)},[n]),v.jsx(x.StrictMode,{children:v.jsxs(v7,{children:[v.jsx(EE,{children:v.jsx(dk,{})}),v.jsx(f6,{enabled:e.inputData.enable_on_screen_keyboard}),v.jsx(q4,{className:"lg:top-14"})]},t)})}function Jv(t){const{uuid:e,portalSession:n,error:r}=We();return n.uuid?v.jsx(Zm.Provider,{value:{...t,cameraService:n.inputData.camera_service,cameraFacingMode:n.inputData.facing_mode,primaryIdentificationMethod:n.inputData.primary_identification_method},children:t.children}):v.jsx(Nr,{message:r&&`No portal session found with uuid: ${e}.`})}function Vk(t){const{portalSession:e}=N3(t);return e?v.jsx(ul.Provider,{value:{apiKey:t.apiKey,host:t.host},children:v.jsx(K1,{uuid:e.uuid,children:v.jsx(Jv,{...t,children:v.jsx(Qv,{})})})}):v.jsx(Nr,{})}const Uk="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 Gk({message:t}){return v.jsxs("div",{className:"flex h-screen flex-col justify-center gap-12 text-center",children:[v.jsxs("div",{className:"flex items-center justify-center gap-3",children:[v.jsx("img",{alt:"logo",src:Uk,className:"z-10 h-16 w-16 hover:animate-spin"}),v.jsxs("p",{className:"z-10 text-7xl font-semibold tracking-wide text-gray-600",children:["Welcome to ",v.jsx("span",{className:"italic",children:"PortalSessions"})]})]}),v.jsx("p",{className:"text-core-red-500",children:t})]})}function qk({uuid:t,host:e}){return t?v.jsx(ul.Provider,{value:{host:e},children:v.jsx(K1,{uuid:t,children:v.jsx(Jv,{children:v.jsx(Qv,{})})})}):v.jsx(Gk,{message:"No uuid provided."})}const Hk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.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"})),Wk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",...t},ce.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"})),Yk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.createElement("path",{d:"M13.25 8.75L9.75 12L13.25 15.25",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),Kk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{d:"M17.25 6.75L6.75 17.25M6.75 6.75L17.25 17.25",strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),zk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("path",{d:"M4.7002 4.70016L11.2999 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}),ce.createElement("path",{d:"M11.2998 4.70016L4.70014 11.2998",stroke:"#000",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"}))},Symbol.toStringTag,{value:"Module"})),$k=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}),ce.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"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 7.75V8.25"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 15.75V16.25"}))},Symbol.toStringTag,{value:"Module"})),Xk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.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"})),Qk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.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"}),ce.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"})),Jk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 13V15"}),ce.createElement("circle",{cx:12,cy:9,r:.5}),ce.createElement("circle",{cx:12,cy:12,r:7.25,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5}))},Symbol.toStringTag,{value:"Module"})),Zk=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",...t},ce.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"})),eB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_17_95)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#FEF3F2"}),ce.createElement("path",{d:"M12.0003 12L20.0003 20M12.0003 20L20.0003 12",stroke:"#E02731",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_17_95"},ce.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"})),tB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_15_20)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#E7FBF4"}),ce.createElement("path",{d:"M10.6668 17.3333L14.6668 20L21.3335 12",stroke:"#039855",strokeWidth:1.6875,strokeLinecap:"round",strokeLinejoin:"round"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_15_20"},ce.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"})),nB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},ce.createElement("g",{clipPath:"url(#clip0_17_99)"},ce.createElement("rect",{width:32,height:32,rx:4,fill:"#FFFAEB"}),ce.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"})),ce.createElement("defs",null,ce.createElement("clipPath",{id:"clip0_17_99"},ce.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"})),rB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...t},ce.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"}),ce.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"})),oB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75H5.75V16.75L4.75 19.25H19.25L18.25 16.75V7.75Z"}),ce.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M18.25 7.75L16.25 4.75H7.75L5.75 7.75"}),ce.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"})),iB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{width:24,height:24,fill:"none",viewBox:"0 0 24 24",...t},ce.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"})),aB=Object.freeze(Object.defineProperty({__proto__:null,default:t=>ce.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",...t},ce.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"}),ce.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"})),sB=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)}}
|
|
156
156
|
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}}
|
|
157
157
|
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,
|