@leatcom/portal-sessions 0.0.91 → 0.0.93
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(lt,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):(lt=typeof globalThis<"u"?globalThis:lt||self,x(lt.PortalSessions={},lt.React,lt.ReactDOM))})(this,function(lt,x,vi){"use strict";var gk=Object.defineProperty;var mk=(lt,x,vi)=>x in lt?gk(lt,x,{enumerable:!0,configurable:!0,writable:!0,value:vi}):lt[x]=vi;var Qn=(lt,x,vi)=>mk(lt,typeof x!="symbol"?x+"":x,vi);try{let lt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new lt.Error().stack;x&&(lt._sentryDebugIds=lt._sentryDebugIds||{},lt._sentryDebugIds[x]="
|
|
1
|
+
(function(lt,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):(lt=typeof globalThis<"u"?globalThis:lt||self,x(lt.PortalSessions={},lt.React,lt.ReactDOM))})(this,function(lt,x,vi){"use strict";var gk=Object.defineProperty;var mk=(lt,x,vi)=>x in lt?gk(lt,x,{enumerable:!0,configurable:!0,writable:!0,value:vi}):lt[x]=vi;var Qn=(lt,x,vi)=>mk(lt,typeof x!="symbol"?x+"":x,vi);try{let lt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},x=new lt.Error().stack;x&&(lt._sentryDebugIds=lt._sentryDebugIds||{},lt._sentryDebugIds[x]="ca1f8da2-3eec-4b9d-a9a6-8e7829351d57",lt._sentryDebugIdIdentifier="sentry-dbid-ca1f8da2-3eec-4b9d-a9a6-8e7829351d57")}catch{}{let lt=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};lt._sentryModuleMetadata=lt._sentryModuleMetadata||{},lt._sentryModuleMetadata[new lt.Error().stack]=Object.assign({},lt._sentryModuleMetadata[new lt.Error().stack],{"_sentryBundlerPluginAppKey:portal-sessions-application-key":!0})}function Jy(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 Zy(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=Jy(x);{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"6f35a76474b5d09b37971f0f6a28b16a00c606ec"}}var wi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fu(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ju={exports:{}},ua={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -150,7 +150,7 @@ Error:`,o)}}function Q5(){return N5(t=>{Ki("cls",{metric:t}),Qg=t},{reportAllCha
|
|
|
150
150
|
matrix: null
|
|
151
151
|
`),e.append(`>>
|
|
152
152
|
`),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}(),QI=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)}}(),hi=function(t){function e(){return t!==null&&t.apply(this,arguments)||this}return QI(e,t),e.kind="WriterException",e}($n);(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 Ur;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],u=c[0],d=c[1];if(r.setBoolean(u,d,s),i<8){var h=r.getWidth()-i-1,f=8;r.setBoolean(h,f,s)}else h=8,f=r.getHeight()-7+(i-8),r.setBoolean(h,f,s)}},t.maybeEmbedVersionInfo=function(e,n){if(!(e.getVersionNumber()<7)){var r=new Ur;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 u=a-c;if(t.isEmpty(r.get(u,s))){var d=void 0;o<e.getSize()?(d=e.get(o),++o):d=!1,n!==255&&zI.getDataMaskBit(n,u,s)&&(d=!d),r.setBoolean(u,s,d)}}s+=i}s+=i=-i,a-=2}if(o!==e.getSize())throw new hi("Not all bits consumed: "+o+"/"+e.getSize())},t.findMSBSet=function(e){return 32-En.numberOfLeadingZeros(e)},t.calculateBCHCode=function(e,n){if(n===0)throw new Ve("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(!XI.isValidMaskPattern(n))throw new hi("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 Ur;if(a.appendBits(t.TYPE_INFO_MASK_PATTERN,15),r.xor(a),r.getSize()!==15)throw new hi("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 hi("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 hi;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 hi;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 hi;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 u=o[c];u>=0&&t.isEmpty(n.get(u,s))&&t.embedPositionAdjustmentPattern(u-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]),Yn.UTF8.getName()}();var JI=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,u){var d=t.call(this,s,c)||this;if(d.yuvData=n,d.dataWidth=r,d.dataHeight=o,d.left=i,d.top=a,i+s>r||a+c>o)throw new Ve("Crop rectangle does not fit within image data.");return u&&d.reverseHorizontal(s,c),d}JI(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ve("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 Nt.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 Nt.arraycopy(this.yuvData,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Nt.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,u=0;u<n;u++){var d=255&i[a+u*e.THUMBNAIL_SCALE_FACTOR];o[c+u]=4278190080|65793*d}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,u=a+n-1;c<s;c++,u--){var d=o[c];o[c]=o[u],o[u]=d}},e.prototype.invert=function(){return new cu(this)},e.THUMBNAIL_SCALE_FACTOR=2})(fs);var ZI=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 u=t.call(this,r,o)||this;if(u.dataWidth=i,u.dataHeight=a,u.left=s,u.top=c,n.BYTES_PER_ELEMENT===4){for(var d=r*o,h=new Uint8ClampedArray(d),f=0;f<d;f++){var p=n[f],l=p>>16&255,g=p>>7&510,m=255&p;h[f]=(l+g+m)/4&255}u.luminances=h}else u.luminances=n;if(i===void 0&&(u.dataWidth=r),a===void 0&&(u.dataHeight=o),s===void 0&&(u.left=0),c===void 0&&(u.top=0),u.left+r>u.dataWidth||u.top+o>u.dataHeight)throw new Ve("Crop rectangle does not fit within image data.");return u}ZI(e,t),e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ve("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 Nt.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 Nt.arraycopy(this.luminances,a,i,0,o),i;for(var s=0;s<r;s++){var c=s*n;Nt.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 cu(this)}})(fs);var eT=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}eT(e,t),e.forName=function(n){return this.getCharacterSetECIByName(n)}})(Yn);var tT=function(){function t(e){this.previous=e}return t.prototype.getPrevious=function(){return this.previous},t}(),nT=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)}}(),$2=function(t){function e(n,r,o){var i=t.call(this,n)||this;return i.value=r,i.bitCount=o,i}return nT(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,"<"+En.toBinaryString(n|1<<this.bitCount).substring(1)+">"},e}(tT),rT=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}rT(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)+">"}})($2),new $2(null,0,0);var oT=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=oT(t),o=r.next();!o.done;o=r.next()){var i=o.value;or.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})(or.createInt32Array(6,6)),function(t){var e=pn.getCharCode(" "),n=pn.getCharCode("."),r=pn.getCharCode(",");t[0][e]=1;for(var o=pn.getCharCode("Z"),i=pn.getCharCode("A"),a=i;a<=o;a++)t[0][a]=a-i+2;t[1][e]=1;var s=pn.getCharCode("z"),c=pn.getCharCode("a");for(a=c;a<=s;a++)t[1][a]=a-c+2;t[2][e]=1;var u=pn.getCharCode("9"),d=pn.getCharCode("0");for(a=d;a<=u;a++)t[2][a]=a-d+2;t[2][r]=12,t[2][n]=13;for(var h=["\0"," ","","","","","","","\x07","\b"," ",`
|
|
153
|
-
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)t[3][pn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)pn.getCharCode(p[f])>0&&(t[4][pn.getCharCode(p[f])]=f)}(or.createInt32Array(5,256));var iT=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)}}(),aT=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 iT(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 u=void 0;n[a+3]===0?u=255:u=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=u}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ve("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 cu(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 u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(s/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(fs);function Y2(){return typeof navigator<"u"}function sT(){return!!(Y2()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var oa=function(){return oa=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},oa.apply(this,arguments)},$t=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function s(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(a,s)}c((r=r.apply(t,[])).next())})},Yt=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(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){a=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){a.label=d[1];break}if(d[0]===6&&a.label<o[1]){a.label=o[1],o=d;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(d);break}o[2]&&a.ops.pop(),a.trys.pop();continue}d=e.call(t,a)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},_u=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.")},cT={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},ia=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=oa(oa({},cT),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Pt.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 $t(this,void 0,void 0,function(){return Yt(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=_u(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 Ht("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Ht("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 aT(e),r=new d2(n);return new u2(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 Ht("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 $t(this,void 0,void 0,function(){var n;return Yt(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 $t(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,u,d,h,f;return Yt(this,function(p){switch(p.label){case 0:if(!Y2())throw new Error("Can't enumerate devices, navigator is not present.");if(!sT())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=_u(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),u=i.groupId,d={deviceId:s,label:c,kind:a,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return $t(this,void 0,void 0,function(){var n;return Yt(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 $t(this,void 0,void 0,function(){return Yt(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),$t(this,void 0,void 0,function(){var o;return Yt(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 Ht("`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 $t(this,void 0,void 0,function(){var n;return Yt(this,function(r){switch(r.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var n;return Yt(this,function(r){switch(r.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var o,i;return Yt(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 $t(this,void 0,void 0,function(){var o,i,a,s,c,u,d,h,f,p,l=this;return Yt(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=_u(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),u=e.getVideoTracks(),d=oa(oa({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return $t(this,void 0,void 0,function(){var w,b,E,C,I,T;return Yt(this,function(P){switch(P.label){case 0:w=y?u.filter(y):u,P.label=1;case 1:P.trys.push([1,6,7,8]),b=_u(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(),I={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(I)throw I.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return u.find(m).getConstraints()},streamVideoSettingsGet:function(m){return u.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return u.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=u==null?void 0:u.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),f=function(m){return $t(l,void 0,void 0,function(){return Yt(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return $t(this,void 0,void 0,function(){var o;return Yt(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 $t(this,void 0,void 0,function(){var r,o;return Yt(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Ht("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 $t(this,void 0,void 0,function(){var r,o,i;return Yt(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Ht("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 $t(this,void 0,void 0,function(){var r;return Yt(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 $t(this,void 0,void 0,function(){var r,o;return Yt(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 $t(this,void 0,void 0,function(){var r;return Yt(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 $t(this,void 0,void 0,function(){var n,r;return Yt(this,function(o){switch(o.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var n,r;return Yt(this,function(o){switch(o.label){case 0:if(!e)throw new Ht("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,u,d){if(c)return a(c),void d.stop();if(u){if(u instanceof he&&n||u instanceof sn&&r||u instanceof Se&&o)return;d.stop(),s(u)}})})},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},u=!1,d={stop:function(){u=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!u)try{t.drawImageOnCanvas(a,e);var f=o.decodeFromCanvas(i);n(f,void 0,d),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof sn||p instanceof Se||p instanceof he)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},t.prototype._decodeOnLoadImage=function(e){return $t(this,void 0,void 0,function(){return Yt(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}(),uT=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 fu,n,r)||this}uT(e,t)})(ia);var lT=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 na(n),n,r)||this}lT(e,t)})(ia);var dT=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 vu,n,r)||this}dT(e,t)})(ia);var fT=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 q2;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}fT(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Pt.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)}})(ia);var hT=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 Cu,n,r)||this}hT(e,t)})(ia);var pT=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)}}(),gT=function(t){function e(n,r){return t.call(this,new Eu,n,r)||this}return pT(e,t),e}(ia),Au=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},mT=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 gT(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}()&&Au(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),Au(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Au(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Au(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},pi=function(){return pi=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},pi.apply(this,arguments)},W2={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}},Rf=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,u=t.videoId;return mT({constraints:o,scanDelay:a,onResult:c,videoId:u}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:pi(pi({},W2.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:u,style:pi(pi(pi({},W2.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};Rf.displayName="QrReader",Rf.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function yT({onScan:t}){const{cameraFacingMode:e}=Xt(),[n,r]=x.useState(e??vn.USER);return v.jsxs("div",{className:"relative w-full",children:[v.jsx(Rf,{onResult:o=>{o&&t(o.getText())},constraints:{facingMode:n},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),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:()=>n===vn.USER?r(vn.ENVIRONMENT):r(vn.USER),children:v.jsx("img",{src:iu,alt:"camera-switch"})})]})}class Xe{constructor(e,n,r,o,i){this._legacyCanvasSize=Xe.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=Xe.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 Xe.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"),Xe._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"),Xe._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(),Xe._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?Xe._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&&(Xe._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 u,d;[r,u]=await Promise.all([r||Xe.createQrEngine(),Xe._loadImage(e)]),[o,d]=Xe._drawToCanvas(u,s,o,i);let h;if(r instanceof Worker){let f=r;n||Xe._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(f.removeEventListener("message",m),f.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:Xe._convertPoints(E.data.cornerPoints,s)}):l(Xe.NO_QR_CODE_FOUND))},y=E=>{f.removeEventListener("message",m),f.removeEventListener("error",y),clearTimeout(g),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",m),f.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);w=Xe._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw Xe.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:Xe._convertPoints(f.cornerPoints,s)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return Xe._disableBarcodeDetector=!0,Xe.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!s||!a)throw u;let d=await Xe.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||Xe._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){Xe._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){Xe._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(()=>hO).then(r=>r.createWorker()),!(!Xe._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),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var m=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),d.left=`${a+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.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 Xe.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Xe._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Xe.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!==Xe.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 Xe._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 Xe._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 Xe._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=Xe._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}Xe.DEFAULT_CANVAS_SIZE=400,Xe.NO_QR_CODE_FOUND="No QR code found",Xe._disableBarcodeDetector=!1,Xe._workerMessageId=0;function vT({onScan:t}){const{cameraFacingMode:e}=Xt(),[n,r]=x.useState(e),o=x.useRef(),i=x.useRef(null),[a,s]=x.useState(!0),c=d=>{t(d==null?void 0:d.data)},u=d=>{};return x.useEffect(()=>{var d;return i!=null&&i.current&&!o.current&&(o.current=new Xe(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(d=o==null?void 0:o.current)==null||d.start().then(()=>s(!0)).catch(h=>{h&&s(!1)})),()=>{var h;i!=null&&i.current||(h=o==null?void 0:o.current)==null||h.stop()}},[]),x.useEffect(()=>{a||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[a]),v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),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 h;const d=n===vn.USER?vn.ENVIRONMENT:vn.USER;r(d),(h=o==null?void 0:o.current)==null||h.setCamera(d)},children:v.jsx("img",{src:iu,alt:"camera-switch"})})]})}function wT({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=Xt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),u=f=>{t(f==null?void 0:f.data)},d=f=>{};x.useEffect(()=>()=>{var f;a!=null&&a.current||(f=i==null?void 0:i.current)==null||f.stop()});const h=()=>{var f;a!=null&&a.current&&!i.current&&(i.current=new Xe(a==null?void 0:a.current,u,{onDecodeError:d,preferredCamera:r}),(f=i==null?void 0:i.current)==null||f.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 f=r===vn.USER?vn.ENVIRONMENT:vn.USER;o(f),(p=i==null?void 0:i.current)==null||p.setCamera(f)},children:v.jsx("img",{src:iu,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(nt,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function aa({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=Rb()??[0,0],{subscribe:s,unsubscribe:c}=Oa(),{cameraService:u}=Xt(),d=f=>{e(f)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const f=p=>{e(p.detail.code)};return s("onCodeScan",f),()=>{c("onCodeScan",f)}},[a]);const h=()=>{switch(+u){case 1:return v.jsx(c2,{onScan:d});case 2:return v.jsx(vT,{onScan:d});case 3:return v.jsx(yT,{onScan:d});case 4:return v.jsx(wT,{onScan:d});default:return v.jsx(c2,{onScan:d})}};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(Yo,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:f=>{n&&n(!0),e(f.target.value)}})]})}function bT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n,portalSession:r}=je(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,u]=x.useState(!1),d=zt(),h=Dt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);e(t("unknownCode",{code:o}))}).catch(e).finally(()=>u(!1))};return x.useEffect(()=>{o&&!a&&f()},[o]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:f,children:v.jsx(aa,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function ET(){const{hash:t}=Yr();return v.jsx(dr,{to:`${Le.GIFTCARD}/select/${t}`})}function CT(){const{identifierValue:t}=Yr(),{errorToast:e}=Vt(),{uuid:n,mutate:r}=je(),{onContactLink:o}=Xt(),[i,a]=x.useState(!1),s=Dt(),c=d=>s.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{s.put(n,{contact_identifier_value:t}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{u()},[]),i?v.jsx(dr,{to:`${Le.PORTAL}/overview`}):v.jsx(_r,{})}function K2(t){const{portalSession:e}=je(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=cr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function _T(){const{t}=Ue(),{code:e}=Yr(),{voucher:n}=K2(e),{portalSession:r}=je(),[o,i]=x.useState(!1),[a,s]=x.useState(!1),c=zt(),u=()=>{n!=null&&n.contact||r.contact?i(!0):s(!0)};return x.useEffect(()=>{n&&u()},[n]),n?v.jsxs(v.Fragment,{children:[o?v.jsx(dr,{to:`${Le.VOUCHER}/${n.code}/redeem`}):v.jsx(_r,{}),v.jsx(Eo,{title:t("noContactLinkedToVoucherTitle"),isOpen:a,onClose:()=>s(!1),primaryAction:{label:t("linkToContact"),action:()=>c(`${Le.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>s(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:n.code})})})]}):v.jsx(_r,{})}function Su({redirectRoute:t}){const{state:e}=er(),{t:n}=Ue(),{errorToast:r}=Vt(),{onContactLink:o}=Xt(),{portalSession:i,mutate:a}=je(),{publish:s}=Oa(),[c,u]=x.useState(""),[d,h]=x.useState(!1),[f,p]=x.useState(!1),l=zt(),g=Dt(),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(()=>l(t))}).catch(b=>{b.response.data.code===Ws.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(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>c&&!d&&y(),children:v.jsx(Yo,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>u(b.target.value),beforeIcon:"mail"})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:d}),v.jsx(nt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>l("../identifier",{state:e})})]})})]})}),v.jsx(Eo,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:d},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function AT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/*",element:v.jsx(bT,{})}),v.jsx(Ye,{path:"/giftcard/:hash",element:v.jsx(ET,{})}),v.jsx(Ye,{path:"/identifier/:identifierValue",element:v.jsx(CT,{})}),v.jsx(Ye,{path:"/voucher/:code",element:v.jsx(_T,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PORTAL})})]})}const ST={[Kt.GIFTCARD]:`${Le.GIFTCARD}/select`,[Kt.REDEEM_GIFTCARD]:`${Le.GIFTCARD}/redeem`,[Kt.TOP_UP_GIFTCARD]:`${Le.GIFTCARD}/top-up`};function IT(){const{t}=Ue(),{portalSession:e}=je(),{errorToast:n}=Vt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),u=Dt(),d=zt(),h=()=>{a(!0),u.get(`${e.uuid}/giftcards/${r}`).then(f=>{const p=e.type;d(`${ST[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(kt,{children:v.jsx(aa,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(rn,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function TT(){const{t}=Ue(),{hash:e}=Yr(),n=zt();return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:t("redeem"),onClick:()=>n(`${Le.GIFTCARD}/redeem/${e}`)}),v.jsx(nt,{className:"grow",label:t("topUp"),onClick:()=>n(`${Le.GIFTCARD}/top-up/${e}`)})]})})]})})}function z2(t){const{portalSession:e}=je(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=cr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function ws(){const{mutate:t}=je();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{r3(r.data.data.events)})}}}function xT(){const{t}=Ue(),{errorToast:e}=Vt(),{hash:n}=Yr(),{giftcard:r,mutate:o}=z2(n),{portalSession:i,mutate:a}=je(),{onUseGiftcard:s}=Xt(),{post:c}=ws(),[u]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=x.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=zt(),l=Dt(),g=()=>{h(!0),l.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(I=>I.type===yo.GIFTCARD_TRANSACTION).forEach(I=>{I.data.giftcard.uuid===r.uuid&&(E+=I.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Si(m(),i.currency)}),onClick:g};if(f&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(Le.GIFTCARD),variant:"secondary"}};return r?v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(kt,{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(bo,{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(bo,{value:u+w(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(rn,{children:v.jsx(nt,{label:"",className:"w-full",...b(),pending:d})})]})}):v.jsx(_r,{})}function OT({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{u(t?t.toString():"")},[]);const s=d=>{e(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);f=p.length?parseInt(p,10):0}e(f),u(f?f.toString():"")},u=d=>{a&&a.current&&(d?a.current.style.width=`${Math.max(d.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(fp,{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 X2({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),[a,s]=x.useState(0),{portalSession:c}=je(),u=()=>{let d=0;return c.events.filter(f=>Object.values(yo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return v.jsxs(Mt,{children:[t&&v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(kt,{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(bo,{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:u()?v.jsx(bo,{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:n3(c.currency)}),v.jsx(OT,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Si(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!u(),pending:o})})]})}function PT(){const{t}=Ue(),{errorToast:e}=Vt(),{hash:n}=Yr(),{giftcard:r,mutate:o}=z2(n),{portalSession:i,mutate:a}=je(),{post:s}=ws(),{onUseGiftcard:c}=Xt(),[u,d]=x.useState(!1),h=Dt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),a(),s(),c==null||c(l.data.data),Ct.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Si(l.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>d(!1))};return r?v.jsx(Tn,{children:v.jsx(X2,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):v.jsx(_r,{})}function kT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(IT,{})}),v.jsx(Ye,{path:"/select/:hash",element:v.jsx(TT,{})}),v.jsx(Ye,{path:"/redeem/:hash",element:v.jsx(xT,{})}),v.jsx(Ye,{path:"/top-up/:hash",element:v.jsx(PT,{})})]})}class Df{constructor(){Qn(this,"uuid");Qn(this,"email");Qn(this,"credit_balance");Qn(this,"prepaid_balance");Qn(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 Q2=x.createContext({contact:new Df,mutate:async()=>{}});function Mf({children:t}){const{uuid:e}=je(),[n,r]=x.useState(new Df),{mutate:o}=cr({url:`${e}/contacts`,onData:a=>{const s=new Df;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(Q2.Provider,{value:i,children:t}):v.jsx(_r,{})}function ar(){const t=x.useContext(Q2);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function Iu({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(Sl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function BT(){const{t}=Ue(),{errorToast:e}=Vt(),{contact:n,mutate:r}=ar(),{uuid:o,portalSession:i,mutate:a}=je(),s=Dt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},u=()=>{const d=i.events.filter(h=>h.type===yo.CREDIT_RECEPTION);return d.length?d[0]:null};return x.useEffect(()=>{u()||c()},[]),v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(kt,{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:u()?v.jsxs(v.Fragment,{children:["+",v.jsx(bo,{value:u().data.credits,start:0})]}):v.jsx(Iu,{})}):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(bo,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function NT(){const{portalSession:t}=je();return t.contact?v.jsx(Mf,{children:v.jsx(BT,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ci.EMAIL?v.jsx(dr,{to:`${Le.POINTS_TRANSACTION}/email`}):v.jsx(dr,{to:`${Le.POINTS_TRANSACTION}/identifier`})}function Lf({redirectRoute:t}){const{t:e}=Ue(),{state:n}=er(),{portalSession:r,mutate:o}=je(),{onContactLink:i}=Xt(),[a,s]=x.useState(""),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt();x.useEffect(()=>{!d&&a&&l()},[a]);const l=()=>{u(!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(()=>f(t,{state:{contactIdentifier:a}}))}).catch(()=>f("link",{state:{contactIdentifier:a}})).finally(()=>u(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>a&&l(),children:v.jsx(aa,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:e("continue"),onClick:l,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:e("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Ff({redirectRoute:t}){const{t:e}=Ue(),{errorToast:n}=Vt(),{uuid:r,mutate:o}=je(),{onContactLink:i}=Xt(),{state:a}=er(),{publish:s}=Oa(),[c,u]=x.useState(""),[d,h]=x.useState(!1),[f,p]=x.useState(!1),l=zt(),g=Dt();if(!a||!a.contactIdentifier)return v.jsx(dr,{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===Ws.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(()=>l(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(Tn,{children:[v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(Ob,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(si,{onSubmit:m,children:v.jsx(Yo,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:e("continue"),className:"w-full",onClick:m,disabled:!c||d})})]}),v.jsx(Eo,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:e("confirm"),action:y,loading:d},secondaryAction:{label:e("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:c})})})]})}function RT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(NT,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.POINTS_TRANSACTION})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.POINTS_TRANSACTION})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.POINTS_TRANSACTION})})]})}function DT(){const{portalSession:t}=je(),{primaryIdentificationMethod:e}=Xt();return t.contact?v.jsx(dr,{to:`${Le.PORTAL}/overview`}):e&&e===Ci.EMAIL?v.jsx(dr,{to:`${Le.PORTAL}/email`}):v.jsx(dr,{to:`${Le.PORTAL}/identifier`})}function MT({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 LT({contact:t}){const{t:e}=Ue(),n=zt();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(Ml,{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(Ll,{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(nn.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(nt,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(nt,{before:v.jsx(wn,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function bs({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function FT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(bs,{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(bs,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Si(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function jT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je(),r=(o,i)=>R1(o,i)?`${R1(o,i)} ${t("yearsAgo")}`:N1(o,i)?`${N1(o,i)} ${t("weeksAgo")}`:B1(o,i)?`${B1(o,i)} ${t("daysAgo")}`:t("today");return v.jsx(bs,{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(wn,{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(wn,{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(wn,{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 J2(){const{uuid:t}=je(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=cr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Z2({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===v1.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 VT(){const{t}=Ue(),e=zt(),{loyaltyTransactions:n}=J2();return n?v.jsx(bs,{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(Z2,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(nt,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx(Iu,{})}function ey(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function ty({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===w1.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(Ll,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function UT(){const{t}=Ue(),{subscriptions:e}=ey(),n=zt();return e?v.jsx(bs,{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(ty,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(nt,{label:t("change"),before:v.jsx(wn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx(Iu,{})}function GT(){const{contact:t}=ar();return v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(LT,{contact:t})}),v.jsx(kt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(FT,{}),v.jsx(jT,{}),v.jsx(VT,{}),v.jsx(UT,{})]})})]})}function Es({label:t,path:e}){const n=zt();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(nt,{label:t,variant:"link-gray",before:v.jsx(wn,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function qT(){const{t}=Ue(),{loyaltyTransactions:e}=J2(),{contact:n}=ar();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Z2,{loyaltyTransaction:r},r.uuid))})]})})]})})}function HT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{subscriptions:r,mutate:o}=ey(),[i,a]=x.useState({}),[s,c]=x.useState(!1),u=Dt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,g)=>({...l,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[]);const d=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},f=()=>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(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(ty,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!f()||s})})]})}):v.jsx(Iu,{})}function $T(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contact:r,mutate:o}=ar(),[i,a]=x.useState(),[s,c]=x.useState(!1),[u,d]=x.useState(),h=Dt();cr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const f=g=>{d({...u,[g.target.name]:g.target.value})},p=(g,m)=>{d({...u,[g]:m})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Ml,{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(qb,{name:g.name,label:g.label,value:u&&u[g.name]?u[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(jl,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(jb,{name:g.name,value:u&&u[g.name]?u[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(pp,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:u&&u[g.name]?u[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:f},g.id):v.jsx(Yo,{disabled:g.disabled,label:g.label,name:g.name,value:u&&u[g.name]!=="undefined"?u[g.name]:r.current_display_values[g.name],onChange:f},g.id)}):v.jsx(Tc,{rows:10})]})}),v.jsx(rn,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:s})})]})})}function ny(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function YT({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(wn,{className:"h-full",icon:"close"})})]})}function WT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contactIdentifiers:r,isLoading:o,mutate:i}=ny(),[a,s]=x.useState(""),[c,u]=x.useState(!1),d=zt(),h=Dt(),f=l=>{s(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>u(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Tc,{rows:10}):r==null?void 0:r.map(l=>v.jsx(YT,{identifier:l,onClear:f},l.value))]})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),v.jsx(Eo,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function KT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contact:r}=ar(),{mutate:o}=ny(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[u,d]=x.useState(!1),h=zt(),f=Dt(),p=()=>{c(!0),f.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(()=>{!u&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>i&&p(),children:v.jsx(aa,{data:i,dataSetter:a,setDefer:d,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function zT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/profile",element:v.jsx(GT,{})}),v.jsx(Ye,{path:"/profile/activity",element:v.jsx(qT,{})}),v.jsx(Ye,{path:"/profile/subscriptions",element:v.jsx(HT,{})}),v.jsx(Ye,{path:"/profile/contact-identifiers",element:v.jsx(WT,{})}),v.jsx(Ye,{path:"/profile/contact-identifiers/create",element:v.jsx(KT,{})}),v.jsx(Ye,{path:"/profile/contact-attributes",element:v.jsx($T,{})})]})}function XT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je();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 ry(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function jf({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=je(),{contact:a}=ar();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(Vb,{value:a.credit_balance.balance,max:t.required_credits})]})}function QT({selected:t,setSelected:e}){const{t:n}=Ue(),{contact:r}=ar(),{rewards:o,isLoading:i}=ry(),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(Tc,{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(jf,{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(jf,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function JT(){const{portalSession:t}=je(),{rewards:e}=ry(),n=()=>t.events.filter(r=>r.type===yo.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(y0,{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 ZT(){const{t}=Ue(),{errorToast:e,successToast:n}=Vt(),{portalSession:r,mutate:o}=je(),{mutate:i}=ar(),{onClaimReward:a}=Xt(),[s,c]=x.useState(),[u,d]=x.useState(!1),[h,f]=x.useState(!1),{post:p}=ws(),l=Dt();x.useEffect(()=>{s&&f(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===yo.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,I)=>new Date(C.created_at)>new Date(I.created_at)?C:I);a==null||a(y,E.data.uuid)})},m=()=>{d(!0),l.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(()=>{f(!1),c(void 0),d(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(XT,{})}),v.jsx(kt,{children:v.jsx(QT,{selected:s,setSelected:c})}),v.jsx(rn,{children:v.jsx(JT,{})})]}),v.jsx(Eo,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:u},secondaryAction:{label:t("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(jf,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function Vf(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function ex(){const{t}=Ue();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function Uf({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===Ea.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===Ea.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===Ea.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function tx({selected:t,setSelected:e}){const{t:n}=Ue(),{vouchers:r,isLoading:o}=Vf();return v.jsx(v.Fragment,{children:o?v.jsx(Tc,{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(Uf,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function nx(){const{t}=Ue(),{portalSession:e}=je(),{vouchers:n}=Vf(),r=()=>e.events.filter(o=>o.type===yo.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(y0,{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 rx(){const{t}=Ue(),{errorToast:e,successToast:n}=Vt(),{uuid:r}=je(),{onRedeemVoucher:o}=Xt(),{post:i}=ws(),{mutate:a}=Vf(),[s,c]=x.useState(),[u,d]=x.useState(!1),[h,f]=x.useState(!1),p=Dt();x.useEffect(()=>{s&&f(!0)},[s]);const l=()=>{d(!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(),d(!1)})},g=()=>{f(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(ex,{})}),v.jsx(kt,{children:v.jsx(tx,{selected:s,setSelected:c})}),v.jsx(rn,{children:v.jsx(nx,{})})]}),v.jsx(Eo,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:l,loading:u},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(Uf,{voucher:s,setSelected:c})]})})]})}function ox(){const{t}=Ue(),[e,n]=x.useState(1),r=zt(),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(Mf,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(vE,{children:o.map(i=>v.jsx(wE,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(MT,{children:[v.jsx(zT,{}),v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/rewards",element:v.jsx(ZT,{})}),v.jsx(Ye,{path:"/vouchers",element:v.jsx(rx,{})})]})]})]})})}function ix(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(DT,{})}),v.jsx(Ye,{path:"/overview/*",element:v.jsx(ox,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PORTAL})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.PORTAL})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.PORTAL})})]})}function oy(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function ax(){const{t}=Ue(),{state:e}=er(),{errorToast:n,successToast:r}=Vt(),{uuid:o,mutate:i}=je(),{contact:a}=ar(),{onCreatePrepaidTransaction:s}=Xt(),{prepaidBalance:c,mutate:u}=oy(),[d,h]=x.useState(!1),f=Dt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{u(),i(),s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(X2,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:d})}):v.jsx(_r,{})}function sx({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),{portalSession:a}=je(),s=a.inputData.amount_in_cents??0,c=()=>{let d=0;return a.events.filter(f=>Object.values(yo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(s+c(),e);return v.jsxs(Mt,{children:[t&&v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(kt,{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(bo,{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(bo,{value:u(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Si(u(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!s||!!c(),pending:o})})]})}function cx(){const{t}=Ue(),{state:e}=er(),{errorToast:n,successToast:r}=Vt(),{uuid:o,mutate:i}=je(),{contact:a}=ar(),{onCreatePrepaidTransaction:s}=Xt(),{prepaidBalance:c,mutate:u}=oy(),[d,h]=x.useState(!1),f=Dt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{u(),i(),s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(sx,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:d})}):v.jsx(_r,{})}function ux({setType:t}){const{t:e}=Ue();return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:e("pay"),onClick:()=>t(Kt.PAY_PREPAID)}),v.jsx(nt,{className:"grow",label:e("topUp"),onClick:()=>t(Kt.TOP_UP_PREPAID)})]})})]})})}function lx(){const{portalSession:t}=je(),{primaryIdentificationMethod:e}=Xt(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ci.EMAIL?v.jsx(dr,{to:`${Le.PREPAID}/email`}):v.jsx(dr,{to:`${Le.PREPAID}/identifier`});const o=()=>n===Kt.TOP_UP_PREPAID?v.jsx(ax,{}):n===Kt.PAY_PREPAID?v.jsx(cx,{}):v.jsx(ux,{setType:r});return v.jsx(Mf,{children:o()})}function dx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(lx,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PREPAID})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.PREPAID})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.PREPAID})})]})}function fx(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n,portalSession:r}=je(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt(),l=()=>{s(!0),p.get(`${n}/vouchers/check/${o}`).then(g=>{g.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(e).finally(()=>s(!1))};return x.useEffect(()=>{!c&&o&&l()},[o]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(aa,{data:o,dataSetter:i,setDefer:u,label:t("code")})}),v.jsx(rn,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:l,pending:a})})]})}),v.jsx(Eo,{title:t("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:t("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>h(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:o})})})]})}function hx(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{uuid:r}=je(),{onRedeemVoucher:o}=Xt(),{post:i}=ws(),{voucher:a,mutate:s}=K2(n),[c,u]=x.useState(!1),d=Dt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),s()}).catch(e).finally(()=>u(!1))};return a?v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(kt,{children:v.jsx("div",{children:v.jsx(Uf,{voucher:a,setSelected:()=>{}})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Ea.ACTIVE||c,pending:c})})]})}):v.jsx(_r,{})}function px(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{portalSession:r,mutate:o}=je(),{onContactLink:i}=Xt(),[a,s]=x.useState(""),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt(),l=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&l(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(`${Le.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>u(!1))};return x.useEffect(()=>{!d&&a&&g()},[a]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:g,children:v.jsx(aa,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function gx(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{onContactLink:r}=Xt(),{portalSession:o,mutate:i}=je(),{publish:a}=Oa(),[s,c]=x.useState(""),[u,d]=x.useState(!1),[h,f]=x.useState(!1),p=zt(),l=Dt(),g=w=>l.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{d(!0),l.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(`${Le.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===Ws.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},y=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>d(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>s&&!u&&m(),children:v.jsx(Yo,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),className:"w-full",onClick:m,pending:u,disabled:!s||u}),v.jsx(nt,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(Eo,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:t("confirm"),action:y,disabled:u},secondaryAction:{label:t("cancel"),action:()=>f(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function mx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(fx,{})}),v.jsx(Ye,{path:":code/redeem",element:v.jsx(hx,{})}),v.jsx(Ye,{path:":code/email",element:v.jsx(gx,{})}),v.jsx(Ye,{path:":code/identifier",element:v.jsx(px,{})})]})}function yx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx($A,{})}),v.jsx(Ye,{path:`${Le.GENERIC}/*`,element:v.jsx(AT,{})}),v.jsx(Ye,{path:`${Le.GIFTCARD}/*`,element:v.jsx(kT,{})}),v.jsx(Ye,{path:`${Le.POINTS_TRANSACTION}/*`,element:v.jsx(RT,{})}),v.jsx(Ye,{path:`${Le.PORTAL}/*`,element:v.jsx(ix,{})}),v.jsx(Ye,{path:`${Le.PREPAID}/*`,element:v.jsx(dx,{})}),v.jsx(Ye,{path:`${Le.VOUCHER}/*`,element:v.jsx(mx,{})})]})}function Gf(t){"@babel/helpers - typeof";return Gf=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},Gf(t)}function iy(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Gf(XMLHttpRequest))==="object"}function vx(t){return!!t&&typeof t.then=="function"}function wx(t){return vx(t)?t:Promise.resolve(t)}function bx(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 qf={exports:{}},Tu={exports:{}},ay;function Ex(){return ay||(ay=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof wi<"u"&&wi,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 u(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&d.indexOf(Object.prototype.toString.call(k))>-1};function f(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 l(k){var U={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,z){this.append(z,U)},this):Array.isArray(k)?k.forEach(function(U){this.append(U[0],U[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=f(k),U=p(U);var z=this.map[k];this.map[k]=z?z+", "+U:U},g.prototype.delete=function(k){delete this.map[f(k)]},g.prototype.get=function(k){return k=f(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(f(k))},g.prototype.set=function(k,U){this.map[f(k)]=p(U)},g.prototype.forEach=function(k,U){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(U,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,z){k.push(z)}),l(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),l(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,z){k.push([z,U])}),l(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(U,z){k.onload=function(){U(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var U=new FileReader,z=y(U);return U.readAsArrayBuffer(k),z}function b(k){var U=new FileReader,z=y(U);return U.readAsText(k),z}function E(k){for(var U=new Uint8Array(k),z=new Array(U.length),te=0;te<U.length;te++)z[te]=String.fromCharCode(U[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function I(){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&&u(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 U=k.toUpperCase();return T.indexOf(U)>-1?U:k}function N(k,U){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var z=U.body;if(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.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=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=P(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.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")&&(U.cache==="no-store"||U.cache==="no-cache")){var te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var oe=/\?/;this.url+=(oe.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var U=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),oe=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");U.append(decodeURIComponent(oe),decodeURIComponent(ne))}}),U}function V(k){var U=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
153
|
+
`,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""],f=0;f<h.length;f++)t[3][pn.getCharCode(h[f])]=f;var p=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(f=0;f<p.length;f++)pn.getCharCode(p[f])>0&&(t[4][pn.getCharCode(p[f])]=f)}(or.createInt32Array(5,256));var iT=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)}}(),aT=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 iT(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 u=void 0;n[a+3]===0?u=255:u=306*n[a]+601*n[a+1]+117*n[a+2]+512>>10,i[s]=u}return i},e.prototype.getRow=function(n,r){if(n<0||n>=this.getHeight())throw new Ve("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 cu(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 u=r.getContext("2d");if(!u)throw new Error("Could not create a Convas Context element.");return u.translate(s/2,c/2),u.rotate(o),u.drawImage(this.canvas,i/-2,a/-2),this.buffer=e.makeBufferFromCanvasImageData(r),this},e.DEGREE_TO_RADIANS=Math.PI/180,e}(fs);function Y2(){return typeof navigator<"u"}function sT(){return!!(Y2()&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices)}var oa=function(){return oa=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},oa.apply(this,arguments)},$t=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(u){try{c(r.next(u))}catch(d){i(d)}}function s(u){try{c(r.throw(u))}catch(d){i(d)}}function c(u){var d;u.done?o(u.value):(d=u.value,d instanceof n?d:new n(function(h){h(d)})).then(a,s)}c((r=r.apply(t,[])).next())})},Yt=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(u){return function(d){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&d[0]?r.return:d[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,d[1])).done)return o;switch(r=0,o&&(d=[2&d[0],o.value]),d[0]){case 0:case 1:o=d;break;case 4:return a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!((o=o.length>0&&o[o.length-1])||d[0]!==6&&d[0]!==2)){a=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){a.label=d[1];break}if(d[0]===6&&a.label<o[1]){a.label=o[1],o=d;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(d);break}o[2]&&a.ops.pop(),a.trys.pop();continue}d=e.call(t,a)}catch(h){d=[6,h],r=0}finally{n=o=0}if(5&d[0])throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}([c,u])}}},_u=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.")},cT={delayBetweenScanAttempts:500,delayBetweenScanSuccess:500,tryPlayVideoTimeout:5e3},ia=function(){function t(e,n,r){n===void 0&&(n=new Map),r===void 0&&(r={}),this.reader=e,this.hints=n,this.options=oa(oa({},cT),r)}return Object.defineProperty(t.prototype,"possibleFormats",{set:function(e){this.hints.set(Pt.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 $t(this,void 0,void 0,function(){return Yt(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=_u(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 Ht("element with id '"+e+"' not found");if(r.nodeName.toLowerCase()!==n.toLowerCase())throw new Ht("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 aT(e),r=new d2(n);return new u2(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 Ht("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 $t(this,void 0,void 0,function(){var n;return Yt(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 $t(this,void 0,void 0,function(){var e,n,r,o,i,a,s,c,u,d,h,f;return Yt(this,function(p){switch(p.label){case 0:if(!Y2())throw new Error("Can't enumerate devices, navigator is not present.");if(!sT())throw new Error("Can't enumerate devices, method not supported.");return[4,navigator.mediaDevices.enumerateDevices()];case 1:e=p.sent(),n=[];try{for(r=_u(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),u=i.groupId,d={deviceId:s,label:c,kind:a,groupId:u},n.push(d))}catch(l){h={error:l}}finally{try{o&&!o.done&&(f=r.return)&&f.call(r)}finally{if(h)throw h.error}}return[2,n]}})})},t.findDeviceById=function(e){return $t(this,void 0,void 0,function(){var n;return Yt(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 $t(this,void 0,void 0,function(){return Yt(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),$t(this,void 0,void 0,function(){var o;return Yt(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 Ht("`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 $t(this,void 0,void 0,function(){var n;return Yt(this,function(r){switch(r.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var n;return Yt(this,function(r){switch(r.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var o,i;return Yt(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 $t(this,void 0,void 0,function(){var o,i,a,s,c,u,d,h,f,p,l=this;return Yt(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=_u(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),u=e.getVideoTracks(),d=oa(oa({},c),{stop:function(){c.stop()},streamVideoConstraintsApply:function(m,y){return $t(this,void 0,void 0,function(){var w,b,E,C,I,T;return Yt(this,function(P){switch(P.label){case 0:w=y?u.filter(y):u,P.label=1;case 1:P.trys.push([1,6,7,8]),b=_u(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(),I={error:C},[3,8];case 7:try{E&&!E.done&&(T=b.return)&&T.call(b)}finally{if(I)throw I.error}return[7];case 8:return[2]}})})},streamVideoConstraintsGet:function(m){return u.find(m).getConstraints()},streamVideoSettingsGet:function(m){return u.find(m).getSettings()},streamVideoCapabilitiesGet:function(m){return u.find(m).getCapabilities()}}),t.mediaStreamIsTorchCompatible(e)&&(h=u==null?void 0:u.find(function(m){return t.mediaStreamIsTorchCompatibleTrack(m)}),f=function(m){return $t(l,void 0,void 0,function(){return Yt(this,function(y){switch(y.label){case 0:return[4,t.mediaStreamSetTorch(h,m)];case 1:return y.sent(),[2]}})})},d.switchTorch=f,p=function(){c.stop(),f(!1)},d.stop=p),[2,d]}})})},t.prototype.decodeFromVideoDevice=function(e,n,r){return $t(this,void 0,void 0,function(){var o;return Yt(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 $t(this,void 0,void 0,function(){var r,o;return Yt(this,function(i){switch(i.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Ht("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 $t(this,void 0,void 0,function(){var r,o,i;return Yt(this,function(a){switch(a.label){case 0:if(t.checkCallbackFnOrThrow(n),!e)throw new Ht("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 $t(this,void 0,void 0,function(){var r;return Yt(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 $t(this,void 0,void 0,function(){var r,o;return Yt(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 $t(this,void 0,void 0,function(){var r;return Yt(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 $t(this,void 0,void 0,function(){var n,r;return Yt(this,function(o){switch(o.label){case 0:if(!e)throw new Ht("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 $t(this,void 0,void 0,function(){var n,r;return Yt(this,function(o){switch(o.label){case 0:if(!e)throw new Ht("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,u,d){if(c)return a(c),void d.stop();if(u){if(u instanceof he&&n||u instanceof sn&&r||u instanceof Se&&o)return;d.stop(),s(u)}})})},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},u=!1,d={stop:function(){u=!0,clearTimeout(s),c(),r&&r()}},h=function(){if(!u)try{t.drawImageOnCanvas(a,e);var f=o.decodeFromCanvas(i);n(f,void 0,d),s=setTimeout(h,o.options.delayBetweenScanSuccess)}catch(p){if(n(void 0,p,d),p instanceof sn||p instanceof Se||p instanceof he)return void(s=setTimeout(h,o.options.delayBetweenScanAttempts));c(),r&&r(p)}};return h(),d},t.prototype._decodeOnLoadImage=function(e){return $t(this,void 0,void 0,function(){return Yt(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}(),uT=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 fu,n,r)||this}uT(e,t)})(ia);var lT=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 na(n),n,r)||this}lT(e,t)})(ia);var dT=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 vu,n,r)||this}dT(e,t)})(ia);var fT=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 q2;return i.setHints(n),(o=t.call(this,i,n,r)||this).reader=i,o}fT(e,t),Object.defineProperty(e.prototype,"possibleFormats",{set:function(n){this.hints.set(Pt.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)}})(ia);var hT=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 Cu,n,r)||this}hT(e,t)})(ia);var pT=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)}}(),gT=function(t){function e(n,r){return t.call(this,new Eu,n,r)||this}return pT(e,t),e}(ia),Au=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},mT=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 gT(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}()&&Au(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),Au(n,"constraints","object")&&a.decodeFromConstraints({video:n},o,function(s,c){Au(r,"onResult","function")&&r(s,c,a)}).then(function(s){return i.current=s}).catch(function(s){Au(r,"onResult","function")&&r(null,s,a)}),function(){var s;(s=i.current)===null||s===void 0||s.stop()}},[])},pi=function(){return pi=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},pi.apply(this,arguments)},W2={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}},Rf=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,u=t.videoId;return mT({constraints:o,scanDelay:a,onResult:c,videoId:u}),ce.createElement("section",{className:s,style:n},ce.createElement("div",{style:pi(pi({},W2.container),e)},!!i&&ce.createElement(i,null),ce.createElement("video",{muted:!0,id:u,style:pi(pi(pi({},W2.video),r),{transform:(o==null?void 0:o.facingMode)==="user"&&"scaleX(-1)"})})))};Rf.displayName="QrReader",Rf.defaultProps={constraints:{facingMode:"user"},videoId:"video",scanDelay:500};function yT({onScan:t}){const{cameraFacingMode:e}=Xt(),[n,r]=x.useState(e??vn.USER);return v.jsxs("div",{className:"relative w-full",children:[v.jsx(Rf,{onResult:o=>{o&&t(o.getText())},constraints:{facingMode:n},videoStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem",objectFit:"cover"},videoContainerStyle:{maxHeight:"calc(100vh-381px)",minHeight:267,borderRadius:"0.25rem"}}),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:()=>n===vn.USER?r(vn.ENVIRONMENT):r(vn.USER),children:v.jsx("img",{src:iu,alt:"camera-switch"})})]})}class Xe{constructor(e,n,r,o,i){this._legacyCanvasSize=Xe.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=Xe.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 Xe.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"),Xe._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"),Xe._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(),Xe._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?Xe._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&&(Xe._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 u,d;[r,u]=await Promise.all([r||Xe.createQrEngine(),Xe._loadImage(e)]),[o,d]=Xe._drawToCanvas(u,s,o,i);let h;if(r instanceof Worker){let f=r;n||Xe._postWorkerMessageSync(f,"inversionMode","both"),h=await new Promise((p,l)=>{let g,m,y,w=-1;m=E=>{E.data.id===w&&(f.removeEventListener("message",m),f.removeEventListener("error",y),clearTimeout(g),E.data.data!==null?p({data:E.data.data,cornerPoints:Xe._convertPoints(E.data.cornerPoints,s)}):l(Xe.NO_QR_CODE_FOUND))},y=E=>{f.removeEventListener("message",m),f.removeEventListener("error",y),clearTimeout(g),l("Scanner error: "+(E?E.message||E:"Unknown Error"))},f.addEventListener("message",m),f.addEventListener("error",y),g=setTimeout(()=>y("timeout"),1e4);let b=d.getImageData(0,0,o.width,o.height);w=Xe._postWorkerMessageSync(f,"decode",b,[b.data.buffer])})}else h=await Promise.race([new Promise((f,p)=>window.setTimeout(()=>p("Scanner error: timeout"),1e4)),(async()=>{try{var[f]=await r.detect(o);if(!f)throw Xe.NO_QR_CODE_FOUND;return{data:f.rawValue,cornerPoints:Xe._convertPoints(f.cornerPoints,s)}}catch(p){if(f=p.message||p,/not implemented|service unavailable/.test(f))return Xe._disableBarcodeDetector=!0,Xe.scanImage(e,{scanRegion:s,canvas:o,disallowCanvasResizing:i,alsoTryWithoutScanRegion:a});throw`Scanner error: ${f}`}})()]);return c?h:h.data}catch(u){if(!s||!a)throw u;let d=await Xe.scanImage(e,{qrEngine:r,canvas:o,disallowCanvasResizing:i});return c?d:d.data}finally{n||Xe._postWorkerMessage(r,"close")}}setGrayscaleWeights(e,n,r,o=!0){Xe._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:e,green:n,blue:r,useIntegerApproximation:o})}setInversionMode(e){Xe._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(()=>hO).then(r=>r.createWorker()),!(!Xe._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),u=c.objectFit,d=n/r,h=o/i;switch(u){case"none":var f=n,p=r;break;case"fill":f=o,p=i;break;default:(u==="cover"?d>h:d<h)?(p=i,f=p*d):(f=o,p=f/d),u==="scale-down"&&(f=Math.min(f,n),p=Math.min(p,r))}var[l,g]=c.objectPosition.split(" ").map((y,w)=>{const b=parseFloat(y);return y.endsWith("%")?(w?i-p:o-f)*b/100:b});c=this._scanRegion.width||n,h=this._scanRegion.height||r,u=this._scanRegion.x||0;var m=this._scanRegion.y||0;d=this.$overlay.style,d.width=`${c/n*f}px`,d.height=`${h/r*p}px`,d.top=`${s+g+m/r*p}px`,r=/scaleX\(-1\)/.test(e.style.transform),d.left=`${a+(r?o-l-f:l)+(r?n-u-c:u)/n*f}px`,d.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 Xe.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas})}catch(o){if(!this._active)return;this._onDecodeError(o)}!Xe._disableBarcodeDetector||await this._qrEnginePromise instanceof Worker||(this._qrEnginePromise=Xe.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!==Xe.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 Xe._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 Xe._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 Xe._postWorkerMessageSync(await e,n,r,o)}static _postWorkerMessageSync(e,n,r,o){if(!(e instanceof Worker))return-1;let i=Xe._workerMessageId++;return e.postMessage({id:i,type:n,data:r},o),i}}Xe.DEFAULT_CANVAS_SIZE=400,Xe.NO_QR_CODE_FOUND="No QR code found",Xe._disableBarcodeDetector=!1,Xe._workerMessageId=0;function vT({onScan:t}){const{cameraFacingMode:e}=Xt(),[n,r]=x.useState(e),o=x.useRef(),i=x.useRef(null),[a,s]=x.useState(!0),c=d=>{t(d==null?void 0:d.data)},u=d=>{};return x.useEffect(()=>{var d;return i!=null&&i.current&&!o.current&&(o.current=new Xe(i==null?void 0:i.current,c,{onDecodeError:u,preferredCamera:n}),(d=o==null?void 0:o.current)==null||d.start().then(()=>s(!0)).catch(h=>{h&&s(!1)})),()=>{var h;i!=null&&i.current||(h=o==null?void 0:o.current)==null||h.stop()}},[]),x.useEffect(()=>{a||alert("Camera is blocked or not accessible. Please allow camera in your browser permissions and reload.")},[a]),v.jsxs("div",{className:"relative",children:[v.jsx("video",{className:"max-h-[calc(100vh-381px)] min-h-[370px] rounded object-cover",ref:i}),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 h;const d=n===vn.USER?vn.ENVIRONMENT:vn.USER;r(d),(h=o==null?void 0:o.current)==null||h.setCamera(d)},children:v.jsx("img",{src:iu,alt:"camera-switch"})})]})}function wT({onScan:t}){const{t:e}=Ue(),{cameraFacingMode:n}=Xt(),[r,o]=x.useState(n),i=x.useRef(),a=x.useRef(null),[s,c]=x.useState(!1),u=f=>{t(f==null?void 0:f.data)},d=f=>{};x.useEffect(()=>()=>{var f;a!=null&&a.current||(f=i==null?void 0:i.current)==null||f.stop()});const h=()=>{var f;a!=null&&a.current&&!i.current&&(i.current=new Xe(a==null?void 0:a.current,u,{onDecodeError:d,preferredCamera:r}),(f=i==null?void 0:i.current)==null||f.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 f=r===vn.USER?vn.ENVIRONMENT:vn.USER;o(f),(p=i==null?void 0:i.current)==null||p.setCamera(f)},children:v.jsx("img",{src:iu,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(nt,{label:e("enableCamera"),disabled:s,onClick:h})})]})}function aa({data:t,dataSetter:e,setDefer:n,label:r=""}){const o=x.useRef(null),[i,a]=Rb()??[0,0],{subscribe:s,unsubscribe:c}=Oa(),{cameraService:u}=Xt(),d=f=>{e(f)};x.useEffect(()=>{a&&a<=332&&o.current&&o.current.scrollIntoView({behavior:"smooth",block:"end"});const f=p=>{e(p.detail.code)};return s("onCodeScan",f),()=>{c("onCodeScan",f)}},[a]);const h=()=>{switch(+u){case 1:return v.jsx(c2,{onScan:d});case 2:return v.jsx(vT,{onScan:d});case 3:return v.jsx(yT,{onScan:d});case 4:return v.jsx(wT,{onScan:d});default:return v.jsx(c2,{onScan:d})}};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(Yo,{label:r,value:t,autoFocus:!0,placeholder:"CDE2341S",onChange:f=>{n&&n(!0),e(f.target.value)}})]})}function bT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n,portalSession:r}=je(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,u]=x.useState(!1),d=zt(),h=Dt(),f=()=>{u(!0),h.get(`${n}/check-code/${o}`).then(p=>{if(p.data.identifier)return d(`identifier/${p.data.identifier.value}`);if(p.data.voucher)return d(`voucher/${p.data.voucher.code}`);if(p.data.giftcard)return d(`giftcard/${p.data.giftcard.hash}`);e(t("unknownCode",{code:o}))}).catch(e).finally(()=>u(!1))};return x.useEffect(()=>{o&&!a&&f()},[o]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"code"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:f,children:v.jsx(aa,{data:o,dataSetter:i,setDefer:s,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:f,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>d("email")})]})})]})})}function ET(){const{hash:t}=Yr();return v.jsx(dr,{to:`${Le.GIFTCARD}/select/${t}`})}function CT(){const{identifierValue:t}=Yr(),{errorToast:e}=Vt(),{uuid:n,mutate:r}=je(),{onContactLink:o}=Xt(),[i,a]=x.useState(!1),s=Dt(),c=d=>s.get(`${n}/contacts`,{contact_uuid:d}),u=()=>{s.put(n,{contact_identifier_value:t}).then(d=>{o&&c(d.data.data.contact.uuid).then(h=>{o==null||o(h.data.data)}),r().then(()=>a(!0))}).catch(e)};return x.useEffect(()=>{u()},[]),i?v.jsx(dr,{to:`${Le.PORTAL}/overview`}):v.jsx(_r,{})}function K2(t){const{portalSession:e}=je(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=cr({url:`${e.uuid}/vouchers/${t}`,onData:r});return{voucher:n,isLoading:o,pending:i,mutate:a}}function _T(){const{t}=Ue(),{code:e}=Yr(),{voucher:n}=K2(e),{portalSession:r}=je(),[o,i]=x.useState(!1),[a,s]=x.useState(!1),c=zt(),u=()=>{n!=null&&n.contact||r.contact?i(!0):s(!0)};return x.useEffect(()=>{n&&u()},[n]),n?v.jsxs(v.Fragment,{children:[o?v.jsx(dr,{to:`${Le.VOUCHER}/${n.code}/redeem`}):v.jsx(_r,{}),v.jsx(Eo,{title:t("noContactLinkedToVoucherTitle"),isOpen:a,onClose:()=>s(!1),primaryAction:{label:t("linkToContact"),action:()=>c(`${Le.VOUCHER}/${n.code}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>s(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:n.code})})})]}):v.jsx(_r,{})}function Su({redirectRoute:t}){const{state:e}=er(),{t:n}=Ue(),{errorToast:r}=Vt(),{onContactLink:o}=Xt(),{portalSession:i,mutate:a}=je(),{publish:s}=Oa(),[c,u]=x.useState(""),[d,h]=x.useState(!1),[f,p]=x.useState(!1),l=zt(),g=Dt(),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(()=>l(t))}).catch(b=>{b.response.data.code===Ws.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(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n("fillInXBelow",{x:n("emailAddress").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>c&&!d&&y(),children:v.jsx(Yo,{id:"via-email-address-input",label:n("emailAddress"),autoFocus:!0,onChange:b=>u(b.target.value),beforeIcon:"mail"})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:n("continue"),className:"w-full",onClick:y,disabled:!c,pending:d}),v.jsx(nt,{label:n("useIdentifier"),variant:"secondary",onClick:()=>l("../identifier",{state:e})})]})})]})}),v.jsx(Eo,{title:`${n("new")} ${n("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:n("confirm"),action:w,disabled:d},secondaryAction:{label:n("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:n("continueWithEmail",{email:c})})})]})}function AT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/*",element:v.jsx(bT,{})}),v.jsx(Ye,{path:"/giftcard/:hash",element:v.jsx(ET,{})}),v.jsx(Ye,{path:"/identifier/:identifierValue",element:v.jsx(CT,{})}),v.jsx(Ye,{path:"/voucher/:code",element:v.jsx(_T,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PORTAL})})]})}const ST={[Kt.GIFTCARD]:`${Le.GIFTCARD}/select`,[Kt.REDEEM_GIFTCARD]:`${Le.GIFTCARD}/redeem`,[Kt.TOP_UP_GIFTCARD]:`${Le.GIFTCARD}/top-up`};function IT(){const{t}=Ue(),{portalSession:e}=je(),{errorToast:n}=Vt(),[r,o]=x.useState(""),[i,a]=x.useState(!1),[s,c]=x.useState(!1),u=Dt(),d=zt(),h=()=>{a(!0),u.get(`${e.uuid}/giftcards/${r}`).then(f=>{const p=e.type;d(`${ST[p]}/${f.data.data.hash}`)}).catch(f=>{n(f),o("")}).finally(()=>a(!1))};return x.useEffect(()=>{!s&&r&&h()},[r]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanGiftcard")})})}),v.jsx(kt,{children:v.jsx(aa,{data:r,dataSetter:o,setDefer:c,label:t("hash")})}),v.jsx(rn,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:h,disabled:!r,pending:i})})]})})}function TT(){const{t}=Ue(),{hash:e}=Yr(),n=zt();return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("chooseType")})})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:t("redeem"),onClick:()=>n(`${Le.GIFTCARD}/redeem/${e}`)}),v.jsx(nt,{className:"grow",label:t("topUp"),onClick:()=>n(`${Le.GIFTCARD}/top-up/${e}`)})]})})]})})}function z2(t){const{portalSession:e}=je(),[n,r]=x.useState(),{isLoading:o,pending:i,mutate:a}=cr({url:`${e.uuid}/giftcards/${t}`,onData:r});return{giftcard:n,isLoading:o,pending:i,mutate:a}}function ws(){const{mutate:t}=je();return{get:()=>t().then(r=>r.data.data.events),post:()=>{t().then(r=>{r3(r.data.data.events)})}}}function xT(){const{t}=Ue(),{errorToast:e}=Vt(),{hash:n}=Yr(),{giftcard:r,mutate:o}=z2(n),{portalSession:i,mutate:a}=je(),{onUseGiftcard:s}=Xt(),{post:c}=ws(),[u]=x.useState(i.results.remaining_amount?+i.results.remaining_amount:+i.inputData.amount_in_cents),[d,h]=x.useState(!1),f=i.inputData.allow_multiple_giftcards??!0,p=zt(),l=Dt(),g=()=>{h(!0),l.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(I=>I.type===yo.GIFTCARD_TRANSACTION).forEach(I=>{I.data.giftcard.uuid===r.uuid&&(E+=I.data.amount_in_cents)}),E},b=()=>{if(m())return{label:t("confirmAndPay",{amount:Si(m(),i.currency)}),onClick:g};if(f&&y())return{label:t("useAnotherGiftcard"),onClick:()=>p(Le.GIFTCARD),variant:"secondary"}};return r?v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:`${t("giftcard")} ${r.hash}`})})}),v.jsx(kt,{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(bo,{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(bo,{value:u+w(),start:u,currency:i.currency,asCurrency:!0})})]})})]})}),b()&&v.jsx(rn,{children:v.jsx(nt,{label:"",className:"w-full",...b(),pending:d})})]})}):v.jsx(_r,{})}function OT({value:t,valueSetter:e,enabled:n}){const[r,o]=x.useState(!1),i=x.useRef(null),a=x.useRef(null);x.useEffect(()=>{u(t?t.toString():"")},[]);const s=d=>{e(d?parseInt(d):0),u(d)},c=d=>{const{key:h}=d;if(t===0&&!/^[1-9]$/.test(h)||t!==0&&!/^[0-9]$/.test(h)&&h!=="Backspace")return;let f;if(h!=="Backspace")f=parseInt(t===0?h:`${t}${h}`);else{const p=t.toString().slice(0,-1);f=p.length?parseInt(p,10):0}e(f),u(f?f.toString():"")},u=d=>{a&&a.current&&(d?a.current.style.width=`${Math.max(d.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(fp,{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 X2({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),[a,s]=x.useState(0),{portalSession:c}=je(),u=()=>{let d=0;return c.events.filter(f=>Object.values(yo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d};return v.jsxs(Mt,{children:[t&&v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(kt,{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(bo,{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:u()?v.jsx(bo,{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:n3(c.currency)}),v.jsx(OT,{value:a,valueSetter:s,enabled:c.inputData.enable_on_screen_keyboard})]})})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Si(a,c.currency)}),className:"w-full",onClick:r&&(()=>r(a)),disabled:!a||!!u(),pending:o})})]})}function PT(){const{t}=Ue(),{errorToast:e}=Vt(),{hash:n}=Yr(),{giftcard:r,mutate:o}=z2(n),{portalSession:i,mutate:a}=je(),{post:s}=ws(),{onUseGiftcard:c}=Xt(),[u,d]=x.useState(!1),h=Dt(),f=p=>{d(!0),h.post(`${i.uuid}/giftcards/transaction`,{uuid:r.uuid,amount_in_cents:p}).then(l=>{o(),a(),s(),c==null||c(l.data.data),Ct.success(`${t("transactionSuccessful")}! ${t("totalUpgradedAmount")}: ${Si(l.data.data.amount_in_cents,i.currency)}`)}).catch(e).finally(()=>d(!1))};return r?v.jsx(Tn,{children:v.jsx(X2,{title:`${t("giftcard")} ${r.hash}`,balance:r.amount_in_cents,transaction:f,pending:u})}):v.jsx(_r,{})}function kT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(IT,{})}),v.jsx(Ye,{path:"/select/:hash",element:v.jsx(TT,{})}),v.jsx(Ye,{path:"/redeem/:hash",element:v.jsx(xT,{})}),v.jsx(Ye,{path:"/top-up/:hash",element:v.jsx(PT,{})})]})}class Df{constructor(){Qn(this,"uuid");Qn(this,"email");Qn(this,"credit_balance");Qn(this,"prepaid_balance");Qn(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 Q2=x.createContext({contact:new Df,mutate:async()=>{}});function Mf({children:t}){const{uuid:e}=je(),[n,r]=x.useState(new Df),{mutate:o}=cr({url:`${e}/contacts`,onData:a=>{const s=new Df;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(Q2.Provider,{value:i,children:t}):v.jsx(_r,{})}function ar(){const t=x.useContext(Q2);if(!t)throw new Error("Only use 'useContactContext' within a ContactProvider");return t}function Iu({message:t=""}){return v.jsxs("div",{className:"flex items-center justify-center gap-4 text-core-primary-500",children:[v.jsx(Sl,{className:"h-[32px] w-[32px]"}),t&&v.jsx("p",{className:"text-sm",children:t})]})}function BT(){const{t}=Ue(),{errorToast:e}=Vt(),{contact:n,mutate:r}=ar(),{uuid:o,portalSession:i,mutate:a}=je(),s=Dt(),c=()=>{s.post(`${o}/credit-receptions/create`,{unit_value:i.inputData.amount_in_cents/100}).then(()=>{r(),a()}).catch(e)},u=()=>{const d=i.events.filter(h=>h.type===yo.CREDIT_RECEPTION);return d.length?d[0]:null};return x.useEffect(()=>{u()||c()},[]),v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:n.getDisplayName()})})}),v.jsx(kt,{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:u()?v.jsxs(v.Fragment,{children:["+",v.jsx(bo,{value:u().data.credits,start:0})]}):v.jsx(Iu,{})}):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(bo,{value:n.credit_balance.balance??0,start:n.credit_balance.balance-(u()?u().data.credits:0)})]})})]})})]})})}function NT(){const{portalSession:t}=je();return t.contact?v.jsx(Mf,{children:v.jsx(BT,{})}):t.inputData.primary_identification_method&&t.inputData.primary_identification_method===Ci.EMAIL?v.jsx(dr,{to:`${Le.POINTS_TRANSACTION}/email`}):v.jsx(dr,{to:`${Le.POINTS_TRANSACTION}/identifier`})}function Lf({redirectRoute:t}){const{t:e}=Ue(),{state:n}=er(),{portalSession:r,mutate:o}=je(),{onContactLink:i}=Xt(),[a,s]=x.useState(""),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt();x.useEffect(()=>{!d&&a&&l()},[a]);const l=()=>{u(!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(()=>f(t,{state:{contactIdentifier:a}}))}).catch(()=>f("link",{state:{contactIdentifier:a}})).finally(()=>u(!1))},g=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m});return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("scanOrEnterX",{x:"identifier"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>a&&l(),children:v.jsx(aa,{data:a,dataSetter:s,setDefer:h,label:e("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:e("continue"),onClick:l,disabled:!a,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:e("useEmail"),variant:"secondary",onClick:()=>f("../email",{state:n})})]})})]})})}function Ff({redirectRoute:t}){const{t:e}=Ue(),{errorToast:n}=Vt(),{uuid:r,mutate:o}=je(),{onContactLink:i}=Xt(),{state:a}=er(),{publish:s}=Oa(),[c,u]=x.useState(""),[d,h]=x.useState(!1),[f,p]=x.useState(!1),l=zt(),g=Dt();if(!a||!a.contactIdentifier)return v.jsx(dr,{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===Ws.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(()=>l(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(Tn,{children:[v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:e("linkContact")})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex flex-col gap-3",children:[v.jsx(Ob,{body:e("noEmailAddressLinkedToIdentifier")}),v.jsx(si,{onSubmit:m,children:v.jsx(Yo,{id:"new-contact-identifier-input",label:e("emailAddress"),autoFocus:!0,onChange:E=>u(E.target.value),beforeIcon:"mail"})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:e("continue"),className:"w-full",onClick:m,disabled:!c||d})})]}),v.jsx(Eo,{title:`${e("new")} ${e("emailAddress").toLowerCase()}`,isOpen:f,onClose:()=>p(!1),primaryAction:{label:e("confirm"),action:y,loading:d},secondaryAction:{label:e("cancel"),action:()=>p(!1)},children:v.jsx("p",{children:e("continueWithEmail",{email:c})})})]})}function RT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(NT,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.POINTS_TRANSACTION})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.POINTS_TRANSACTION})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.POINTS_TRANSACTION})})]})}function DT(){const{portalSession:t}=je(),{primaryIdentificationMethod:e}=Xt();return t.contact?v.jsx(dr,{to:`${Le.PORTAL}/overview`}):e&&e===Ci.EMAIL?v.jsx(dr,{to:`${Le.PORTAL}/email`}):v.jsx(dr,{to:`${Le.PORTAL}/identifier`})}function MT({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 LT({contact:t}){const{t:e}=Ue(),n=zt();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(Ml,{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(Ll,{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(nn.language,{month:"long",year:"numeric"})})})]})]}),v.jsxs("div",{className:"inline-grid gap-2 lg:grid-cols-2",children:[v.jsx(nt,{label:e("goToX",{x:"identifiers"}),variant:"secondary",size:"md",onClick:()=>n("contact-identifiers")}),v.jsx(nt,{before:v.jsx(wn,{icon:"edit"}),label:e("editProfile"),variant:"secondary",size:"md",onClick:()=>n("contact-attributes")})]})]})}function bs({children:t}){return v.jsx("div",{className:"flex-grow rounded-lg border p-4",children:t})}function FT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je();return v.jsxs("div",{className:"flex gap-2 lg:flex-col",children:[v.jsx(bs,{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(bs,{children:v.jsxs("div",{className:"flex h-full flex-col items-center justify-center",children:[v.jsx("p",{className:"text-2xl leading-8",children:Si(e.prepaid_balance.balance_in_cents,n.currency)}),v.jsx("p",{className:"text-sm text-core-gray-500",children:t("prepaidCredit")})]})})]})}function jT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je(),r=(o,i)=>R1(o,i)?`${R1(o,i)} ${t("yearsAgo")}`:N1(o,i)?`${N1(o,i)} ${t("weeksAgo")}`:B1(o,i)?`${B1(o,i)} ${t("daysAgo")}`:t("today");return v.jsx(bs,{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(wn,{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(wn,{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(wn,{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 J2(){const{uuid:t}=je(),[e,n]=x.useState([]),{data:r,isLoading:o,pending:i,mutate:a}=cr({url:`${t}/loyalty-transactions`});return x.useEffect(()=>{r&&n(r.data)},[r]),{loyaltyTransactions:e,isLoading:o,pending:i,mutate:a}}function Z2({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===v1.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 VT(){const{t}=Ue(),e=zt(),{loyaltyTransactions:n}=J2();return n?v.jsx(bs,{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(Z2,{loyaltyTransaction:r},r.uuid))}):v.jsx("p",{className:"text-sm text-core-gray-500",children:t("noActivity")})]}),v.jsx(nt,{label:`${t("all")} ${t("activities").toLowerCase()}`,variant:"secondary",onClick:()=>e("activity")})]})}):v.jsx(Iu,{})}function ey(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/subscriptions/contact`,onData:n});return{subscriptions:e,isLoading:r,pending:o,mutate:i}}function ty({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===w1.FUNCTIONAL,onChange:e&&(()=>e(t.subscription_type.name))}):v.jsx(Ll,{label:r(t.status.toLowerCase()),size:"sm",color:t.is_subscribed?"primary":"gray"})]})}function UT(){const{t}=Ue(),{subscriptions:e}=ey(),n=zt();return e?v.jsx(bs,{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(ty,{subscription:r},r.subscription_type.uuid))})]}),v.jsx(nt,{label:t("change"),before:v.jsx(wn,{icon:"edit"}),variant:"secondary",onClick:()=>n("subscriptions")})]})}):v.jsx(Iu,{})}function GT(){const{contact:t}=ar();return v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(LT,{contact:t})}),v.jsx(kt,{children:v.jsxs("div",{className:"grid grid-cols-1 gap-x-2 gap-y-2 lg:grid-cols-4",children:[v.jsx(FT,{}),v.jsx(jT,{}),v.jsx(VT,{}),v.jsx(UT,{})]})})]})}function Es({label:t,path:e}){const n=zt();return v.jsx("div",{className:"flex h-16 items-center text-base text-core-gray-900",children:v.jsx(nt,{label:t,variant:"link-gray",before:v.jsx(wn,{icon:"caret-left",size:"md"}),onClick:()=>n(e)})})}function qT(){const{t}=Ue(),{loyaltyTransactions:e}=J2(),{contact:n}=ar();return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Z2,{loyaltyTransaction:r},r.uuid))})]})})]})})}function HT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{subscriptions:r,mutate:o}=ey(),[i,a]=x.useState({}),[s,c]=x.useState(!1),u=Dt();x.useEffect(()=>{if(r&&!Object.keys(i).length){const p=r.reduce((l,g)=>({...l,[g.subscription_type.name]:g.is_subscribed}),{});a(p)}},[r]);const d=p=>{Object.hasOwn(i,p)?a({...i,[p]:!i[p]}):a({...i,[p]:!0})},h=()=>{c(!0),u.put(`${n}/subscriptions`,{values:i}).then(()=>o()).catch(e).finally(()=>c(!1))},f=()=>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(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(ty,{subscription:p,onChange:d,editable:!0},p.subscription_type.uuid))]})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:h,pending:s,disabled:!f()||s})})]})}):v.jsx(Iu,{})}function $T(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contact:r,mutate:o}=ar(),[i,a]=x.useState(),[s,c]=x.useState(!1),[u,d]=x.useState(),h=Dt();cr({url:`${n}/contact-attributes`,onData:g=>a(g.elements)});const f=g=>{d({...u,[g.target.name]:g.target.value})},p=(g,m)=>{d({...u,[g]:m})},l=async()=>{c(!0),h.put(`${n}/contact-attributes`,u).then(()=>{o(),d(void 0)}).catch(e).finally(()=>c(!1))};return v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Ml,{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(qb,{name:g.name,label:g.label,value:u&&u[g.name]?u[g.name]:r.current_display_values[g.name],onChange:m=>p(g.name,m),disabled:g.disabled,children:g.options.map(m=>v.jsx(jl,{label:m.label,value:m.value},m.value))},g.id):g.type==="multi_select"?v.jsx(jb,{name:g.name,value:u&&u[g.name]?u[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(pp,{id:g.id,name:g.name,label:g.label,type:g.type==="date_time"?"date_time":"date",value:u&&u[g.name]?u[g.name]:r.current_display_values[g.name],disabled:g.disabled,onChange:f},g.id):v.jsx(Yo,{disabled:g.disabled,label:g.label,name:g.name,value:u&&u[g.name]!=="undefined"?u[g.name]:r.current_display_values[g.name],onChange:f},g.id)}):v.jsx(Tc,{rows:10})]})}),v.jsx(rn,{children:v.jsx(nt,{label:t("saveChanges"),className:"w-full",onClick:l,disabled:!u,pending:s})})]})})}function ny(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/contact-identifiers`,onData:n});return{contactIdentifiers:e,isLoading:r,pending:o,mutate:i}}function YT({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(wn,{className:"h-full",icon:"close"})})]})}function WT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contactIdentifiers:r,isLoading:o,mutate:i}=ny(),[a,s]=x.useState(""),[c,u]=x.useState(!1),d=zt(),h=Dt(),f=l=>{s(l),u(!0)},p=async()=>{h.destroy(`${n}/contact-identifiers`,{value:a}).then(()=>i()).catch(e).finally(()=>u(!1))};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile"})}),v.jsx(kt,{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(Tc,{rows:10}):r==null?void 0:r.map(l=>v.jsx(YT,{identifier:l,onClear:f},l.value))]})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",variant:"secondary",onClick:()=>d("create")})})]}),v.jsx(Eo,{title:t("confirmClearContactIdentifier"),isOpen:c,primaryAction:{label:t("confirm"),action:p},secondaryAction:{label:t("cancel"),action:()=>u(!1)},onClose:()=>u(!1),children:v.jsx("p",{children:t("clearContactIdentifier",{value:a})})})]})}function KT(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n}=je(),{contact:r}=ar(),{mutate:o}=ny(),[i,a]=x.useState(""),[s,c]=x.useState(!1),[u,d]=x.useState(!1),h=zt(),f=Dt(),p=()=>{c(!0),f.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(()=>{!u&&i&&p()},[i]),v.jsx("div",{className:"h-full md:container",children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx(Es,{label:t("back"),path:"../profile/contact-identifiers"})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>i&&p(),children:v.jsx(aa,{data:i,dataSetter:a,setDefer:d,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("addIdentifier"),className:"w-full",onClick:p,pending:s,disabled:!i})})]})})}function zT(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/profile",element:v.jsx(GT,{})}),v.jsx(Ye,{path:"/profile/activity",element:v.jsx(qT,{})}),v.jsx(Ye,{path:"/profile/subscriptions",element:v.jsx(HT,{})}),v.jsx(Ye,{path:"/profile/contact-identifiers",element:v.jsx(WT,{})}),v.jsx(Ye,{path:"/profile/contact-identifiers/create",element:v.jsx(KT,{})}),v.jsx(Ye,{path:"/profile/contact-attributes",element:v.jsx($T,{})})]})}function XT(){const{t}=Ue(),{contact:e}=ar(),{portalSession:n}=je();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 ry(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/rewards`,onData:n});return{rewards:e,isLoading:r,pending:o,mutate:i}}function jf({reward:t,selected:e,setSelected:n,disabled:r,readOnly:o}){const{portalSession:i}=je(),{contact:a}=ar();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(Vb,{value:a.credit_balance.balance,max:t.required_credits})]})}function QT({selected:t,setSelected:e}){const{t:n}=Ue(),{contact:r}=ar(),{rewards:o,isLoading:i}=ry(),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(Tc,{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(jf,{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(jf,{reward:c,selected:t,setSelected:e,disabled:!0},c.uuid))]})})]})})}function JT(){const{portalSession:t}=je(),{rewards:e}=ry(),n=()=>t.events.filter(r=>r.type===yo.REWARD_RECEPTION).map(r=>e.find(o=>o.uuid===r.data.reward.uuid)).filter(r=>r);return e?v.jsx("div",{children:v.jsx(y0,{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 ZT(){const{t}=Ue(),{errorToast:e,successToast:n}=Vt(),{portalSession:r,mutate:o}=je(),{mutate:i}=ar(),{onClaimReward:a}=Xt(),[s,c]=x.useState(),[u,d]=x.useState(!1),[h,f]=x.useState(!1),{post:p}=ws(),l=Dt();x.useEffect(()=>{s&&f(!0)},[s]);const g=y=>{o().then(w=>{const E=w.data.data.events.filter(C=>C.type===yo.REWARD_RECEPTION&&C.data.reward.uuid===s.uuid).reduce((C,I)=>new Date(C.created_at)>new Date(I.created_at)?C:I);a==null||a(y,E.data.uuid)})},m=()=>{d(!0),l.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(()=>{f(!1),c(void 0),d(!1)})};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(XT,{})}),v.jsx(kt,{children:v.jsx(QT,{selected:s,setSelected:c})}),v.jsx(rn,{children:v.jsx(JT,{})})]}),v.jsx(Eo,{title:t("confirmRewardRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:m,loading:u},secondaryAction:{label:t("cancel"),action:()=>f(!1)},onClose:()=>f(!1),children:v.jsx("div",{className:"flex flex-col gap-4",children:s&&v.jsx(jf,{reward:s,selected:s,setSelected:c,readOnly:!0})})})]})}function Vf(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/vouchers`,onData:n});return{vouchers:e,isLoading:r,pending:o,mutate:i}}function ex(){const{t}=Ue();return v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("vouchers")})})}function Uf({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===Ea.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===Ea.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===Ea.REDEEMED?"gray":"primary"}-500`,children:t.code})]})}function tx({selected:t,setSelected:e}){const{t:n}=Ue(),{vouchers:r,isLoading:o}=Vf();return v.jsx(v.Fragment,{children:o?v.jsx(Tc,{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(Uf,{voucher:i,selected:t,setSelected:e},i.code)):v.jsx("p",{className:"text-center text-sm text-core-gray-500",children:n("vouchersEmptyState")})})})})}function nx(){const{t}=Ue(),{portalSession:e}=je(),{vouchers:n}=Vf(),r=()=>e.events.filter(o=>o.type===yo.VOUCHER_REDEEMED);return n?v.jsx("div",{children:v.jsx(y0,{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 rx(){const{t}=Ue(),{errorToast:e,successToast:n}=Vt(),{uuid:r}=je(),{onRedeemVoucher:o}=Xt(),{post:i}=ws(),{mutate:a}=Vf(),[s,c]=x.useState(),[u,d]=x.useState(!1),[h,f]=x.useState(!1),p=Dt();x.useEffect(()=>{s&&f(!0)},[s]);const l=()=>{d(!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(),d(!1)})},g=()=>{f(!1),c(void 0)};return v.jsxs("div",{className:"h-full md:container",children:[v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx(ex,{})}),v.jsx(kt,{children:v.jsx(tx,{selected:s,setSelected:c})}),v.jsx(rn,{children:v.jsx(nx,{})})]}),v.jsx(Eo,{title:t("confirmVoucherRedemption"),isOpen:h,primaryAction:{label:t("confirm"),action:l,loading:u},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(Uf,{voucher:s,setSelected:c})]})})]})}function ox(){const{t}=Ue(),[e,n]=x.useState(1),r=zt(),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(Mf,{children:v.jsxs("div",{className:"relative h-full w-full select-none overflow-auto",children:[v.jsx(vE,{children:o.map(i=>v.jsx(wE,{id:i.id,label:i.label,icon:i.icon,activeTab:e,setActiveTab:n,pathname:i.pathname},i.id))}),v.jsxs(MT,{children:[v.jsx(zT,{}),v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/rewards",element:v.jsx(ZT,{})}),v.jsx(Ye,{path:"/vouchers",element:v.jsx(rx,{})})]})]})]})})}function ix(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(DT,{})}),v.jsx(Ye,{path:"/overview/*",element:v.jsx(ox,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PORTAL})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.PORTAL})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.PORTAL})})]})}function oy(){const{uuid:t}=je(),[e,n]=x.useState(),{isLoading:r,pending:o,mutate:i}=cr({url:`${t}/prepaid`,onData:n});return{prepaidBalance:e,isLoading:r,pending:o,mutate:i}}function ax(){const{t}=Ue(),{state:e}=er(),{errorToast:n,successToast:r}=Vt(),{uuid:o,mutate:i}=je(),{contact:a}=ar(),{onCreatePrepaidTransaction:s}=Xt(),{prepaidBalance:c,mutate:u}=oy(),[d,h]=x.useState(!1),f=Dt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{u(),i(),s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(X2,{title:a.getDisplayName(),balance:(c==null?void 0:c.balance_in_cents)??0,balanceName:t("prepaidBalance"),transaction:p,pending:d})}):v.jsx(_r,{})}function sx({title:t,balance:e,balanceName:n,transaction:r,pending:o}){const{t:i}=Ue(),{portalSession:a}=je(),s=a.inputData.amount_in_cents??0,c=()=>{let d=0;return a.events.filter(f=>Object.values(yo).includes(f.type)).forEach(f=>{d+=f.data.amount_in_cents}),d},u=()=>Math.min(s+c(),e);return v.jsxs(Mt,{children:[t&&v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t})})}),v.jsx(kt,{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(bo,{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(bo,{value:u(),start:s,currency:a.currency,asCurrency:!0})})]})})]})}),v.jsx(rn,{children:v.jsx(nt,{label:i("confirmAndPay",{amount:Si(u(),a.currency)}),className:"w-full",onClick:()=>r==null?void 0:r(-u()),disabled:!s||!!c(),pending:o})})]})}function cx(){const{t}=Ue(),{state:e}=er(),{errorToast:n,successToast:r}=Vt(),{uuid:o,mutate:i}=je(),{contact:a}=ar(),{onCreatePrepaidTransaction:s}=Xt(),{prepaidBalance:c,mutate:u}=oy(),[d,h]=x.useState(!1),f=Dt(),p=l=>{h(!0),f.post(`${o}/prepaid/transaction`,{amount_in_cents:l,contact_identifier_value:(e==null?void 0:e.contactIdentifier)??void 0}).then(g=>{u(),i(),s(g.data.data),r(t("prepaidTransactionCreated"))}).catch(n).finally(()=>h(!1))};return c?v.jsx(Tn,{children:v.jsx(sx,{title:a.getDisplayName(),balance:c.balance_in_cents,balanceName:t("prepaidBalance"),transaction:p,pending:d})}):v.jsx(_r,{})}function ux({setType:t}){const{t:e}=Ue();return v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:e("Choose type")})})}),v.jsx(kt,{children:v.jsxs("div",{className:"flex gap-2",children:[v.jsx(nt,{className:"grow",label:e("pay"),onClick:()=>t(Kt.PAY_PREPAID)}),v.jsx(nt,{className:"grow",label:e("topUp"),onClick:()=>t(Kt.TOP_UP_PREPAID)})]})})]})})}function lx(){const{portalSession:t}=je(),{primaryIdentificationMethod:e}=Xt(),[n,r]=x.useState(t.type);if(!t.contact)return e&&e===Ci.EMAIL?v.jsx(dr,{to:`${Le.PREPAID}/email`}):v.jsx(dr,{to:`${Le.PREPAID}/identifier`});const o=()=>n===Kt.TOP_UP_PREPAID?v.jsx(ax,{}):n===Kt.PAY_PREPAID?v.jsx(cx,{}):v.jsx(ux,{setType:r});return v.jsx(Mf,{children:o()})}function dx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(lx,{})}),v.jsx(Ye,{path:"/email",element:v.jsx(Su,{redirectRoute:Le.PREPAID})}),v.jsx(Ye,{path:"/identifier",element:v.jsx(Lf,{redirectRoute:Le.PREPAID})}),v.jsx(Ye,{path:"/identifier/link",element:v.jsx(Ff,{redirectRoute:Le.PREPAID})})]})}function fx(){const{t}=Ue(),{errorToast:e}=Vt(),{uuid:n,portalSession:r}=je(),[o,i]=x.useState(""),[a,s]=x.useState(!1),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt(),l=()=>{s(!0),p.get(`${n}/vouchers/check/${o}`).then(g=>{g.data.data.contact||r.contact?f(`${o}/redeem`):h(!0)}).catch(e).finally(()=>s(!1))};return x.useEffect(()=>{!c&&o&&l()},[o]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:t("voucherCode").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(aa,{data:o,dataSetter:i,setDefer:u,label:t("code")})}),v.jsx(rn,{children:v.jsx(nt,{label:t("submit"),className:"w-full",onClick:l,pending:a})})]})}),v.jsx(Eo,{title:t("noContactLinkedToVoucherTitle"),isOpen:d,onClose:()=>h(!1),primaryAction:{label:t("linkToContact"),action:()=>f(`${o}/identifier`)},secondaryAction:{label:t("cancel"),action:()=>h(!1)},children:v.jsx("p",{children:t("linkVoucherWithCodeToContact",{code:o})})})]})}function hx(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{uuid:r}=je(),{onRedeemVoucher:o}=Xt(),{post:i}=ws(),{voucher:a,mutate:s}=K2(n),[c,u]=x.useState(!1),d=Dt(),h=()=>{u(!0),d.post(`${r}/vouchers/redeem`,{code:n}).then(f=>{o==null||o(f.data.data),i(),s()}).catch(e).finally(()=>u(!1))};return a?v.jsx(Tn,{children:v.jsxs(Mt,{children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:"Voucher"})})}),v.jsx(kt,{children:v.jsx("div",{children:v.jsx(Uf,{voucher:a,setSelected:()=>{}})})}),v.jsx(rn,{children:v.jsx(nt,{label:t("redeemVoucher"),className:"w-full",onClick:h,disabled:a.status!==Ea.ACTIVE||c,pending:c})})]})}):v.jsx(_r,{})}function px(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{portalSession:r,mutate:o}=je(),{onContactLink:i}=Xt(),[a,s]=x.useState(""),[c,u]=x.useState(!1),[d,h]=x.useState(!1),f=zt(),p=Dt(),l=m=>p.get(`${r.uuid}/contacts`,{contact_uuid:m}),g=()=>{u(!0),p.put(r.uuid,{contact_identifier_value:a}).then(m=>{i&&l(m.data.data.contact.uuid).then(y=>{i==null||i(y.data.data)}),o().then(()=>f(`${Le.VOUCHER}/${n}/redeem`))}).catch(e).finally(()=>u(!1))};return x.useEffect(()=>{!d&&a&&g()},[a]),v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("scanOrEnterX",{x:"identifier"})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:g,children:v.jsx(aa,{data:a,dataSetter:s,setDefer:h,label:t("contactIdentifier")})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),onClick:g,pending:c}),r.inputData.enable_email_identification&&v.jsx(nt,{label:t("useEmail"),variant:"secondary",onClick:()=>f(`../${n}/email`)})]})})]})})}function gx(){const{t}=Ue(),{errorToast:e}=Vt(),{code:n}=Yr(),{onContactLink:r}=Xt(),{portalSession:o,mutate:i}=je(),{publish:a}=Oa(),[s,c]=x.useState(""),[u,d]=x.useState(!1),[h,f]=x.useState(!1),p=zt(),l=Dt(),g=w=>l.get(`${o.uuid}/contacts`,{contact_uuid:w}),m=()=>{d(!0),l.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(`${Le.VOUCHER}/${n}/redeem`))}).catch(w=>{w.response.data.code===Ws.CONTACT_NOT_FOUND&&f(!0)}).finally(()=>d(!1))},y=()=>{d(!0),l.post(`${o.uuid}/contacts`,{email:s}).then(m).catch(e).finally(()=>d(!1))};return x.useEffect(()=>{a("openKeyboard",{inputId:"via-email-address-input",inputValue:""})},[]),v.jsxs(v.Fragment,{children:[v.jsx(Tn,{children:v.jsxs(Mt,{id:fr,children:[v.jsx(Bt,{children:v.jsx("div",{className:"flex h-16 items-center",children:v.jsx("p",{children:t("fillInXBelow",{x:t("emailAddress").toLowerCase()})})})}),v.jsx(kt,{children:v.jsx(si,{onSubmit:()=>s&&!u&&m(),children:v.jsx(Yo,{id:"via-email-address-input",label:t("emailAddress"),autoFocus:!0,onChange:w=>c(w.target.value),beforeIcon:"mail"})})}),v.jsx(rn,{children:v.jsxs("div",{className:"flex flex-col gap-2",children:[v.jsx(nt,{label:t("continue"),className:"w-full",onClick:m,pending:u,disabled:!s||u}),v.jsx(nt,{label:t("useIdentifier"),variant:"secondary",onClick:()=>p(`../${n}/identifier`)})]})})]})}),v.jsx(Eo,{title:`${t("new")} ${t("emailAddress").toLowerCase()}`,isOpen:h,onClose:()=>f(!1),primaryAction:{label:t("confirm"),action:y,disabled:u},secondaryAction:{label:t("cancel"),action:()=>f(!1)},children:v.jsx("p",{children:t("continueWithEmail",{email:s})})})]})}function mx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx(fx,{})}),v.jsx(Ye,{path:":code/redeem",element:v.jsx(hx,{})}),v.jsx(Ye,{path:":code/email",element:v.jsx(gx,{})}),v.jsx(Ye,{path:":code/identifier",element:v.jsx(px,{})})]})}function yx(){return v.jsxs(Wr,{children:[v.jsx(Ye,{path:"/",element:v.jsx($A,{})}),v.jsx(Ye,{path:`${Le.GENERIC}/*`,element:v.jsx(AT,{})}),v.jsx(Ye,{path:`${Le.GIFTCARD}/*`,element:v.jsx(kT,{})}),v.jsx(Ye,{path:`${Le.POINTS_TRANSACTION}/*`,element:v.jsx(RT,{})}),v.jsx(Ye,{path:`${Le.PORTAL}/*`,element:v.jsx(ix,{})}),v.jsx(Ye,{path:`${Le.PREPAID}/*`,element:v.jsx(dx,{})}),v.jsx(Ye,{path:`${Le.VOUCHER}/*`,element:v.jsx(mx,{})})]})}function Gf(t){"@babel/helpers - typeof";return Gf=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},Gf(t)}function iy(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":Gf(XMLHttpRequest))==="object"}function vx(t){return!!t&&typeof t.then=="function"}function wx(t){return vx(t)?t:Promise.resolve(t)}function bx(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 qf={exports:{}},Tu={exports:{}},ay;function Ex(){return ay||(ay=1,function(t,e){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof wi<"u"&&wi,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 u(k){return k&&DataView.prototype.isPrototypeOf(k)}if(c.arrayBuffer)var d=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(k){return k&&d.indexOf(Object.prototype.toString.call(k))>-1};function f(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 l(k){var U={next:function(){var z=k.shift();return{done:z===void 0,value:z}}};return c.iterable&&(U[Symbol.iterator]=function(){return U}),U}function g(k){this.map={},k instanceof g?k.forEach(function(U,z){this.append(z,U)},this):Array.isArray(k)?k.forEach(function(U){this.append(U[0],U[1])},this):k&&Object.getOwnPropertyNames(k).forEach(function(U){this.append(U,k[U])},this)}g.prototype.append=function(k,U){k=f(k),U=p(U);var z=this.map[k];this.map[k]=z?z+", "+U:U},g.prototype.delete=function(k){delete this.map[f(k)]},g.prototype.get=function(k){return k=f(k),this.has(k)?this.map[k]:null},g.prototype.has=function(k){return this.map.hasOwnProperty(f(k))},g.prototype.set=function(k,U){this.map[f(k)]=p(U)},g.prototype.forEach=function(k,U){for(var z in this.map)this.map.hasOwnProperty(z)&&k.call(U,this.map[z],z,this)},g.prototype.keys=function(){var k=[];return this.forEach(function(U,z){k.push(z)}),l(k)},g.prototype.values=function(){var k=[];return this.forEach(function(U){k.push(U)}),l(k)},g.prototype.entries=function(){var k=[];return this.forEach(function(U,z){k.push([z,U])}),l(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(U,z){k.onload=function(){U(k.result)},k.onerror=function(){z(k.error)}})}function w(k){var U=new FileReader,z=y(U);return U.readAsArrayBuffer(k),z}function b(k){var U=new FileReader,z=y(U);return U.readAsText(k),z}function E(k){for(var U=new Uint8Array(k),z=new Array(U.length),te=0;te<U.length;te++)z[te]=String.fromCharCode(U[te]);return z.join("")}function C(k){if(k.slice)return k.slice(0);var U=new Uint8Array(k.byteLength);return U.set(new Uint8Array(k)),U.buffer}function I(){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&&u(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 U=k.toUpperCase();return T.indexOf(U)>-1?U:k}function N(k,U){if(!(this instanceof N))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U=U||{};var z=U.body;if(k instanceof N){if(k.bodyUsed)throw new TypeError("Already read");this.url=k.url,this.credentials=k.credentials,U.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=U.credentials||this.credentials||"same-origin",(U.headers||!this.headers)&&(this.headers=new g(U.headers)),this.method=P(U.method||this.method||"GET"),this.mode=U.mode||this.mode||null,this.signal=U.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")&&(U.cache==="no-store"||U.cache==="no-cache")){var te=/([?&])_=[^&]*/;if(te.test(this.url))this.url=this.url.replace(te,"$1_="+new Date().getTime());else{var oe=/\?/;this.url+=(oe.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}N.prototype.clone=function(){return new N(this,{body:this._bodyInit})};function L(k){var U=new FormData;return k.trim().split("&").forEach(function(z){if(z){var te=z.split("="),oe=te.shift().replace(/\+/g," "),ne=te.join("=").replace(/\+/g," ");U.append(decodeURIComponent(oe),decodeURIComponent(ne))}}),U}function V(k){var U=new g,z=k.replace(/\r?\n[\t ]+/g," ");return z.split("\r").map(function(te){return te.indexOf(`
|
|
154
154
|
`)===0?te.substr(1,te.length):te}).forEach(function(te){var oe=te.split(":"),ne=oe.shift().trim();if(ne){var se=oe.join(":").trim();U.append(ne,se)}}),U}I.call(N.prototype);function j(k,U){if(!(this instanceof j))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');U||(U={}),this.type="default",this.status=U.status===void 0?200:U.status,this.ok=this.status>=200&&this.status<300,this.statusText=U.statusText===void 0?"":""+U.statusText,this.headers=new g(U.headers),this.url=U.url||"",this._initBody(k)}I.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 W=[301,302,303,307,308];j.redirect=function(k,U){if(W.indexOf(U)===-1)throw new RangeError("Invalid status code");return new j(null,{status:U,headers:{location:k}})},a.DOMException=s.DOMException;try{new a.DOMException}catch{a.DOMException=function(U,z){this.message=U,this.name=z;var te=Error(U);this.stack=te.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function q(k,U){return new Promise(function(z,te){var oe=new N(k,U);if(oe.signal&&oe.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:V(ne.getAllResponseHeaders()||"")};le.url="responseURL"in ne?ne.responseURL:le.headers.get("X-Request-URL");var _e="response"in ne?ne.response:ne.responseText;setTimeout(function(){z(new j(_e,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(oe.method,we(oe.url),!0),oe.credentials==="include"?ne.withCredentials=!0:oe.credentials==="omit"&&(ne.withCredentials=!1),"responseType"in ne&&(c.blob?ne.responseType="blob":c.arrayBuffer&&oe.headers.get("Content-Type")&&oe.headers.get("Content-Type").indexOf("application/octet-stream")!==-1&&(ne.responseType="arraybuffer")),U&&typeof U.headers=="object"&&!(U.headers instanceof g)?Object.getOwnPropertyNames(U.headers).forEach(function(le){ne.setRequestHeader(le,p(U.headers[le]))}):oe.headers.forEach(function(le,_e){ne.setRequestHeader(_e,le)}),oe.signal&&(oe.signal.addEventListener("abort",se),ne.onreadystatechange=function(){ne.readyState===4&&oe.signal.removeEventListener("abort",se)}),ne.send(typeof oe._bodyInit>"u"?null:oe._bodyInit)})}return q.polyfill=!0,s.fetch||(s.fetch=q,s.Headers=g,s.Request=N,s.Response=j),a.Headers=g,a.Request=N,a.Response=j,a.fetch=q,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}(Tu,Tu.exports)),Tu.exports}(function(t,e){var n;if(typeof fetch=="function"&&(typeof wi<"u"&&wi.fetch?n=wi.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof bx<"u"&&typeof window>"u"){var r=n||Ex();r.default&&(r=r.default),e.default=r,t.exports=e.default}})(qf,qf.exports);var sy=qf.exports;const cy=Fu(sy),uy=Zy({__proto__:null,default:cy},[sy]);function ly(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 dy(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ly(Object(n),!0).forEach(function(r){Cx(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ly(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Cx(t,e,n){return e=_x(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _x(t){var e=Ax(t,"string");return gi(e)=="symbol"?e:e+""}function Ax(t,e){if(gi(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(gi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gi(t){"@babel/helpers - typeof";return gi=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},gi(t)}var io;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?io=global.fetch:typeof window<"u"&&window.fetch?io=window.fetch:io=fetch);var Cs;iy()&&(typeof global<"u"&&global.XMLHttpRequest?Cs=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(Cs=window.XMLHttpRequest));var xu;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?xu=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(xu=window.ActiveXObject)),!io&&uy&&!Cs&&!xu&&(io=cy||uy),typeof io!="function"&&(io=void 0);var Hf=function(e,n){if(n&&gi(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},fy=function(e,n,r,o){var i=function(c){if(!c.ok)return r(c.statusText||"Error",{status:c.status});c.text().then(function(u){r(null,{status:c.status,data:u})}).catch(r)};if(o){var a=o(e,n);if(a instanceof Promise){a.then(i).catch(r);return}}typeof fetch=="function"?fetch(e,n).then(i).catch(r):io(e,n).then(i).catch(r)},hy=!1,Sx=function(e,n,r,o){e.queryStringParams&&(n=Hf(n,e.queryStringParams));var i=dy({},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=dy({method:r?"POST":"GET",body:r?e.stringify(r):void 0,headers:i},hy?{}:a),c=typeof e.alternateFetch=="function"&&e.alternateFetch.length>=1?e.alternateFetch:void 0;try{fy(n,s,o,c)}catch(u){if(!a||Object.keys(a).length===0||!u.message||u.message.indexOf("not implemented")<0)return o(u);try{Object.keys(a).forEach(function(d){delete s[d]}),fy(n,s,o,c),hy=!0}catch(d){o(d)}}},Ix=function(e,n,r,o){r&&gi(r)==="object"&&(r=Hf("",r).slice(1)),e.queryStringParams&&(n=Hf(n,e.queryStringParams));try{var i;Cs?i=new Cs:i=new xu("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)}},Tx=function(e,n,r,o){if(typeof r=="function"&&(o=r,r=void 0),o=o||function(){},io&&n.indexOf("file:")!==0)return Sx(e,n,r,o);if(iy()||typeof ActiveXObject=="function")return Ix(e,n,r,o);o(new Error("No fetch and no xhr implementation found!"))};function sa(t){"@babel/helpers - typeof";return sa=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},sa(t)}function py(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 $f(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?py(Object(n),!0).forEach(function(r){gy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):py(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xx(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ox(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,my(r.key),r)}}function Px(t,e,n){return e&&Ox(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function gy(t,e,n){return e=my(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function my(t){var e=kx(t,"string");return sa(e)=="symbol"?e:e+""}function kx(t,e){if(sa(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(sa(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bx=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 gy({},r,o||"")},parseLoadPayload:function(n,r){},request:Tx,reloadInterval:typeof window<"u"?!1:60*60*1e3,customHeaders:{},queryStringParams:{},crossDomain:!1,withCredentials:!1,overrideMimeType:!1,requestOptions:{mode:"cors",credentials:"same-origin",cache:"default"}}},yy=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]:{};xx(this,t),this.services=e,this.options=n,this.allOptions=r,this.type="backend",this.init(e,n,r)}return Px(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=$f($f($f({},Bx()),this.options||{}),o),this.allOptions=i,this.services&&this.options.reloadInterval){var a=setInterval(function(){return r.reload()},this.options.reloadInterval);sa(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=wx(c),c.then(function(u){if(!u)return a(null,{});var d=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:o.join("+")});s.loadUrl(d,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,u=this.options.parseLoadPayload(s,c);this.options.request(this.options,n,u,function(d,h){if(h&&(h.status>=500&&h.status<600||!h.status))return r("failed loading "+n+"; status code: "+h.status,!0);if(h&&h.status>=400&&h.status<500)return r("failed loading "+n+"; status code: "+h.status,!1);if(!h&&d&&d.message&&d.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+d.message,!0);if(d)return r(d,!1);var f,p;try{typeof h.data=="string"?f=a.options.parse(h.data,o,i):f=h.data}catch{p="failed parsing "+n+" to json"}if(p)return r(p,!1);r(null,f)})}},{key:"create",value:function(n,r,o,i,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var c=this.options.parsePayload(r,o,i),u=0,d=[],h=[];n.forEach(function(f){var p=s.options.addPath;typeof s.options.addPath=="function"&&(p=s.options.addPath(f,r));var l=s.services.interpolator.interpolate(p,{lng:f,ns:r});s.options.request(s.options,l,c,function(g,m){u+=1,d.push(g),h.push(m),u===n.length&&typeof a=="function"&&a(d,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=[],u=function(h){var f=i.toResolveHierarchy(h);f.forEach(function(p){c.indexOf(p)<0&&c.push(p)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(d){return u(d)}),c.forEach(function(d){n.allOptions.ns.forEach(function(h){o.read(d,h,"read",null,null,function(f,p){f&&a.warn("loading namespace ".concat(h," for language ").concat(d," failed"),f),!f&&p&&a.log("loaded namespace ".concat(h," for language ").concat(d),p),o.loaded("".concat(d,"|").concat(h),f,p)})})})}}}])}();yy.type="backend";const{slice:Nx,forEach:Rx}=[];function Dx(t){return Rx.call(Nx.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const vy=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Mx=(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(!vy.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!vy.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},wy={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=Mx(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 Lx={name:"cookie",lookup(t){let{lookupCookie:e}=t;if(e&&typeof document<"u")return wy.read(e)||void 0},cacheUserLanguage(t,e){let{lookupCookie:n,cookieMinutes:r,cookieDomain:o,cookieOptions:i}=e;n&&typeof document<"u"&&wy.create(n,t,r,o,i)}},Fx={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 _s=null;const by=()=>{if(_s!==null)return _s;try{_s=window!=="undefined"&&window.localStorage!==null;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{_s=!1}return _s};var jx={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&by())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&by()&&window.localStorage.setItem(n,t)}};let As=null;const Ey=()=>{if(As!==null)return As;try{As=window!=="undefined"&&window.sessionStorage!==null;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{As=!1}return As};var Vx={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&Ey())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&Ey()&&window.sessionStorage.setItem(n,t)}},Ux={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}},Gx={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}},qx={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}},Hx={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 $x(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t}}class Cy{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=Dx(n,this.options||{},$x()),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(Lx),this.addDetector(Fx),this.addDetector(jx),this.addDetector(Vx),this.addDetector(Ux),this.addDetector(Gx),this.addDetector(qx),this.addDetector(Hx)}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)}))}}Cy.type="languageDetector",nn.use(yy).use(Cy).use(x4).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 _y(){const{uuid:t,portalSession:e}=je(),[n,r]=x.useState();return cr({url:`${t}/brand-kit`,onData:r}),x.useEffect(()=>{n&&wb(n)},[n]),v.jsx(x.StrictMode,{children:v.jsxs(qA,{children:[v.jsx(Y3,{children:v.jsx(yx,{})}),v.jsx(Lb,{enabled:e.inputData.enable_on_screen_keyboard}),v.jsx(p4,{className:"lg:top-14"})]},t)})}function Ay(t){const{uuid:e,portalSession:n,error:r}=je();return n.uuid?v.jsx(Im.Provider,{value:{...t,cameraService:n.inputData.camera_service,cameraFacingMode:n.inputData.facing_mode,primaryIdentificationMethod:n.inputData.primary_identification_method},children:t.children}):v.jsx(_r,{message:r&&`No portal session found with uuid: ${e}.`})}function Yx(t){const{portalSession:e}=o3(t);return e?v.jsx(Vu.Provider,{value:{apiKey:t.apiKey,host:t.host},children:v.jsx(b1,{uuid:e.uuid,children:v.jsx(Ay,{...t,children:v.jsx(_y,{})})})}):v.jsx(_r,{})}const Wx="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 Kx({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:Wx,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 zx({uuid:t,host:e}){return t?v.jsx(Vu.Provider,{value:{host:e},children:v.jsx(b1,{uuid:t,children:v.jsx(Ay,{children:v.jsx(_y,{})})})}):v.jsx(Kx,{message:"No uuid provided."})}const Xx=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"})),Qx=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"})),Jx=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"})),Zx=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"})),eO=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"})),tO=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"})),nO=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"})),rO=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"})),oO=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"})),iO=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"})),aO=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"})),sO=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"})),cO=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"})),uO=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"})),lO=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"})),dO=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"})),fO=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"})),hO=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)}}
|
|
155
155
|
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}}
|
|
156
156
|
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,
|