@nuralogix.ai/web-measurement-embedded-app 0.1.0-beta.3 → 0.1.0-beta.4

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.
package/README.md CHANGED
@@ -29,23 +29,37 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
29
29
  <body>
30
30
  <div id="measurement-embedded-app-container"></div>
31
31
  <script type="module">
32
- import MeasurementEmbeddedApp, { faceAttributeValue } from '@nuralogix.ai/web-measurement-embedded-app';
32
+ import MeasurementEmbeddedApp, {
33
+ faceAttributeValue,
34
+ } from '@nuralogix.ai/web-measurement-embedded-app';
33
35
  const {
34
36
  SEX_ASSIGNED_MALE_AT_BIRTH,
35
37
  SMOKER_FALSE,
36
38
  BLOOD_PRESSURE_MEDICATION_FALSE,
37
- DIABETES_NONE
39
+ DIABETES_NONE,
38
40
  } = faceAttributeValue;
39
41
  const measurementApp = new MeasurementEmbeddedApp();
40
42
  const container = document.getElementById('measurement-embedded-app-container');
41
43
  if (container) {
42
- const apiUrl = '/api';
43
- const studyId = await fetch(`${apiUrl}/studyId`);
44
- const studyIdResponse = await studyId.json();
45
- const token = await fetch(`${apiUrl}/token`);
46
- const tokenResponse = await token.json();
47
- if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
48
- measurementApp.init({
44
+ const apiUrl = '/api';
45
+ const studyId = await fetch(`${apiUrl}/studyId`);
46
+ const studyIdResponse = await studyId.json();
47
+ const token = await fetch(`${apiUrl}/token`);
48
+ const tokenResponse = await token.json();
49
+ if (studyIdResponse.status === '200' && tokenResponse.status === '200') {
50
+ measurementApp.on.results = (results) => {
51
+ console.log('Results received', results);
52
+ measurementApp.destroy();
53
+ };
54
+ measurementApp.on.error = (error) => {
55
+ console.log('error received', error);
56
+ };
57
+ measurementApp.on.event = (appEvent) => {
58
+ console.log('App Event received', appEvent);
59
+ };
60
+
61
+ try {
62
+ await measurementApp.init({
49
63
  container,
50
64
  appPath: 'https://unpkg.com/@nuralogix.ai/web-measurement-embedded-app/dist',
51
65
  settings: {
@@ -70,27 +84,17 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
70
84
  cameraAutoStart: false,
71
85
  measurementAutoStart: false,
72
86
  cancelWhenLowSNR: true,
73
- }
87
+ },
74
88
  // Optional language/api overrides
75
89
  // language: 'fr'
76
90
  apiUrl: 'api.na-east.deepaffex.ai', // optional for region specific data processing
77
- loadError: function(error) {
78
- console.error("load error", error);
79
- }
80
91
  });
81
- measurementApp.on.results = (results) => {
82
- console.log("Results received", results);
83
- measurementApp.destroy();
84
- };
85
- measurementApp.on.error = (error) => {
86
- console.log("error received", error);
87
- };
88
- measurementApp.on.event = (appEvent) => {
89
- console.log("App Event received", appEvent);
90
- };
91
- } else {
92
- console.error('Failed to get Study ID and Token pair');
92
+ } catch (error) {
93
+ console.error('Failed to initialize:', error);
93
94
  }
95
+ } else {
96
+ console.error('Failed to get Study ID and Token pair');
97
+ }
94
98
  }
95
99
  </script>
96
100
  </body>
@@ -111,13 +115,12 @@ Need deeper integration details? Check the full docs at [docs.deepaffex.ai/wmea]
111
115
  - `cancelWhenLowSNR` (default: `true`) – cancels the measurement if signal-to-noise ratio falls below threshold.
112
116
  - Language support: `en`, `ja`, `zh`, `es`, `pt`, `pt-BR`, `it`, `fr`, `de`.
113
117
  - Unsupported browser locales fall back to base language (e.g., `zh-TW` → `zh`), then to English.
114
- - `loadError` is called if assets fail to download or the app cannot initialize.
115
118
 
116
119
  **Methods:**
117
120
 
118
121
  ```typescript
119
- init(options: MeasurementEmbeddedAppOptions): void;
120
- destroy(): void;
122
+ init(options: MeasurementEmbeddedAppOptions): Promise<void>;
123
+ destroy(): Promise<void>;
121
124
  cancel(reset: boolean): Promise<boolean>;
122
125
  setTheme(theme: 'light' | 'dark'): void;
123
126
  setLanguage(language: SupportedLanguage): void;
@@ -185,4 +188,3 @@ measurementApp.setLanguage('es');
185
188
  | `COLLECTOR` | Frame collection reported an error |
186
189
  | `WEBSOCKET_DISCONNECTED` | Realtime WebSocket connection closed or dropped. |
187
190
  | `MEASUREMENT_PREPARE_FAILED` | Measurement preparation failed - invalid or missing credentials |
188
-
package/dist/app.mjs CHANGED
@@ -9,7 +9,7 @@ Error generating stack: `+r.message+`
9
9
  `).replace(F0,"")}function ip(t,e){return e=rp(e),rp(t)===e}function qt(t,e,l,r,o,s){switch(l){case"children":typeof r=="string"?e==="body"||e==="textarea"&&r===""||ya(t,r):(typeof r=="number"||typeof r=="bigint")&&e!=="body"&&ya(t,""+r);break;case"className":Vi(t,"class",r);break;case"tabIndex":Vi(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Vi(t,l,r);break;case"style":rf(t,r,s);break;case"data":if(e!=="object"){Vi(t,"data",r);break}case"src":case"href":if(r===""&&(e!=="a"||l!=="href")){t.removeAttribute(l);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(l);break}r=Ki(""+r),t.setAttribute(l,r);break;case"action":case"formAction":if(typeof r=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof s=="function"&&(l==="formAction"?(e!=="input"&&qt(t,e,"name",o.name,o,null),qt(t,e,"formEncType",o.formEncType,o,null),qt(t,e,"formMethod",o.formMethod,o,null),qt(t,e,"formTarget",o.formTarget,o,null)):(qt(t,e,"encType",o.encType,o,null),qt(t,e,"method",o.method,o,null),qt(t,e,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(l);break}r=Ki(""+r),t.setAttribute(l,r);break;case"onClick":r!=null&&(t.onclick=Dn);break;case"onScroll":r!=null&&wt("scroll",t);break;case"onScrollEnd":r!=null&&wt("scrollend",t);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(u(61));if(l=r.__html,l!=null){if(o.children!=null)throw Error(u(60));t.innerHTML=l}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){t.removeAttribute("xlink:href");break}l=Ki(""+r),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(l,""+r):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":r===!0?t.setAttribute(l,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(l,r):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(l,r):t.removeAttribute(l);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(l):t.setAttribute(l,r);break;case"popover":wt("beforetoggle",t),wt("toggle",t),Yi(t,"popover",r);break;case"xlinkActuate":kn(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":kn(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":kn(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":kn(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":kn(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":kn(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":kn(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":kn(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":kn(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Yi(t,"is",r);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=by.get(l)||l,Yi(t,l,r))}}function kc(t,e,l,r,o,s){switch(l){case"style":rf(t,r,s);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(u(61));if(l=r.__html,l!=null){if(o.children!=null)throw Error(u(60));t.innerHTML=l}}break;case"children":typeof r=="string"?ya(t,r):(typeof r=="number"||typeof r=="bigint")&&ya(t,""+r);break;case"onScroll":r!=null&&wt("scroll",t);break;case"onScrollEnd":r!=null&&wt("scrollend",t);break;case"onClick":r!=null&&(t.onclick=Dn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xd.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(o=l.endsWith("Capture"),e=l.slice(2,o?l.length-7:void 0),s=t[ke]||null,s=s!=null?s[l]:null,typeof s=="function"&&t.removeEventListener(e,s,o),typeof r=="function")){typeof s!="function"&&s!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(e,r,o);break t}l in t?t[l]=r:r===!0?t.setAttribute(l,""):Yi(t,l,r)}}}function Re(t,e,l){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wt("error",t),wt("load",t);var r=!1,o=!1,s;for(s in l)if(l.hasOwnProperty(s)){var p=l[s];if(p!=null)switch(s){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(u(137,e));default:qt(t,e,s,p,l,null)}}o&&qt(t,e,"srcSet",l.srcSet,l,null),r&&qt(t,e,"src",l.src,l,null);return;case"input":wt("invalid",t);var y=s=p=o=null,E=null,w=null;for(r in l)if(l.hasOwnProperty(r)){var B=l[r];if(B!=null)switch(r){case"name":o=B;break;case"type":p=B;break;case"checked":E=B;break;case"defaultChecked":w=B;break;case"value":s=B;break;case"defaultValue":y=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(u(137,e));break;default:qt(t,e,r,B,l,null)}}ef(t,s,y,E,w,p,o,!1);return;case"select":wt("invalid",t),r=p=s=null;for(o in l)if(l.hasOwnProperty(o)&&(y=l[o],y!=null))switch(o){case"value":s=y;break;case"defaultValue":p=y;break;case"multiple":r=y;default:qt(t,e,o,y,l,null)}e=s,l=p,t.multiple=!!r,e!=null?ba(t,!!r,e,!1):l!=null&&ba(t,!!r,l,!0);return;case"textarea":wt("invalid",t),s=o=r=null;for(p in l)if(l.hasOwnProperty(p)&&(y=l[p],y!=null))switch(p){case"value":r=y;break;case"defaultValue":o=y;break;case"children":s=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(u(91));break;default:qt(t,e,p,y,l,null)}lf(t,r,o,s);return;case"option":for(E in l)if(l.hasOwnProperty(E)&&(r=l[E],r!=null))switch(E){case"selected":t.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:qt(t,e,E,r,l,null)}return;case"dialog":wt("beforetoggle",t),wt("toggle",t),wt("cancel",t),wt("close",t);break;case"iframe":case"object":wt("load",t);break;case"video":case"audio":for(r=0;r<Qr.length;r++)wt(Qr[r],t);break;case"image":wt("error",t),wt("load",t);break;case"details":wt("toggle",t);break;case"embed":case"source":case"link":wt("error",t),wt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(w in l)if(l.hasOwnProperty(w)&&(r=l[w],r!=null))switch(w){case"children":case"dangerouslySetInnerHTML":throw Error(u(137,e));default:qt(t,e,w,r,l,null)}return;default:if(Wo(e)){for(B in l)l.hasOwnProperty(B)&&(r=l[B],r!==void 0&&kc(t,e,B,r,l,void 0));return}}for(y in l)l.hasOwnProperty(y)&&(r=l[y],r!=null&&qt(t,e,y,r,l,null))}function W0(t,e,l,r){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,s=null,p=null,y=null,E=null,w=null,B=null;for(L in l){var $=l[L];if(l.hasOwnProperty(L)&&$!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":E=$;default:r.hasOwnProperty(L)||qt(t,e,L,null,r,$)}}for(var D in r){var L=r[D];if($=l[D],r.hasOwnProperty(D)&&(L!=null||$!=null))switch(D){case"type":s=L;break;case"name":o=L;break;case"checked":w=L;break;case"defaultChecked":B=L;break;case"value":p=L;break;case"defaultValue":y=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(u(137,e));break;default:L!==$&&qt(t,e,D,L,r,$)}}Go(t,p,y,E,w,B,s,o);return;case"select":L=p=y=D=null;for(s in l)if(E=l[s],l.hasOwnProperty(s)&&E!=null)switch(s){case"value":break;case"multiple":L=E;default:r.hasOwnProperty(s)||qt(t,e,s,null,r,E)}for(o in r)if(s=r[o],E=l[o],r.hasOwnProperty(o)&&(s!=null||E!=null))switch(o){case"value":D=s;break;case"defaultValue":y=s;break;case"multiple":p=s;default:s!==E&&qt(t,e,o,s,r,E)}e=y,l=p,r=L,D!=null?ba(t,!!l,D,!1):!!r!=!!l&&(e!=null?ba(t,!!l,e,!0):ba(t,!!l,l?[]:"",!1));return;case"textarea":L=D=null;for(y in l)if(o=l[y],l.hasOwnProperty(y)&&o!=null&&!r.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:qt(t,e,y,null,r,o)}for(p in r)if(o=r[p],s=l[p],r.hasOwnProperty(p)&&(o!=null||s!=null))switch(p){case"value":D=o;break;case"defaultValue":L=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(u(91));break;default:o!==s&&qt(t,e,p,o,r,s)}nf(t,D,L);return;case"option":for(var nt in l)if(D=l[nt],l.hasOwnProperty(nt)&&D!=null&&!r.hasOwnProperty(nt))switch(nt){case"selected":t.selected=!1;break;default:qt(t,e,nt,null,r,D)}for(E in r)if(D=r[E],L=l[E],r.hasOwnProperty(E)&&D!==L&&(D!=null||L!=null))switch(E){case"selected":t.selected=D&&typeof D!="function"&&typeof D!="symbol";break;default:qt(t,e,E,D,r,L)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var dt in l)D=l[dt],l.hasOwnProperty(dt)&&D!=null&&!r.hasOwnProperty(dt)&&qt(t,e,dt,null,r,D);for(w in r)if(D=r[w],L=l[w],r.hasOwnProperty(w)&&D!==L&&(D!=null||L!=null))switch(w){case"children":case"dangerouslySetInnerHTML":if(D!=null)throw Error(u(137,e));break;default:qt(t,e,w,D,r,L)}return;default:if(Wo(e)){for(var Yt in l)D=l[Yt],l.hasOwnProperty(Yt)&&D!==void 0&&!r.hasOwnProperty(Yt)&&kc(t,e,Yt,void 0,r,D);for(B in r)D=r[B],L=l[B],!r.hasOwnProperty(B)||D===L||D===void 0&&L===void 0||kc(t,e,B,D,r,L);return}}for(var x in l)D=l[x],l.hasOwnProperty(x)&&D!=null&&!r.hasOwnProperty(x)&&qt(t,e,x,null,r,D);for($ in r)D=r[$],L=l[$],!r.hasOwnProperty($)||D===L||D==null&&L==null||qt(t,e,$,D,r,L)}function up(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function q0(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,l=performance.getEntriesByType("resource"),r=0;r<l.length;r++){var o=l[r],s=o.transferSize,p=o.initiatorType,y=o.duration;if(s&&y&&up(p)){for(p=0,y=o.responseEnd,r+=1;r<l.length;r++){var E=l[r],w=E.startTime;if(w>y)break;var B=E.transferSize,$=E.initiatorType;B&&up($)&&(E=E.responseEnd,p+=B*(E<y?1:(y-w)/(E-w)))}if(--r,e+=8*(s+p)/(o.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Dc=null,Lc=null;function Wu(t){return t.nodeType===9?t:t.ownerDocument}function op(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function sp(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function Nc(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Mc=null;function Y0(){var t=window.event;return t&&t.type==="popstate"?t===Mc?!1:(Mc=t,!0):(Mc=null,!1)}var cp=typeof setTimeout=="function"?setTimeout:void 0,V0=typeof clearTimeout=="function"?clearTimeout:void 0,dp=typeof Promise=="function"?Promise:void 0,P0=typeof queueMicrotask=="function"?queueMicrotask:typeof dp<"u"?function(t){return dp.resolve(null).then(t).catch(K0)}:cp;function K0(t){setTimeout(function(){throw t})}function gl(t){return t==="head"}function fp(t,e){var l=e,r=0;do{var o=l.nextSibling;if(t.removeChild(l),o&&o.nodeType===8)if(l=o.data,l==="/$"||l==="/&"){if(r===0){t.removeChild(o),Ka(e);return}r--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")r++;else if(l==="html")Jr(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,Jr(l);for(var s=l.firstChild;s;){var p=s.nextSibling,y=s.nodeName;s[br]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&s.rel.toLowerCase()==="stylesheet"||l.removeChild(s),s=p}}else l==="body"&&Jr(t.ownerDocument.body);l=o}while(l);Ka(e)}function hp(t,e){var l=t;t=0;do{var r=l.nextSibling;if(l.nodeType===1?e?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(e?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),r&&r.nodeType===8)if(l=r.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=r}while(l)}function zc(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var l=e;switch(e=e.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":zc(l),$o(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function X0(t,e,l,r){for(;t.nodeType===1;){var o=l;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[br])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(s=t.getAttribute("rel"),s==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(s!==o.rel||t.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||t.getAttribute("title")!==(o.title==null?null:o.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(s=t.getAttribute("src"),(s!==(o.src==null?null:o.src)||t.getAttribute("type")!==(o.type==null?null:o.type)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&s&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var s=o.name==null?null:""+o.name;if(o.type==="hidden"&&t.getAttribute("name")===s)return t}else return t;if(t=fn(t.nextSibling),t===null)break}return null}function Q0(t,e,l){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=fn(t.nextSibling),t===null))return null;return t}function mp(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=fn(t.nextSibling),t===null))return null;return t}function Bc(t){return t.data==="$?"||t.data==="$~"}function jc(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Z0(t,e){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||l.readyState!=="loading")e();else{var r=function(){e(),l.removeEventListener("DOMContentLoaded",r)};l.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function fn(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var Uc=null;function pp(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(e===0)return fn(t.nextSibling);e--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||e++}t=t.nextSibling}return null}function gp(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(e===0)return t;e--}else l!=="/$"&&l!=="/&"||e++}t=t.previousSibling}return null}function bp(t,e,l){switch(e=Wu(l),t){case"html":if(t=e.documentElement,!t)throw Error(u(452));return t;case"head":if(t=e.head,!t)throw Error(u(453));return t;case"body":if(t=e.body,!t)throw Error(u(454));return t;default:throw Error(u(451))}}function Jr(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);$o(t)}var hn=new Map,yp=new Set;function qu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Vn=z.d;z.d={f:J0,r:tv,D:ev,C:nv,L:lv,m:av,X:iv,S:rv,M:uv};function J0(){var t=Vn.f(),e=Bu();return t||e}function tv(t){var e=ma(t);e!==null&&e.tag===5&&e.type==="form"?zh(e):Vn.r(t)}var Ya=typeof document>"u"?null:document;function vp(t,e,l){var r=Ya;if(r&&typeof e=="string"&&e){var o=an(e);o='link[rel="'+t+'"][href="'+o+'"]',typeof l=="string"&&(o+='[crossorigin="'+l+'"]'),yp.has(o)||(yp.add(o),t={rel:t,crossOrigin:l,href:e},r.querySelector(o)===null&&(e=r.createElement("link"),Re(e,"link",t),ge(e),r.head.appendChild(e)))}}function ev(t){Vn.D(t),vp("dns-prefetch",t,null)}function nv(t,e){Vn.C(t,e),vp("preconnect",t,e)}function lv(t,e,l){Vn.L(t,e,l);var r=Ya;if(r&&t&&e){var o='link[rel="preload"][as="'+an(e)+'"]';e==="image"&&l&&l.imageSrcSet?(o+='[imagesrcset="'+an(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(o+='[imagesizes="'+an(l.imageSizes)+'"]')):o+='[href="'+an(t)+'"]';var s=o;switch(e){case"style":s=Va(t);break;case"script":s=Pa(t)}hn.has(s)||(t=v({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),hn.set(s,t),r.querySelector(o)!==null||e==="style"&&r.querySelector(ti(s))||e==="script"&&r.querySelector(ei(s))||(e=r.createElement("link"),Re(e,"link",t),ge(e),r.head.appendChild(e)))}}function av(t,e){Vn.m(t,e);var l=Ya;if(l&&t){var r=e&&typeof e.as=="string"?e.as:"script",o='link[rel="modulepreload"][as="'+an(r)+'"][href="'+an(t)+'"]',s=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":s=Pa(t)}if(!hn.has(s)&&(t=v({rel:"modulepreload",href:t},e),hn.set(s,t),l.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ei(s)))return}r=l.createElement("link"),Re(r,"link",t),ge(r),l.head.appendChild(r)}}}function rv(t,e,l){Vn.S(t,e,l);var r=Ya;if(r&&t){var o=pa(r).hoistableStyles,s=Va(t);e=e||"default";var p=o.get(s);if(!p){var y={loading:0,preload:null};if(p=r.querySelector(ti(s)))y.loading=5;else{t=v({rel:"stylesheet",href:t,"data-precedence":e},l),(l=hn.get(s))&&Ic(t,l);var E=p=r.createElement("link");ge(E),Re(E,"link",t),E._p=new Promise(function(w,B){E.onload=w,E.onerror=B}),E.addEventListener("load",function(){y.loading|=1}),E.addEventListener("error",function(){y.loading|=2}),y.loading|=4,Yu(p,e,r)}p={type:"stylesheet",instance:p,count:1,state:y},o.set(s,p)}}}function iv(t,e){Vn.X(t,e);var l=Ya;if(l&&t){var r=pa(l).hoistableScripts,o=Pa(t),s=r.get(o);s||(s=l.querySelector(ei(o)),s||(t=v({src:t,async:!0},e),(e=hn.get(o))&&$c(t,e),s=l.createElement("script"),ge(s),Re(s,"link",t),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(o,s))}}function uv(t,e){Vn.M(t,e);var l=Ya;if(l&&t){var r=pa(l).hoistableScripts,o=Pa(t),s=r.get(o);s||(s=l.querySelector(ei(o)),s||(t=v({src:t,async:!0,type:"module"},e),(e=hn.get(o))&&$c(t,e),s=l.createElement("script"),ge(s),Re(s,"link",t),l.head.appendChild(s)),s={type:"script",instance:s,count:1,state:null},r.set(o,s))}}function Sp(t,e,l,r){var o=(o=xt.current)?qu(o):null;if(!o)throw Error(u(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=Va(l.href),l=pa(o).hoistableStyles,r=l.get(e),r||(r={type:"style",instance:null,count:0,state:null},l.set(e,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Va(l.href);var s=pa(o).hoistableStyles,p=s.get(t);if(p||(o=o.ownerDocument||o,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},s.set(t,p),(s=o.querySelector(ti(t)))&&!s._p&&(p.instance=s,p.state.loading=5),hn.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},hn.set(t,l),s||ov(o,t,l,p.state))),e&&r===null)throw Error(u(528,""));return p}if(e&&r!==null)throw Error(u(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=Pa(l),l=pa(o).hoistableScripts,r=l.get(e),r||(r={type:"script",instance:null,count:0,state:null},l.set(e,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(u(444,t))}}function Va(t){return'href="'+an(t)+'"'}function ti(t){return'link[rel="stylesheet"]['+t+"]"}function Ep(t){return v({},t,{"data-precedence":t.precedence,precedence:null})}function ov(t,e,l,r){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?r.loading=1:(e=t.createElement("link"),r.preload=e,e.addEventListener("load",function(){return r.loading|=1}),e.addEventListener("error",function(){return r.loading|=2}),Re(e,"link",l),ge(e),t.head.appendChild(e))}function Pa(t){return'[src="'+an(t)+'"]'}function ei(t){return"script[async]"+t}function Tp(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var r=t.querySelector('style[data-href~="'+an(l.href)+'"]');if(r)return e.instance=r,ge(r),r;var o=v({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),ge(r),Re(r,"style",o),Yu(r,l.precedence,t),e.instance=r;case"stylesheet":o=Va(l.href);var s=t.querySelector(ti(o));if(s)return e.state.loading|=4,e.instance=s,ge(s),s;r=Ep(l),(o=hn.get(o))&&Ic(r,o),s=(t.ownerDocument||t).createElement("link"),ge(s);var p=s;return p._p=new Promise(function(y,E){p.onload=y,p.onerror=E}),Re(s,"link",r),e.state.loading|=4,Yu(s,l.precedence,t),e.instance=s;case"script":return s=Pa(l.src),(o=t.querySelector(ei(s)))?(e.instance=o,ge(o),o):(r=l,(o=hn.get(s))&&(r=v({},l),$c(r,o)),t=t.ownerDocument||t,o=t.createElement("script"),ge(o),Re(o,"link",r),t.head.appendChild(o),e.instance=o);case"void":return null;default:throw Error(u(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(r=e.instance,e.state.loading|=4,Yu(r,l.precedence,t));return e.instance}function Yu(t,e,l){for(var r=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,s=o,p=0;p<r.length;p++){var y=r[p];if(y.dataset.precedence===e)s=y;else if(s!==o)break}s?s.parentNode.insertBefore(t,s.nextSibling):(e=l.nodeType===9?l.head:l,e.insertBefore(t,e.firstChild))}function Ic(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function $c(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var Vu=null;function Rp(t,e,l){if(Vu===null){var r=new Map,o=Vu=new Map;o.set(l,r)}else o=Vu,r=o.get(l),r||(r=new Map,o.set(l,r));if(r.has(t))return r;for(r.set(t,null),l=l.getElementsByTagName(t),o=0;o<l.length;o++){var s=l[o];if(!(s[br]||s[ve]||t==="link"&&s.getAttribute("rel")==="stylesheet")&&s.namespaceURI!=="http://www.w3.org/2000/svg"){var p=s.getAttribute(e)||"";p=t+p;var y=r.get(p);y?y.push(s):r.set(p,[s])}}return r}function xp(t,e,l){t=t.ownerDocument||t,t.head.insertBefore(l,e==="title"?t.querySelector("head > title"):null)}function sv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function _p(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function cv(t,e,l,r){if(l.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var o=Va(r.href),s=e.querySelector(ti(o));if(s){e=s._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=Pu.bind(t),e.then(t,t)),l.state.loading|=4,l.instance=s,ge(s);return}s=e.ownerDocument||e,r=Ep(r),(o=hn.get(o))&&Ic(r,o),s=s.createElement("link"),ge(s);var p=s;p._p=new Promise(function(y,E){p.onload=y,p.onerror=E}),Re(s,"link",r),l.instance=s}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,e),(e=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=Pu.bind(t),e.addEventListener("load",l),e.addEventListener("error",l))}}var Hc=0;function dv(t,e){return t.stylesheets&&t.count===0&&Xu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var r=setTimeout(function(){if(t.stylesheets&&Xu(t,t.stylesheets),t.unsuspend){var s=t.unsuspend;t.unsuspend=null,s()}},6e4+e);0<t.imgBytes&&Hc===0&&(Hc=62500*q0());var o=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Xu(t,t.stylesheets),t.unsuspend)){var s=t.unsuspend;t.unsuspend=null,s()}},(t.imgBytes>Hc?50:800)+e);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function Pu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ku=null;function Xu(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ku=new Map,e.forEach(fv,t),Ku=null,Pu.call(t))}function fv(t,e){if(!(e.state.loading&4)){var l=Ku.get(t);if(l)var r=l.get(null);else{l=new Map,Ku.set(t,l);for(var o=t.querySelectorAll("link[data-precedence],style[data-precedence]"),s=0;s<o.length;s++){var p=o[s];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(l.set(p.dataset.precedence,p),r=p)}r&&l.set(null,r)}o=e.instance,p=o.getAttribute("data-precedence"),s=l.get(p)||r,s===r&&l.set(null,o),l.set(p,o),this.count++,r=Pu.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),s?s.parentNode.insertBefore(o,s.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(o,t.firstChild)),e.state.loading|=4}}var ni={$$typeof:Z,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function hv(t,e,l,r,o,s,p,y,E){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Bo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bo(0),this.hiddenUpdates=Bo(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=s,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=E,this.incompleteTransitions=new Map}function Cp(t,e,l,r,o,s,p,y,E,w,B,$){return t=new hv(t,e,l,p,E,w,B,$,y),e=1,s===!0&&(e|=24),s=Ge(3,null,null,e),t.current=s,s.stateNode=t,e=Ss(),e.refCount++,t.pooledCache=e,e.refCount++,s.memoizedState={element:r,isDehydrated:l,cache:e},xs(s),t}function Ap(t){return t?(t=_a,t):_a}function Op(t,e,l,r,o,s){o=Ap(o),r.context===null?r.context=o:r.pendingContext=o,r=rl(e),r.payload={element:l},s=s===void 0?null:s,s!==null&&(r.callback=s),l=il(t,r,e),l!==null&&(Be(l,t,e),Mr(l,t,e))}function wp(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<e?l:e}}function Gc(t,e){wp(t,e),(t=t.alternate)&&wp(t,e)}function kp(t){if(t.tag===13||t.tag===31){var e=Ul(t,67108864);e!==null&&Be(e,t,67108864),Gc(t,67108864)}}function Dp(t){if(t.tag===13||t.tag===31){var e=Ve();e=jo(e);var l=Ul(t,e);l!==null&&Be(l,t,e),Gc(t,e)}}var Qu=!0;function mv(t,e,l,r){var o=C.T;C.T=null;var s=z.p;try{z.p=2,Fc(t,e,l,r)}finally{z.p=s,C.T=o}}function pv(t,e,l,r){var o=C.T;C.T=null;var s=z.p;try{z.p=8,Fc(t,e,l,r)}finally{z.p=s,C.T=o}}function Fc(t,e,l,r){if(Qu){var o=Wc(r);if(o===null)wc(t,e,r,Zu,l),Np(t,r);else if(bv(o,t,e,l,r))r.stopPropagation();else if(Np(t,r),e&4&&-1<gv.indexOf(t)){for(;o!==null;){var s=ma(o);if(s!==null)switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var p=Nl(s.pendingLanes);if(p!==0){var y=s;for(y.pendingLanes|=2,y.entangledLanes|=2;p;){var E=1<<31-$e(p);y.entanglements[1]|=E,p&=~E}An(s),(Ut&6)===0&&(Mu=Ue()+500,Xr(0))}}break;case 31:case 13:y=Ul(s,2),y!==null&&Be(y,s,2),Bu(),Gc(s,2)}if(s=Wc(r),s===null&&wc(t,e,r,Zu,l),s===o)break;o=s}o!==null&&r.stopPropagation()}else wc(t,e,r,null,l)}}function Wc(t){return t=Yo(t),qc(t)}var Zu=null;function qc(t){if(Zu=null,t=ha(t),t!==null){var e=d(t);if(e===null)t=null;else{var l=e.tag;if(l===13){if(t=f(e),t!==null)return t;t=null}else if(l===31){if(t=h(e),t!==null)return t;t=null}else if(l===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return Zu=t,null}function Lp(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ey()){case Id:return 2;case $d:return 8;case Hi:case ny:return 32;case Hd:return 268435456;default:return 32}default:return 32}}var Yc=!1,bl=null,yl=null,vl=null,li=new Map,ai=new Map,Sl=[],gv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Np(t,e){switch(t){case"focusin":case"focusout":bl=null;break;case"dragenter":case"dragleave":yl=null;break;case"mouseover":case"mouseout":vl=null;break;case"pointerover":case"pointerout":li.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ai.delete(e.pointerId)}}function ri(t,e,l,r,o,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:l,eventSystemFlags:r,nativeEvent:s,targetContainers:[o]},e!==null&&(e=ma(e),e!==null&&kp(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function bv(t,e,l,r,o){switch(e){case"focusin":return bl=ri(bl,t,e,l,r,o),!0;case"dragenter":return yl=ri(yl,t,e,l,r,o),!0;case"mouseover":return vl=ri(vl,t,e,l,r,o),!0;case"pointerover":var s=o.pointerId;return li.set(s,ri(li.get(s)||null,t,e,l,r,o)),!0;case"gotpointercapture":return s=o.pointerId,ai.set(s,ri(ai.get(s)||null,t,e,l,r,o)),!0}return!1}function Mp(t){var e=ha(t.target);if(e!==null){var l=d(e);if(l!==null){if(e=l.tag,e===13){if(e=f(l),e!==null){t.blockedOn=e,Vd(t.priority,function(){Dp(l)});return}}else if(e===31){if(e=h(l),e!==null){t.blockedOn=e,Vd(t.priority,function(){Dp(l)});return}}else if(e===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Ju(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var l=Wc(t.nativeEvent);if(l===null){l=t.nativeEvent;var r=new l.constructor(l.type,l);qo=r,l.target.dispatchEvent(r),qo=null}else return e=ma(l),e!==null&&kp(e),t.blockedOn=l,!1;e.shift()}return!0}function zp(t,e,l){Ju(t)&&l.delete(e)}function yv(){Yc=!1,bl!==null&&Ju(bl)&&(bl=null),yl!==null&&Ju(yl)&&(yl=null),vl!==null&&Ju(vl)&&(vl=null),li.forEach(zp),ai.forEach(zp)}function to(t,e){t.blockedOn===e&&(t.blockedOn=null,Yc||(Yc=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,yv)))}var eo=null;function Bp(t){eo!==t&&(eo=t,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){eo===t&&(eo=null);for(var e=0;e<t.length;e+=3){var l=t[e],r=t[e+1],o=t[e+2];if(typeof r!="function"){if(qc(r||l)===null)continue;break}var s=ma(l);s!==null&&(t.splice(e,3),e-=3,Ws(s,{pending:!0,data:o,method:l.method,action:r},r,o))}}))}function Ka(t){function e(E){return to(E,t)}bl!==null&&to(bl,t),yl!==null&&to(yl,t),vl!==null&&to(vl,t),li.forEach(e),ai.forEach(e);for(var l=0;l<Sl.length;l++){var r=Sl[l];r.blockedOn===t&&(r.blockedOn=null)}for(;0<Sl.length&&(l=Sl[0],l.blockedOn===null);)Mp(l),l.blockedOn===null&&Sl.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(r=0;r<l.length;r+=3){var o=l[r],s=l[r+1],p=o[ke]||null;if(typeof s=="function")p||Bp(l);else if(p){var y=null;if(s&&s.hasAttribute("formAction")){if(o=s,p=s[ke]||null)y=p.formAction;else if(qc(o)!==null)continue}else y=p.action;typeof y=="function"?l[r+1]=y:(l.splice(r,3),r-=3),Bp(l)}}}function jp(){function t(s){s.canIntercept&&s.info==="react-transition"&&s.intercept({handler:function(){return new Promise(function(p){return o=p})},focusReset:"manual",scroll:"manual"})}function e(){o!==null&&(o(),o=null),r||setTimeout(l,20)}function l(){if(!r&&!navigation.transition){var s=navigation.currentEntry;s&&s.url!=null&&navigation.navigate(s.url,{state:s.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(l,100),function(){r=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),o!==null&&(o(),o=null)}}}function Vc(t){this._internalRoot=t}no.prototype.render=Vc.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(u(409));var l=e.current,r=Ve();Op(l,r,t,e,null,null)},no.prototype.unmount=Vc.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Op(t.current,2,null,t,null,null),Bu(),e[fa]=null}};function no(t){this._internalRoot=t}no.prototype.unstable_scheduleHydration=function(t){if(t){var e=Yd();t={blockedOn:null,target:t,priority:e};for(var l=0;l<Sl.length&&e!==0&&e<Sl[l].priority;l++);Sl.splice(l,0,t),l===0&&Mp(t)}};var Up=n.version;if(Up!=="19.2.0")throw Error(u(527,Up,"19.2.0"));z.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(u(188)):(t=Object.keys(t).join(","),Error(u(268,t)));return t=m(e),t=t!==null?b(t):null,t=t===null?null:t.stateNode,t};var vv={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var lo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lo.isDisabled&&lo.supportsFiber)try{mr=lo.inject(vv),Ie=lo}catch{}}return ui.createRoot=function(t,e){if(!c(t))throw Error(u(299));var l=!1,r="",o=qh,s=Yh,p=Vh;return e!=null&&(e.unstable_strictMode===!0&&(l=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onUncaughtError!==void 0&&(o=e.onUncaughtError),e.onCaughtError!==void 0&&(s=e.onCaughtError),e.onRecoverableError!==void 0&&(p=e.onRecoverableError)),e=Cp(t,1,!1,null,null,l,r,null,o,s,p,jp),t[fa]=e.current,Oc(t),new Vc(e)},ui.hydrateRoot=function(t,e,l){if(!c(t))throw Error(u(299));var r=!1,o="",s=qh,p=Yh,y=Vh,E=null;return l!=null&&(l.unstable_strictMode===!0&&(r=!0),l.identifierPrefix!==void 0&&(o=l.identifierPrefix),l.onUncaughtError!==void 0&&(s=l.onUncaughtError),l.onCaughtError!==void 0&&(p=l.onCaughtError),l.onRecoverableError!==void 0&&(y=l.onRecoverableError),l.formState!==void 0&&(E=l.formState)),e=Cp(t,1,!0,e,l??null,r,o,E,s,p,y,jp),e.context=Ap(null),l=e.current,r=Ve(),r=jo(r),o=rl(r),o.callback=null,il(l,o,r),l=r,e.current.lanes=l,gr(e,l),An(e),t[fa]=e.current,Oc(t),new no(e)},ui.version="19.2.0",ui}var Pp;function kv(){if(Pp)return Kc.exports;Pp=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),Kc.exports=wv(),Kc.exports}var Dv=kv(),ht=Jc(),It=Ev(ht);function Kp(i,n){return zv(i)||Mv(i,n)||Nv(i,n)||Lv()}function Lv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
10
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nv(i,n){if(i){if(typeof i=="string")return Xp(i,n);var a={}.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?Xp(i,n):void 0}}function Xp(i,n){(n==null||n>i.length)&&(n=i.length);for(var a=0,u=Array(n);a<n;a++)u[a]=i[a];return u}function Mv(i,n){var a=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(a!=null){var u,c,d,f,h=[],g=!0,m=!1;try{if(d=(a=a.call(i)).next,n===0){if(Object(a)!==a)return;g=!1}else for(;!(g=(u=d.call(a)).done)&&(h.push(u.value),h.length!==n);g=!0);}catch(b){m=!0,c=b}finally{try{if(!g&&a.return!=null&&(f=a.return(),Object(f)!==f))return}finally{if(m)throw c}}return h}}function zv(i){if(Array.isArray(i))return i}var oi={},Qp;function Bv(){if(Qp)return oi;Qp=1,Object.defineProperty(oi,"__esModule",{value:!0}),oi.styleq=void 0;var i=new WeakMap,n="$$css";function a(c){var d,f,h;return c!=null&&(d=c.disableCache===!0,f=c.disableMix===!0,h=c.transform),function(){for(var m=[],b="",v=null,S=d?null:i,A=new Array(arguments.length),M=0;M<arguments.length;M++)A[M]=arguments[M];for(;A.length>0;){var j=A.pop();if(!(j==null||j===!1)){if(Array.isArray(j)){for(var N=0;N<j.length;N++)A.push(j[N]);continue}var W=h!=null?h(j):j;if(W.$$css){var F="";if(S!=null&&S.has(W)){var Z=S.get(W);Z!=null&&(F=Z[0],m.push.apply(m,Z[1]),S=Z[2])}else{var J=[];for(var ut in W){var q=W[ut];ut!==n&&(typeof q=="string"||q===null?m.includes(ut)||(m.push(ut),S!=null&&J.push(ut),typeof q=="string"&&(F+=F?" "+q:q)):console.error("styleq: ".concat(ut," typeof ").concat(String(q),' is not "string" or "null".')))}if(S!=null){var k=new WeakMap;S.set(W,[F,J,k]),S=k}}F&&(b=b?F+" "+b:F)}else if(f)v==null&&(v={}),v=Object.assign({},W,v);else{var Y=null;for(var pt in W){var Rt=W[pt];Rt!==void 0&&(m.includes(pt)||(Rt!=null&&(v==null&&(v={}),Y==null&&(Y={}),Y[pt]=Rt),m.push(pt),S=null))}Y!=null&&(v=Object.assign(Y,v))}}}var et=[b,v];return et}}var u=a();return oi.styleq=u,u.factory=a,oi}var Zp=Bv(),Ql=function(n){return new Error("'stylex.".concat(n,"' should never be called at runtime. It should be compiled away by '@stylexjs/babel-plugin'"))},Pe=function(n){return Ql("types.".concat(n))};function ye(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var u=Zp.styleq(n),c=Kp(u,2),d=c[0],f=c[1],h={};return d!=null&&d!==""&&(h.className=d),f!=null&&Object.keys(f).length>0&&(h.style=f),h}function jv(){var i=ye.apply(void 0,arguments),n=i.className,a=i.style,u={};return n!=null&&n!==""&&(u.class=n),a!=null&&Object.keys(a).length>0&&(u.style=Object.keys(a).map(function(c){return"".concat(c,":").concat(a[c],";")}).join("")),u}function Uv(i){throw Ql("create")}function Iv(i){throw Ql("defineVars")}var $v=function(n,a){throw Ql("createTheme")},Hv=function(n){throw Ql("include")},Gv=Uv,Fv=Iv,Wv=$v,qv=Hv,Yv={angle:function(n){throw Pe("angle")},color:function(n){throw Pe("color")},url:function(n){throw Pe("url")},image:function(n){throw Pe("image")},integer:function(n){throw Pe("integer")},lengthPercentage:function(n){throw Pe("lengthPercentage")},length:function(n){throw Pe("length")},percentage:function(n){throw Pe("percentage")},number:function(n){throw Pe("number")},resolution:function(n){throw Pe("resolution")},time:function(n){throw Pe("time")},transformFunction:function(n){throw Pe("transformFunction")},transformList:function(n){throw Pe("transformList")}},Vv=function(n){throw Ql("keyframes")},Pv=function(){throw Ql("firstThatWorks")};function vn(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var u=Zp.styleq(n),c=Kp(u,1),d=c[0];return d}vn.props=ye,vn.attrs=jv,vn.create=Gv,vn.defineVars=Fv,vn.createTheme=Wv,vn.include=qv,vn.keyframes=Vv,vn.firstThatWorks=Pv,vn.types=Yv;var Kv=["children","bold","underline","variant"],Xv=["children"];function si(i){"@babel/helpers - typeof";return si=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},si(i)}function Jp(i,n){if(i==null)return{};var a,u,c=Qv(i,n);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(i);for(u=0;u<d.length;u++)a=d[u],n.indexOf(a)===-1&&{}.propertyIsEnumerable.call(i,a)&&(c[a]=i[a])}return c}function Qv(i,n){if(i==null)return{};var a={};for(var u in i)if({}.hasOwnProperty.call(i,u)){if(n.indexOf(u)!==-1)continue;a[u]=i[u]}return a}function tg(i,n){return eS(i)||tS(i,n)||Jv(i,n)||Zv()}function Zv(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
11
11
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jv(i,n){if(i){if(typeof i=="string")return eg(i,n);var a={}.toString.call(i).slice(8,-1);return a==="Object"&&i.constructor&&(a=i.constructor.name),a==="Map"||a==="Set"?Array.from(i):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?eg(i,n):void 0}}function eg(i,n){(n==null||n>i.length)&&(n=i.length);for(var a=0,u=Array(n);a<n;a++)u[a]=i[a];return u}function tS(i,n){var a=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(a!=null){var u,c,d,f,h=[],g=!0,m=!1;try{if(d=(a=a.call(i)).next,n!==0)for(;!(g=(u=d.call(a)).done)&&(h.push(u.value),h.length!==n);g=!0);}catch(b){m=!0,c=b}finally{try{if(!g&&a.return!=null&&(f=a.return(),Object(f)!==f))return}finally{if(m)throw c}}return h}}function eS(i){if(Array.isArray(i))return i}function ng(i,n){var a=Object.keys(i);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(i);n&&(u=u.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),a.push.apply(a,u)}return a}function Gt(i){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?ng(Object(a),!0).forEach(function(u){nS(i,u,a[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):ng(Object(a)).forEach(function(u){Object.defineProperty(i,u,Object.getOwnPropertyDescriptor(a,u))})}return i}function nS(i,n,a){return(n=lS(n))in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a,i}function lS(i){var n=aS(i,"string");return si(n)=="symbol"?n:n+""}function aS(i,n){if(si(i)!="object"||!i)return i;var a=i[Symbol.toPrimitive];if(a!==void 0){var u=a.call(i,n);if(si(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}var lg=ht.createContext(null),Tl=function(){var n=ht.useContext(lg);if(!n)throw new Error("useThemeTokens must be used within a ThemeProvider");return n},ao={base:{transformOrigin:"nura1g0ag68",cursor:"nura1ypdohk",$$css:!0},up:{transform:"nura7p49u4",$$css:!0},right:{transform:"nura1iffjtl",$$css:!0},down:{transform:"nura19jd1h0",$$css:!0},left:{transform:"nura9tu13d",$$css:!0},animate:function(n){return[{transition:"transform ".concat(n)==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--transition":"transform ".concat(n)!=null?"transform ".concat(n):void 0}]},disabled:{cursor:"nura1h6gzvc",$$css:!0}},rS=function(n){var a=n.width,u=a===void 0?"48px":a,c=n.height,d=c===void 0?"48px":c,f=n.strokeColor,h=n.direction,g=h===void 0?"right":h,m=n.animate,b=n.disabled,v=Tl(),S=v.theme,A=S.transitionTokens;return It.createElement("svg",Gt({xmlns:"http://www.w3.org/2000/svg",width:u,height:d,viewBox:"0 0 24 24",fill:"none"},vn.props(ao.base,ao[g],m&&ao.animate(A.slow),b&&ao.disabled)),It.createElement("rect",{width:"24",height:"24",fill:"none"}),It.createElement("path",{d:"M17 14.5L12 9.5L7 14.5",stroke:f??S.colorTokens.textPrimary,strokeLinecap:"round",strokeLinejoin:"round"}))},ag=function(n,a,u){return a.includes(n)?n:u},Zl={base:function(n,a,u,c,d,f,h,g,m){return[{fontFamily:n==null?null:"nurat1x0nq",fontSize:a==null?null:"nura6zurak",fontWeight:u==null?null:"nura1oq5gaa",borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,padding:"".concat(f," ").concat(d)==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,backgroundColor:h==null?null:"nurar5ldyu",color:g==null?null:"nurafx01vb",border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,display:"nura3nfvp2",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",gap:"nura13z6uf9",rowGap:null,columnGap:null,lineHeight:"nura1uo3zyz",transition:m==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,textDecoration:"nura1hl2dhg",textDecorationColor:null,textDecorationLine:null,textDecorationStyle:null,textDecorationThickness:null,$$css:!0},{"--fontFamily":n??void 0,"--fontSize":(function(b){return typeof b=="number"?b+"px":b??void 0})(a),"--fontWeight":u??void 0,"--borderRadius":(function(b){return typeof b=="number"?b+"px":b??void 0})(c),"--padding":(function(b){return typeof b=="number"?b+"px":b??void 0})("".concat(f," ").concat(d)),"--backgroundColor":h??void 0,"--color":g??void 0,"--transition":m??void 0}]},outline:function(n,a,u,c,d,f,h,g,m){return[{fontFamily:n==null?null:"nurat1x0nq",fontSize:a==null?null:"nura6zurak",fontWeight:u==null?null:"nura1oq5gaa",borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,padding:"".concat(f," ").concat(d)==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,backgroundColor:"nurajbqb8w",color:h==null?null:"nurafx01vb",border:"1px solid ".concat(g)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,display:"nura3nfvp2",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",gap:"nura13z6uf9",rowGap:null,columnGap:null,lineHeight:"nura1uo3zyz",transition:m==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--fontFamily":n??void 0,"--fontSize":(function(b){return typeof b=="number"?b+"px":b??void 0})(a),"--fontWeight":u??void 0,"--borderRadius":(function(b){return typeof b=="number"?b+"px":b??void 0})(c),"--padding":(function(b){return typeof b=="number"?b+"px":b??void 0})("".concat(f," ").concat(d)),"--color":h??void 0,"--border":(function(b){return typeof b=="number"?b+"px":b??void 0})("1px solid ".concat(g)),"--transition":m??void 0}]},link:function(n,a,u,c,d){return[{fontFamily:n==null?null:"nurat1x0nq",fontSize:a==null?null:"nura6zurak",fontWeight:u==null?null:"nura1oq5gaa",backgroundColor:"nurajbqb8w",color:c==null?null:"nurafx01vb",border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,padding:"nura1717udv",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,lineHeight:"nura1uo3zyz",display:"nura3nfvp2",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",transition:d==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,":hover_textDecoration":"nurat0b8zv",":hover_textDecorationColor":null,":hover_textDecorationLine":null,":hover_textDecorationStyle":null,":hover_textDecorationThickness":null,$$css:!0},{"--fontFamily":n??void 0,"--fontSize":(function(f){return typeof f=="number"?f+"px":f??void 0})(a),"--fontWeight":u??void 0,"--color":c??void 0,"--transition":d??void 0}]},hover:{":hover_filter":"nurakapau0",":hover_cursor":"nura1277o0a",$$css:!0},active:{":active_filter":"nura19y0ph4",$$css:!0},disabled:{cursor:"nura1h6gzvc",opacity:"nura197sbye",$$css:!0},iconOnly:function(n){return[{width:n==null?null:"nura1bl4301",height:n==null?null:"nura1f5funs",padding:"nura1717udv",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,justifyContent:"nural56j7k",$$css:!0},{"--width":(function(a){return typeof a=="number"?a+"px":a??void 0})(n),"--height":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]}},ed=function(n){var a=n.variant,u=a===void 0?"primary":a,c=n.size,d=c===void 0?"md":c,f=n.type,h=f===void 0?"button":f,g=n.icon,m=n.iconOnly,b=n.onClick,v=n.width,S=n.children,A=n.disabled,M=Tl(),j=M.base,N=M.theme,W=N.fontSizeTokens,F=N.fontTokens,Z=N.borderRadiusTokens,J=N.transitionTokens,ut=N.colorTokens,q=N.sizeTokens,k=u==="outline",Y=u==="link",pt={sm:{px:q.xs,py:q.xs,fontSize:W.s},md:{px:q.s,py:q.xs,fontSize:W.base},lg:{px:q.m,py:q.s,fontSize:W.m}},Rt=ag(d,["sm","md","lg"],"md"),et=pt[Rt],tt=ag(u,["success","danger","warning","primary"],"primary"),At=k||Y?"transparent":ut[tt],Q=k?ut.textPrimary:ut.textSecondary,V=J.slow,C;return Y?C=Zl.link(F.family,et.fontSize,F.weightMedium,ut.textPrimary,V):k?C=Zl.outline(F.family,et.fontSize,F.weightMedium,Z.extraLarge,et.px,et.py,Q,ut.outline,V):C=Zl.base(F.family,et.fontSize,F.weightMedium,Z.extraLarge,et.px,et.py,At,Q,V),It.createElement("button",Gt(Gt({"data-testid":"Button",type:h,onClick:b,disabled:A},ye(j.functionStyles.setWidth(v),C,!A&&Zl.hover,!A&&Zl.active,A&&Zl.disabled,m&&Zl.iconOnly(et.px))),m?{"aria-label":typeof S=="string"?S:"Icon button"}:{}),It.createElement("div",Gt({},{className:"nura78zum5 nura6s0dn4 nural56j7k nurah8yej3 nura13z6uf9"}),g&&It.createElement("span",Gt({},{className:"nura3nfvp2 nura6s0dn4"}),g),!m&&S))},rg={wrapper:function(n){return[{display:"nura3nfvp2",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",width:n==null?null:"nura1bl4301",height:n==null?null:"nura1f5funs",position:"nura1n2onr6",$$css:!0},{"--width":(function(a){return typeof a=="number"?a+"px":a??void 0})(n),"--height":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},svg:function(n){return[{width:"nurah8yej3",height:"nura5yr21d",color:n==null?null:"nurafx01vb",$$css:!0},{"--color":n??void 0}]}},ci=function(n){var a=n.small,u=Tl(),c=u.theme,d=a?c.sizeTokens.xl:c.sizeTokens.xxl,f=c.colorTokens.primary;return It.createElement("div",Gt(Gt({role:"status"},ye(rg.wrapper(d))),{},{"data-testid":"Loading"}),It.createElement("svg",Gt({"aria-hidden":"true",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},ye(rg.svg(f))),It.createElement("path",{d:"M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z",fill:f,opacity:.25}),It.createElement("path",{d:"M12,4a8,8,0,0,1,7.89,6.7A1.53,1.53,0,0,0,21.38,12h0a1.5,1.5,0,0,0,1.48-1.75,11,11,0,0,0-21.72,0A1.5,1.5,0,0,0,2.62,12h0a1.53,1.53,0,0,0,1.49-1.3A8,8,0,0,1,12,4Z",fill:f},It.createElement("animateTransform",{attributeName:"transform",type:"rotate",dur:"0.75s",values:"0 12 12;360 12 12",repeatCount:"indefinite"}))))},ig={base:function(n){return[{overflowWrap:"nura1mzt3pk",color:n==null?null:"nurafx01vb",$$css:!0},{"--color":n??void 0}]},underline:{textDecoration:"nura1bvjpef",textDecorationColor:null,textDecorationLine:null,textDecorationStyle:null,textDecorationThickness:null,$$css:!0}},iS=function(n){var a=n.children,u=n.bold,c=n.underline,d=n.variant,f=Jp(n,Kv),h=Tl(),g=h.theme,m=h.base,b=d==="error"?g.colorTokens.danger:g.colorTokens.textPrimary;return It.createElement("div",Gt(Gt({},f),ye(ig.base(b),u&&m.functionStyles.setFontWeight(g.fontTokens.weightBold),c?ig.underline:null)),a)},uS={base:{marginTop:"nuradj266r",$$css:!0}},ug=function(n){var a=n.children,u=Jp(n,Xv),c=Tl(),d=c.theme,f=c.base;return It.createElement(iS,Gt(Gt({},u),ye(uS.base,f.functionStyles.setMarginBottom(d.spaceTokens["3.5"]))),a)},oS=function(n){var a=n.percentage,u=n.width,c=u===void 0?"100%":u,d=n.label,f=Tl(),h=f.theme,g=f.base,m=g.functionStyles,b=h.borderRadiusTokens,v=h.transitionTokens,S=h.fontSizeTokens,A=h.sizeTokens,M=h.colorTokens,j=h.spaceTokens,N=Number.isFinite(a)?a:0,W=Math.round(Math.min(Math.max(N,0),100));return It.createElement("div",Gt(Gt({},ye(m.progressSetContainer(c))),{},{"data-testid":"progressContainer"}),d&&It.createElement("div",Gt({},ye(m.progressLabel(M.textPrimary,S.m,j[1]))),It.createElement("span",null,d)),It.createElement("div",Gt({},ye(m.progressWrapper(j[2]))),It.createElement("progress",Gt(Gt({},ye(m.progressElement(A.m,b.large),m.trackFill(M.backgroundTertiary,b.large),m.progressFill(M.primary,b.large,v.slow))),{},{"data-testid":"progressBar",value:W,max:100})),It.createElement("span",Gt({},ye(m.progressPercentageLabel(S.s,M.textPrimary,v.slow))),W,"%")))},sS={triggerText:function(n){return[{color:n==null?null:"nurafx01vb",overflow:"nurab3r6kr",overflowX:null,overflowY:null,textOverflow:"nuralyipyv",whiteSpace:"nurauxw1ft",$$css:!0},{"--color":n??void 0}]}},cS=function(n){var a,u,c=n.options,d=c===void 0?[]:c,f=n.width,h=f===void 0?"300px":f,g=n.placeholder,m=g===void 0?"":g,b=n.emptyMessage,v=b===void 0?"":b,S=n.onChange,A=n.value,M=n.disabled,j=Tl(),N=j.theme,W=j.base,F=W.functionStyles,Z=N.elevationTokens,J=N.borderRadiusTokens,ut=N.shadowTokens,q=N.spaceTokens,k=N.colorTokens,Y=ht.useState(!1),pt=tg(Y,2),Rt=pt[0],et=pt[1],tt=ht.useState(null),At=tg(tt,2),Q=At[0],V=At[1],C=ht.useRef(null);ht.useEffect(function(){var ft=function(U){C.current&&!C.current.contains(U.target)&&et(!1)};return document.addEventListener("mousedown",ft),function(){document.removeEventListener("mousedown",ft)}},[]);var z=function(T){et(!1),S?.(T)},X=function(){M||et(!Rt)},P=A===null?m:(a=d==null||(u=d.find(function(ft){return ft.value===A}))===null||u===void 0?void 0:u.label)!==null&&a!==void 0?a:m;return It.createElement("div",Gt({ref:C},ye(F.selectContainer(h))),It.createElement("button",Gt(Gt({type:"button"},ye(F.selectTrigger(k.backgroundPrimary,"".concat(q[2]," ").concat(q[4]),k.borderPrimary,J.large),!M&&Rt&&F.selectTriggerHover(k.backgroundSecondary),M&&F.selectTriggerDisabled(k.backgroundSecondary))),{},{onClick:X,disabled:M,"aria-haspopup":"listbox","aria-expanded":Rt}),It.createElement("span",Gt({},ye(sS.triggerText(k.textPrimary))),P??m),It.createElement(rS,{width:"18px",height:"18px",direction:Rt?"up":"down",animate:!0})),Rt&&It.createElement("ul",Gt(Gt({},ye(F.selectDropdown(k.backgroundPrimary,Z[50],q[1],k.borderPrimary,J.medium,ut.medium))),{},{role:"listbox"}),d?.map(function(ft,T){return It.createElement("li",Gt(Gt({key:ft.value},ye(F.selectOption(k.textPrimary,"".concat(q[2]," ").concat(q[4])),Q===T&&F.selectOptionHover(k.backgroundSecondary),A===ft.value&&F.selectOptionSelected(k.primary,k.textHighlight))),{},{onClick:function(){return z(ft.value)},onMouseEnter:function(){return V(T)},onMouseLeave:function(){return V(null)},role:"option","aria-selected":A===ft.value}),ft.label)}),d?.length===0&&It.createElement("li",Gt({},ye(F.selectEmptyOption("".concat(q[2]," ").concat(q[4])))),v)))},dS={outer:function(n,a,u,c){return[{backgroundColor:n==null?null:"nurar5ldyu",padding:a==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,height:u==null?null:"nura1f5funs",fontFamily:c==null?null:"nurat1x0nq",$$css:!0},{"--backgroundColor":n??void 0,"--padding":(function(d){return typeof d=="number"?d+"px":d??void 0})(a),"--height":(function(d){return typeof d=="number"?d+"px":d??void 0})(u),"--fontFamily":c??void 0}]}},fS=function(n){var a=n.children,u=n.height,c=u===void 0?"100%":u,d=n.padding,f=Tl(),h=f.theme,g=h.colorTokens,m=h.spaceTokens,b=h.fontTokens;return It.createElement("div",Gt({},vn.props(dS.outer(g.backgroundPrimary,d??m[0],c,b.family))),a)},hS={absolute:{position:"nura10l6tqk",$$css:!0},relative:{position:"nura1n2onr6",$$css:!0},fixed:{position:"nuraixxii4",$$css:!0}},mS={spin:{animationName:"nura1d46cpg",animationDuration:"nura1q3qbx4",animationTimingFunction:"nurajftqhz",animationIterationCount:"nuraa4qsjk",$$css:!0}},pS={setWidth:function(n){return[{width:n==null?null:"nura1bl4301",$$css:!0},{"--width":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setHeight:function(n){return[{height:n==null?null:"nura1f5funs",$$css:!0},{"--height":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setPaddingRight:function(n){return[{paddingRight:n==null?null:"nura1hb41fa",paddingInlineStart:null,paddingInlineEnd:null,$$css:!0},{"--paddingRight":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setMargin:function(n){return[{margin:n==null?null:"nura1cpkpif",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,$$css:!0},{"--margin":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setMarginBottom:function(n){return[{marginBottom:n==null?null:"nura138musq",$$css:!0},{"--marginBottom":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setMarginRight:function(n){return[{marginRight:n==null?null:"nura1hqhkut",marginInlineStart:null,marginInlineEnd:null,$$css:!0},{"--marginRight":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setBorderColor:function(n){return[{borderColor:n==null?null:"nura1u3gezn",borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,$$css:!0},{"--borderColor":n??void 0}]},setColor:function(n){return[{color:n==null?null:"nurafx01vb",$$css:!0},{"--color":n??void 0}]},setPadding:function(n){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,$$css:!0},{"--padding":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},setFontWeight:function(n){return[{fontWeight:n==null?null:"nura1oq5gaa",$$css:!0},{"--fontWeight":n??void 0}]},baseInputWrapper:function(n,a,u,c,d){return[{display:"nura78zum5",alignItems:"nura6s0dn4",border:"1px solid ".concat(n)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:a==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,color:u==null?null:"nurafx01vb",height:c==null?null:"nura1f5funs",backgroundColor:d==null?null:"nurar5ldyu",$$css:!0},{"--border":(function(f){return typeof f=="number"?f+"px":f??void 0})("1px solid ".concat(n)),"--borderRadius":(function(f){return typeof f=="number"?f+"px":f??void 0})(a),"--color":u??void 0,"--height":(function(f){return typeof f=="number"?f+"px":f??void 0})(c),"--backgroundColor":d??void 0}]},baseInputDisabled:function(n,a){return[{borderColor:n==null?null:"nura1u3gezn",borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,backgroundColor:a==null?null:"nurar5ldyu",$$css:!0},{"--borderColor":n??void 0,"--backgroundColor":a??void 0}]},baseInputReadonly:function(n,a,u){return[{borderColor:n==null?null:"nura1u3gezn",borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,backgroundColor:a==null?null:"nurar5ldyu",color:u==null?null:"nurafx01vb",$$css:!0},{"--borderColor":n??void 0,"--backgroundColor":a??void 0,"--color":u??void 0}]},baseInputBase:function(n,a,u,c,d,f,h,g){return[{display:"nura1lliihq",width:"nurah8yej3",flexGrow:"nura1iyjqo2",boxSizing:"nura9f619",height:"nura5yr21d",padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,marginLeft:a==null?null:"nura182mx9v",marginRight:u==null?null:"nura1hqhkut",marginInlineStart:null,marginInlineEnd:null,backgroundColor:"nurajbqb8w",outline:"nura1a2a7pz",outlineColor:null,outlineOffset:null,outlineStyle:null,outlineWidth:null,color:"nura1heor9g "+(c==null?"":"nura1n1bdtd"),fontSize:(d==null?"":"nura1cfcgx7 ")+(d==null?"":"nura1qozda6"),fontFamily:f==null?null:"nurat1x0nq",lineHeight:"nura15bjb6t "+(h==null?"":"nura1uyl9uf"),border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottom:"nura196p5u9",borderBottomWidth:null,borderBottomStyle:null,borderBottomColor:null,transition:g==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,opacity:"nuraq0hk9d nura7xwk5j",$$css:!0},{"--padding":(function(m){return typeof m=="number"?m+"px":m??void 0})(n),"--marginLeft":(function(m){return typeof m=="number"?m+"px":m??void 0})(a),"--marginRight":(function(m){return typeof m=="number"?m+"px":m??void 0})(u),"--bfcyyw":c??void 0,"--19zvkyr":(function(m){return typeof m=="number"?m+"px":m??void 0})(d),"--11q9g2s":(function(m){return typeof m=="number"?m+"px":m??void 0})(d),"--fontFamily":f??void 0,"--1n9e6o4":h??void 0,"--transition":g??void 0}]},baseInputIcon:function(n){return[{float:"nura1faq86j",paddingRight:n==null?null:"nura1hb41fa",paddingInlineStart:null,paddingInlineEnd:null,$$css:!0},{"--paddingRight":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},baseInputInvalidMsg:function(n,a){return[{color:n==null?null:"nurafx01vb",marginTop:a==null?null:"nura17zef60",$$css:!0},{"--color":n??void 0,"--marginTop":(function(u){return typeof u=="number"?u+"px":u??void 0})(a)}]},checkboxContainer:function(n){return[{display:"nura78zum5",alignItems:"nura6s0dn4",gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,cursor:"nura1ypdohk",$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},checkboxSetStyle:function(n,a,u,c,d){return[{width:n==null?null:"nura1bl4301",height:n==null?null:"nura1f5funs",borderColor:a==null?null:"nura1u3gezn",borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,backgroundColor:a==null?null:"nurar5ldyu",color:u==null?null:"nurafx01vb",borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:d==null?null:"nura10ya7sz",$$css:!0},{"--width":(function(f){return typeof f=="number"?f+"px":f??void 0})(n),"--height":(function(f){return typeof f=="number"?f+"px":f??void 0})(n),"--borderColor":a??void 0,"--backgroundColor":a??void 0,"--color":u??void 0,"--borderRadius":(function(f){return typeof f=="number"?f+"px":f??void 0})(c),"--boxShadow":d??void 0}]},checkboxLabel:function(n){return[{cursor:"nura1ypdohk",fontSize:n==null?null:"nura6zurak",$$css:!0},{"--fontSize":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},square:function(n,a){return[{width:n==null?null:"nura1bl4301",height:n==null?null:"nura1f5funs",backgroundColor:a==null?null:"nurar5ldyu",$$css:!0},{"--width":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--height":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--backgroundColor":a??void 0}]},datePickerContainer:function(n,a,u,c,d){return[{position:"nura1n2onr6",width:"nurah8yej3",boxSizing:"nura9f619",padding:"".concat(n," ").concat(a)==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,backgroundColor:u==null?null:"nurar5ldyu",borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:d==null?null:"nura10ya7sz",$$css:!0},{"--padding":(function(f){return typeof f=="number"?f+"px":f??void 0})("".concat(n," ").concat(a)),"--backgroundColor":u??void 0,"--borderRadius":(function(f){return typeof f=="number"?f+"px":f??void 0})(c),"--boxShadow":d??void 0}]},hrSetStyle:function(n,a){return[{color:n==null?null:"nurafx01vb",margin:"".concat(a," auto")==null?null:"nura1cpkpif",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,$$css:!0},{"--color":n??void 0,"--margin":(function(u){return typeof u=="number"?u+"px":u??void 0})("".concat(a," auto"))}]},hrSetBorder:function(n){return[{border:"".concat(n/2,"px solid currentColor")==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:"".concat(n/2,"px")==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,$$css:!0},{"--border":(function(a){return typeof a=="number"?a+"px":a??void 0})("".concat(n/2,"px solid currentColor")),"--borderRadius":(function(a){return typeof a=="number"?a+"px":a??void 0})("".concat(n/2,"px"))}]},labelSetStyle:function(n,a,u,c){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,borderRadius:a==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,lineHeight:u==null?null:"nura18bv5gf",fontSize:c==null?null:"nura6zurak",$$css:!0},{"--padding":(function(d){return typeof d=="number"?d+"px":d??void 0})(n),"--borderRadius":(function(d){return typeof d=="number"?d+"px":d??void 0})(a),"--lineHeight":u??void 0,"--fontSize":(function(d){return typeof d=="number"?d+"px":d??void 0})(c)}]},menuSetStyle:function(n,a,u,c,d,f,h){return[{zIndex:n==null?null:"nurabgtp72",padding:a==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,gap:u==null?null:"nura9ctp7s",rowGap:null,columnGap:null,backgroundColor:c==null?null:"nurar5ldyu",transition:d==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,borderRadius:f==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:h==null?null:"nura10ya7sz",$$css:!0},{"--zIndex":n??void 0,"--padding":(function(g){return typeof g=="number"?g+"px":g??void 0})(a),"--gap":(function(g){return typeof g=="number"?g+"px":g??void 0})(u),"--backgroundColor":c??void 0,"--transition":d??void 0,"--borderRadius":(function(g){return typeof g=="number"?g+"px":g??void 0})(f),"--boxShadow":h??void 0}]},menuItem:function(n){return[{display:"nura78zum5",alignItems:"nura6s0dn4",padding:"nura153ncpu",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,cursor:"nura1ypdohk",":hover_backgroundColor":n==null?null:"nurai7y26s",$$css:!0},{"--b6ve2z":n??void 0}]},pagination:function(n){return[{display:"nura78zum5",listStyle:"nurae8uvvx",listStyleImage:null,listStylePosition:null,listStyleType:null,gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,alignItems:"nura6s0dn4",padding:"nura1717udv",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},paginationButton:function(n,a){return[{display:"nura3nfvp2",justifyContent:"nural56j7k",padding:"nura3ad7fk",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,cursor:"nura1ypdohk",fontSize:a==null?null:"nura6zurak",backgroundColor:"nurajbqb8w",":hover_backgroundColor":n==null?null:"nurai7y26s",$$css:!0},{"--fontSize":(function(u){return typeof u=="number"?u+"px":u??void 0})(a),"--b6ve2z":n??void 0}]},paginationSetColor:function(n){return[{backgroundColor:n==null?null:"nurar5ldyu",":hover_backgroundColor":n==null?null:"nurai7y26s",$$css:!0},{"--backgroundColor":n??void 0,"--b6ve2z":n??void 0}]},popupSetStyle:function(n,a,u,c,d,f,h,g,m){return[{zIndex:n==null?null:"nurabgtp72",width:a==null?null:"nura1bl4301",height:u==null?null:"nura1f5funs",padding:c==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,margin:d==null?null:"nura1cpkpif",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,backgroundColor:f==null?null:"nurar5ldyu",transition:h==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,borderRadius:g==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:m==null?null:"nura10ya7sz",$$css:!0},{"--zIndex":n??void 0,"--width":(function(b){return typeof b=="number"?b+"px":b??void 0})(a),"--height":(function(b){return typeof b=="number"?b+"px":b??void 0})(u),"--padding":(function(b){return typeof b=="number"?b+"px":b??void 0})(c),"--margin":(function(b){return typeof b=="number"?b+"px":b??void 0})(d),"--backgroundColor":f??void 0,"--transition":h??void 0,"--borderRadius":(function(b){return typeof b=="number"?b+"px":b??void 0})(g),"--boxShadow":m??void 0}]},progressSetContainer:function(n){return[{width:n==null?null:"nura1bl4301",position:"nura1n2onr6",display:"nura1lliihq",$$css:!0},{"--width":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},progressElement:function(n,a){return[{appearance:"nurajyslct","-webkit-appearance":"nura1lugfcp",width:"nurah8yej3",height:n==null?null:"nura1f5funs",border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:a==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,overflow:"nurab3r6kr",overflowX:null,overflowY:null,boxSizing:"nura9f619",display:"nura1lliihq",$$css:!0},{"--height":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--borderRadius":(function(u){return typeof u=="number"?u+"px":u??void 0})(a)}]},trackFill:function(n,a){return[{"::-webkit-progress-bar_backgroundColor":n==null?null:"nura1e2xejc","::-webkit-progress-bar_borderRadius":a==null?null:"nura3f1taq","::-webkit-progress-bar_borderStartStartRadius":null,"::-webkit-progress-bar_borderStartEndRadius":null,"::-webkit-progress-bar_borderEndStartRadius":null,"::-webkit-progress-bar_borderEndEndRadius":null,"::-webkit-progress-bar_borderTopLeftRadius":null,"::-webkit-progress-bar_borderTopRightRadius":null,"::-webkit-progress-bar_borderBottomLeftRadius":null,"::-webkit-progress-bar_borderBottomRightRadius":null,backgroundColor:n==null?null:"nurar5ldyu",$$css:!0},{"--1707jpw":n??void 0,"--1qtnpxr":(function(u){return typeof u=="number"?u+"px":u??void 0})(a),"--backgroundColor":n??void 0}]},progressFill:function(n,a,u){return[{"::-webkit-progress-value_backgroundColor":n==null?null:"nurarw78x1","::-webkit-progress-value_borderRadius":a==null?null:"nuravqh90l","::-webkit-progress-value_borderStartStartRadius":null,"::-webkit-progress-value_borderStartEndRadius":null,"::-webkit-progress-value_borderEndStartRadius":null,"::-webkit-progress-value_borderEndEndRadius":null,"::-webkit-progress-value_borderTopLeftRadius":null,"::-webkit-progress-value_borderTopRightRadius":null,"::-webkit-progress-value_borderBottomLeftRadius":null,"::-webkit-progress-value_borderBottomRightRadius":null,"::-webkit-progress-value_transition":"width ".concat(u)==null?null:"nurawsz6jq","::-webkit-progress-value_transitionBehavior":null,"::-webkit-progress-value_transitionDelay":null,"::-webkit-progress-value_transitionDuration":null,"::-webkit-progress-value_transitionProperty":null,"::-webkit-progress-value_transitionTimingFunction":null,"::-moz-progress-bar_backgroundColor":n==null?null:"nurafm7c33","::-moz-progress-bar_borderRadius":a==null?null:"nura1yssc1k","::-moz-progress-bar_borderStartStartRadius":null,"::-moz-progress-bar_borderStartEndRadius":null,"::-moz-progress-bar_borderEndStartRadius":null,"::-moz-progress-bar_borderEndEndRadius":null,"::-moz-progress-bar_borderTopLeftRadius":null,"::-moz-progress-bar_borderTopRightRadius":null,"::-moz-progress-bar_borderBottomLeftRadius":null,"::-moz-progress-bar_borderBottomRightRadius":null,"::-moz-progress-bar_transition":"width ".concat(u)==null?null:"nuradb2nx","::-moz-progress-bar_transitionBehavior":null,"::-moz-progress-bar_transitionDelay":null,"::-moz-progress-bar_transitionDuration":null,"::-moz-progress-bar_transitionProperty":null,"::-moz-progress-bar_transitionTimingFunction":null,$$css:!0},{"--qsce4z":n??void 0,"--d7tndo":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--1jmnyi0":"width ".concat(u)!=null?"width ".concat(u):void 0,"--qce7ng":n??void 0,"--wtu09m":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--1nt0dl9":"width ".concat(u)!=null?"width ".concat(u):void 0}]},progressLabel:function(n,a,u){return[{color:n==null?null:"nurafx01vb",display:"nura78zum5",justifyContent:"nura1qughib",fontSize:a==null?null:"nura6zurak",marginBottom:u==null?null:"nura138musq",$$css:!0},{"--color":n??void 0,"--fontSize":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--marginBottom":(function(c){return typeof c=="number"?c+"px":c??void 0})(u)}]},progressWrapper:function(n){return[{position:"nura1n2onr6",display:"nura78zum5",alignItems:"nura6s0dn4",gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},progressPercentageLabel:function(n,a,u){return[{fontSize:n==null?null:"nura6zurak",color:a==null?null:"nurafx01vb",userSelect:"nura87ps6o",transition:"opacity ".concat(u)==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,display:"nura78zum5",alignItems:"nura6s0dn4",$$css:!0},{"--fontSize":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--color":a??void 0,"--transition":"opacity ".concat(u)!=null?"opacity ".concat(u):void 0}]},radioContainer:function(n){return[{display:"nura78zum5",gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,flexWrap:"nura1a02dak",$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},radioGroupLabel:function(n,a,u){return[{color:n==null?null:"nurafx01vb",fontSize:a==null?null:"nura6zurak",marginBottom:u==null?null:"nura138musq",$$css:!0},{"--color":n??void 0,"--fontSize":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--marginBottom":(function(c){return typeof c=="number"?c+"px":c??void 0})(u)}]},radioLabel:function(n,a,u){return[{color:n==null?null:"nurafx01vb",display:"nura78zum5",alignItems:"nura6s0dn4",gap:a==null?null:"nura9ctp7s",rowGap:null,columnGap:null,cursor:"nura1ypdohk",fontSize:u==null?null:"nura6zurak",margin:"nura1ghz6dp",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,$$css:!0},{"--color":n??void 0,"--gap":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--fontSize":(function(c){return typeof c=="number"?c+"px":c??void 0})(u)}]},radioInputWrapper:function(n,a){return[{width:n==null?null:"nura1bl4301",height:a==null?null:"nura1f5funs",display:"nura78zum5",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",$$css:!0},{"--width":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--height":(function(u){return typeof u=="number"?u+"px":u??void 0})(a)}]},radioInput:function(n,a,u,c,d,f){return[{appearance:"nurajyslct",cursor:"nura1ypdohk",width:"nurah8yej3",height:"nura5yr21d",borderRadius:f==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,border:"1px solid ".concat(n)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,margin:"nura1ghz6dp",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,display:"nura78zum5",alignItems:"nura6s0dn4",justifyContent:"nural56j7k",transition:"nurabsc3gr",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,":checked_borderColor":a==null?null:"nura2rrvy2",":checked_borderInlineColor":null,":checked_borderInlineStartColor":null,":checked_borderLeftColor":null,":checked_borderInlineEndColor":null,":checked_borderRightColor":null,":checked_borderBlockColor":null,":checked_borderTopColor":null,":checked_borderBottomColor":null,":checked_transform":"nuraty55pf",":checked::after_content":"nurapxrid2",":checked::after_position":"nurahfojsi",":checked::after_width":c==null?null:"nura1d0y58x",":checked::after_height":d==null?null:"nura1bhbj3p",":checked::after_backgroundColor":u==null?null:"nura1op3679",":checked::after_borderRadius":f==null?null:"nura1orbjim",":checked::after_borderStartStartRadius":null,":checked::after_borderStartEndRadius":null,":checked::after_borderEndStartRadius":null,":checked::after_borderEndEndRadius":null,":checked::after_borderTopLeftRadius":null,":checked::after_borderTopRightRadius":null,":checked::after_borderBottomLeftRadius":null,":checked::after_borderBottomRightRadius":null,":checked::after_transition":"nuraq2jpy",":checked::after_transitionBehavior":null,":checked::after_transitionDelay":null,":checked::after_transitionDuration":null,":checked::after_transitionProperty":null,":checked::after_transitionTimingFunction":null,$$css:!0},{"--borderRadius":(function(h){return typeof h=="number"?h+"px":h??void 0})(f),"--border":(function(h){return typeof h=="number"?h+"px":h??void 0})("1px solid ".concat(n)),"--1321a2e":a??void 0,"--17ubzzd":(function(h){return typeof h=="number"?h+"px":h??void 0})(c),"--80hhoq":(function(h){return typeof h=="number"?h+"px":h??void 0})(d),"--dzhu9x":u??void 0,"--9tudt6":(function(h){return typeof h=="number"?h+"px":h??void 0})(f)}]},selectContainer:function(n){return[{position:"nura1n2onr6",width:n==null?null:"nura1bl4301",$$css:!0},{"--width":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},selectTrigger:function(n,a,u,c){return[{backgroundColor:n==null?null:"nurar5ldyu",display:"nura78zum5",alignItems:"nura6s0dn4",justifyContent:"nura1qughib",width:"nurah8yej3",padding:a==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,textAlign:"nuradpxx8g",border:"1px solid ".concat(u)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,cursor:"nura1ypdohk",$$css:!0},{"--backgroundColor":n??void 0,"--padding":(function(d){return typeof d=="number"?d+"px":d??void 0})(a),"--border":(function(d){return typeof d=="number"?d+"px":d??void 0})("1px solid ".concat(u)),"--borderRadius":(function(d){return typeof d=="number"?d+"px":d??void 0})(c)}]},selectTriggerHover:function(n){return[{backgroundColor:n==null?null:"nurar5ldyu",$$css:!0},{"--backgroundColor":n??void 0}]},selectTriggerDisabled:function(n){return[{backgroundColor:n==null?null:"nurar5ldyu",cursor:"nura1h6gzvc",$$css:!0},{"--backgroundColor":n??void 0}]},selectDropdown:function(n,a,u,c,d,f){return[{backgroundColor:n==null?null:"nurar5ldyu",position:"nura10l6tqk",zIndex:a==null?null:"nurabgtp72",width:"nurah8yej3",border:"1px solid ".concat(c)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:d==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:f==null?null:"nura10ya7sz",maxHeight:"nura54lwg9",overflow:"nuraysyzu8",overflowX:null,overflowY:null,listStyle:"nurae8uvvx",listStyleImage:null,listStylePosition:null,listStyleType:null,padding:"nura1717udv",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,margin:"nura1ghz6dp",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,$$css:!0},{"--backgroundColor":n??void 0,"--zIndex":a??void 0,"--marginTop":(function(h){return typeof h=="number"?h+"px":h??void 0})(u),"--border":(function(h){return typeof h=="number"?h+"px":h??void 0})("1px solid ".concat(c)),"--borderRadius":(function(h){return typeof h=="number"?h+"px":h??void 0})(d),"--boxShadow":f??void 0}]},selectOption:function(n,a){return[{color:n==null?null:"nurafx01vb",padding:a==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,cursor:"nura1ypdohk",listStyle:"nurae8uvvx",listStyleImage:null,listStylePosition:null,listStyleType:null,$$css:!0},{"--color":n??void 0,"--padding":(function(u){return typeof u=="number"?u+"px":u??void 0})(a)}]},selectOptionHover:function(n){return[{backgroundColor:n==null?null:"nurar5ldyu",$$css:!0},{"--backgroundColor":n??void 0}]},selectOptionSelected:function(n,a){return[{backgroundColor:n==null?null:"nurar5ldyu",color:a==null?null:"nurafx01vb",$$css:!0},{"--backgroundColor":n??void 0,"--color":a??void 0}]},selectEmptyOption:function(n){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,cursor:"nurat0e3qv",listStyle:"nurae8uvvx",listStyleImage:null,listStylePosition:null,listStyleType:null,$$css:!0},{"--padding":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},simpleTableSetBase:function(n,a,u,c){return[{margin:n==null?null:"nura1cpkpif",marginInline:null,marginInlineStart:null,marginLeft:null,marginInlineEnd:null,marginRight:null,marginBlock:null,marginTop:null,marginBottom:null,fontSize:a==null?null:"nura6zurak",borderRadius:u==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:c==null?null:"nura10ya7sz",$$css:!0},{"--margin":(function(d){return typeof d=="number"?d+"px":d??void 0})(n),"--fontSize":(function(d){return typeof d=="number"?d+"px":d??void 0})(a),"--borderRadius":(function(d){return typeof d=="number"?d+"px":d??void 0})(u),"--boxShadow":c??void 0}]},simpleTableSetHeader:function(n,a){return[{backgroundColor:n==null?null:"nurar5ldyu",fontWeight:a==null?null:"nura1oq5gaa",$$css:!0},{"--backgroundColor":n??void 0,"--fontWeight":a??void 0}]},setTableRow:function(n){return[{":hover_backgroundColor":n==null?null:"nurai7y26s",cursor:"nura1ypdohk",$$css:!0},{"--b6ve2z":n??void 0}]},setTableHeader:function(n,a){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,color:a==null?null:"nurafx01vb",$$css:!0},{"--padding":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--color":a??void 0}]},tablePaginationRoot:function(n){return[{display:"nura78zum5",justifyContent:"nura1qughib",alignItems:"nura6s0dn4",padding:"nura1ff1495",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,borderTop:"nura4jxkzx",borderTopWidth:null,borderTopStyle:null,borderTopColor:null,fontSize:n==null?null:"nura6zurak",$$css:!0},{"--fontSize":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},tablePaginationButton:function(n){return[{padding:"nuradqdrvq",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,borderRadius:"nura12oqio5",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,border:"nuratfardp",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,background:"nura1r7xphn",backgroundAttachment:null,backgroundClip:null,backgroundColor:null,backgroundImage:null,backgroundOrigin:null,backgroundPosition:null,backgroundPositionX:null,backgroundPositionY:null,backgroundRepeat:null,backgroundSize:null,cursor:"nura1ypdohk",":hover_backgroundColor":"nura1su88jy",fontSize:n==null?null:"nura6zurak",$$css:!0},{"--fontSize":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},tablePaginationDropdown:function(n){return[{padding:"nurafawy5m",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,borderRadius:"nura12oqio5",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,border:"nuratfardp",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,cursor:"nura1ypdohk",fontSize:n==null?null:"nura6zurak",$$css:!0},{"--fontSize":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},verificationInputWrapper:function(n){return[{display:"nura78zum5",justifyContent:"nura1nhvcw1",alignItems:"nura6s0dn4",gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},verificationInput:function(n,a,u,c){return[{border:"nurawyvkli",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,backgroundColor:n==null?null:"nurar5ldyu",textAlign:"nura2b8uid",height:"nurang8ra",width:"nura100vrsf",fontSize:"nuraceuqb6",borderRadius:u==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,boxShadow:c==null?null:"nura10ya7sz",transition:"nuravewczl",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,":focus_outline":"nura1uvtmcs",":focus_outlineColor":null,":focus_outlineOffset":null,":focus_outlineStyle":null,":focus_outlineWidth":null,":focus_borderColor":a==null?null:"nura6zkjsx",":focus_borderInlineColor":null,":focus_borderInlineStartColor":null,":focus_borderLeftColor":null,":focus_borderInlineEndColor":null,":focus_borderRightColor":null,":focus_borderBlockColor":null,":focus_borderTopColor":null,":focus_borderBottomColor":null,$$css:!0},{"--backgroundColor":n??void 0,"--borderRadius":(function(d){return typeof d=="number"?d+"px":d??void 0})(u),"--boxShadow":c??void 0,"--1qs960s":a??void 0}]},loadStyles:function(n,a,u,c){return[{"::before_content":"nura1cpjm7i","::before_position":"nura1hmns74","::before_top":"nura1y3wzot","::before_left":"nura1wlytlt","::before_insetInlineStart":null,"::before_insetInlineEnd":null,"::before_width":n==null?null:"nuragu5zj8","::before_height":a==null?null:"nura1kta83a","::before_overflow":"nura1xb3ux","::before_overflowX":null,"::before_overflowY":null,"::before_boxSizing":"nuratql2tq","::before_transformOrigin":"nura7tg5rq","::before_borderTopLeftRadius":n==null?null:"nurabq7gxb","::before_borderStartStartRadius":null,"::before_borderStartEndRadius":null,"::before_borderBottomLeftRadius":n==null?null:"nura171sez1","::before_borderEndStartRadius":null,"::before_borderEndEndRadius":null,"::before_borderWidth":u==null?null:"nura7xrjf5","::before_borderInlineWidth":null,"::before_borderInlineStartWidth":null,"::before_borderLeftWidth":null,"::before_borderInlineEndWidth":null,"::before_borderRightWidth":null,"::before_borderBlockWidth":null,"::before_borderTopWidth":null,"::before_borderBottomWidth":null,"::before_borderColor":c==null?null:"nuratb5x6d","::before_borderInlineColor":null,"::before_borderLeftColor":null,"::before_borderBlockColor":null,"::before_borderTopColor":null,"::before_borderBottomColor":null,"::before_borderStyle":"nura1fo1fc9","::before_borderInlineStyle":null,"::before_borderInlineStartStyle":null,"::before_borderLeftStyle":null,"::before_borderInlineEndStyle":null,"::before_borderRightStyle":null,"::before_borderBlockStyle":null,"::before_borderTopStyle":null,"::before_borderBottomStyle":null,"::before_borderRightColor":"nura166ybda","::before_borderInlineStartColor":null,"::before_borderInlineEndColor":null,$$css:!0},{"--nzppn4":(function(d){return typeof d=="number"?d+"px":d??void 0})(n),"--1whluux":(function(d){return typeof d=="number"?d+"px":d??void 0})(a),"--1mwu8c8":(function(d){return typeof d=="number"?d+"px":d??void 0})(n),"--ucnkut":(function(d){return typeof d=="number"?d+"px":d??void 0})(n),"--8xd4a5":(function(d){return typeof d=="number"?d+"px":d??void 0})(u),"--1il6zln":c??void 0}]},smallSpan:function(n,a,u){return[{"::before_width":n==null?null:"nuragu5zj8","::before_height":a==null?null:"nura1kta83a","::before_borderWidth":u==null?null:"nura7xrjf5","::before_borderInlineWidth":null,"::before_borderInlineStartWidth":null,"::before_borderLeftWidth":null,"::before_borderInlineEndWidth":null,"::before_borderRightWidth":null,"::before_borderBlockWidth":null,"::before_borderTopWidth":null,"::before_borderBottomWidth":null,$$css:!0},{"--nzppn4":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--1whluux":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--8xd4a5":(function(c){return typeof c=="number"?c+"px":c??void 0})(u)}]},setWrapper:function(n,a){return[{width:n==null?null:"nura1bl4301",height:a==null?null:"nura1f5funs",$$css:!0},{"--width":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--height":(function(u){return typeof u=="number"?u+"px":u??void 0})(a)}]},container:function(n,a){return[{borderBottom:"1px solid ".concat(a)==null?null:"nura18y4gbw",borderBottomWidth:null,borderBottomStyle:null,borderBottomColor:null,width:n==null?null:"nura1bl4301",$$css:!0},{"--borderBottom":(function(u){return typeof u=="number"?u+"px":u??void 0})("1px solid ".concat(a)),"--width":(function(u){return typeof u=="number"?u+"px":u??void 0})(n)}]},header:function(n){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,cursor:"nura1ypdohk",display:"nura78zum5",justifyContent:"nura1qughib",alignItems:"nura6s0dn4",width:"nurah8yej3",":hover_textDecoration":"nurat0b8zv",":hover_textDecorationColor":null,":hover_textDecorationLine":null,":hover_textDecorationStyle":null,":hover_textDecorationThickness":null,$$css:!0},{"--padding":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},title:function(n,a){return[{fontSize:n==null?null:"nura6zurak",textDecoration:"nura1hl2dhg",textDecorationColor:null,textDecorationLine:null,textDecorationStyle:null,textDecorationThickness:null,transition:"text-decoration ".concat(a)==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--fontSize":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--transition":"text-decoration ".concat(a)!=null?"text-decoration ".concat(a):void 0}]},contentWrapper:function(n,a){return[{maxHeight:n==null?null:"nura1kb659o",overflow:"nurab3r6kr",overflowX:null,overflowY:null,transition:"max-height ".concat(a)==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--maxHeight":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--transition":"max-height ".concat(a)!=null?"max-height ".concat(a):void 0}]},contentInner:function(n){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,$$css:!0},{"--padding":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},btnBase:function(n,a){return[{position:"nura1n2onr6",display:"nura3nfvp2",justifyContent:"nural56j7k",alignItems:"nura6s0dn4",flexShrink:"nura2lah0s",textAlign:"nura2b8uid",textDecoration:"nura1hl2dhg",textDecorationColor:null,textDecorationLine:null,textDecorationStyle:null,textDecorationThickness:null,border:"1px solid ".concat(n)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,minWidth:"nuraktpd3l",cursor:"nura1ypdohk",transition:"filter ".concat(a)==null?null:"nura10nilei",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--border":(function(u){return typeof u=="number"?u+"px":u??void 0})("1px solid ".concat(n)),"--transition":"filter ".concat(a)!=null?"filter ".concat(a):void 0}]},setBtnStyle:function(n,a,u,c,d,f,h,g,m,b){return[{letterSpacing:n==null?null:"nurac9pu9e",borderRadius:a==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,lineHeight:u==null?null:"nura18bv5gf",padding:c==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,transitionDuration:d==null?null:"nura1nbtrm7",fontFamily:f==null?null:"nurat1x0nq",fontSize:h==null?null:"nura6zurak",fontWeight:g==null?null:"nura1oq5gaa",backgroundColor:m==null?null:"nurar5ldyu",color:b==null?null:"nurafx01vb",$$css:!0},{"--letterSpacing":(function(v){return typeof v=="number"?v+"px":v??void 0})(n),"--borderRadius":(function(v){return typeof v=="number"?v+"px":v??void 0})(a),"--lineHeight":u??void 0,"--padding":(function(v){return typeof v=="number"?v+"px":v??void 0})(c),"--transitionDuration":(function(v){return typeof v=="number"?v+"ms":v??void 0})(d),"--fontFamily":f??void 0,"--fontSize":(function(v){return typeof v=="number"?v+"px":v??void 0})(h),"--fontWeight":g??void 0,"--backgroundColor":m??void 0,"--color":b??void 0}]},setHeadingStyle:function(n,a){return[{marginBottom:n==null?null:"nura138musq",lineHeight:+a==null?null:"nura18bv5gf",$$css:!0},{"--marginBottom":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--lineHeight":+a!=null?+a:void 0}]},modal:function(n){return[{position:"nura10l6tqk",inset:"nura10a8y8t",insetInline:null,insetInlineStart:null,insetInlineEnd:null,left:null,right:null,insetBlock:null,top:null,bottom:null,display:"nurarvj5dj",zIndex:n==null?null:"nurabgtp72",pointerEvents:"nura47corl",opacity:"nurag01cxk",transition:"nurak82a7y",transitionBehavior:null,transitionDelay:null,transitionDuration:null,transitionProperty:null,transitionTimingFunction:null,$$css:!0},{"--zIndex":n??void 0}]},iconContainer:function(n){return[{display:"nura78zum5",alignItems:"nura6s0dn4",gap:n==null?null:"nura9ctp7s",rowGap:null,columnGap:null,$$css:!0},{"--gap":(function(a){return typeof a=="number"?a+"px":a??void 0})(n)}]},dialog:function(n,a,u){return[{position:"nuraixxii4",justifyContent:"nural56j7k",alignItems:"nura6s0dn4 nura4vx8n7",backgroundColor:"nura12peec7",borderRadius:n==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,border:"1px solid ".concat(u)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,padding:"nura1717udv",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,overflow:"nurab3r6kr",overflowX:null,overflowY:null,maxWidth:"nura65f84u",width:"nurah8yej3",boxShadow:a==null?null:"nura10ya7sz",paddingBottom:"nura18d9i69 nura8w9acq",$$css:!0},{"--borderRadius":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--border":(function(c){return typeof c=="number"?c+"px":c??void 0})("1px solid ".concat(u)),"--boxShadow":a??void 0}]},headerCloseBtn:function(n,a,u){return[{cursor:"nura1ypdohk",background:"nura11g6tue",backgroundAttachment:null,backgroundClip:null,backgroundColor:null,backgroundImage:null,backgroundOrigin:null,backgroundPosition:null,backgroundPositionX:null,backgroundPositionY:null,backgroundRepeat:null,backgroundSize:null,border:"nura1gs6z28",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,borderRadius:n==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,padding:a==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,display:"nura78zum5",justifyContent:"nural56j7k",alignItems:"nura6s0dn4",":hover_transform":"nura1lcra6a",":hover_transition":u==null?null:"nuradz300a",":hover_transitionBehavior":null,":hover_transitionDelay":null,":hover_transitionDuration":null,":hover_transitionProperty":null,":hover_transitionTimingFunction":null,$$css:!0},{"--borderRadius":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--padding":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--1vnotgs":u??void 0}]},modalHeader:function(n,a,u){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,display:"nura78zum5",justifyContent:"nura1qughib",alignItems:"nura6s0dn4",color:a==null?null:"nurafx01vb",fontWeight:"nura117nqv4",backgroundColor:u==null?null:"nurar5ldyu",$$css:!0},{"--padding":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--color":a??void 0,"--backgroundColor":u??void 0}]},body:function(n,a){return[{padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,backgroundColor:a==null?null:"nurar5ldyu",$$css:!0},{"--padding":(function(u){return typeof u=="number"?u+"px":u??void 0})(n),"--backgroundColor":a??void 0}]},footer:function(n,a,u){return[{display:"nura78zum5",justifyContent:"nura13a6bvl",padding:n==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,gap:a==null?null:"nura9ctp7s",rowGap:null,columnGap:null,backgroundColor:u==null?null:"nurar5ldyu",$$css:!0},{"--padding":(function(c){return typeof c=="number"?c+"px":c??void 0})(n),"--gap":(function(c){return typeof c=="number"?c+"px":c??void 0})(a),"--backgroundColor":u??void 0}]},setContent:function(n,a,u,c,d,f,h,g,m){return[{color:n==null?null:"nurafx01vb",backgroundColor:a==null?null:"nurar5ldyu",position:"nura10l6tqk",top:"nuradsb8wn",left:"nurau96u03",insetInlineStart:null,insetInlineEnd:null,marginTop:u==null?null:"nura17zef60",borderRadius:c==null?null:"nura1kptayx",borderStartStartRadius:null,borderStartEndRadius:null,borderEndStartRadius:null,borderEndEndRadius:null,borderTopLeftRadius:null,borderTopRightRadius:null,borderBottomLeftRadius:null,borderBottomRightRadius:null,border:"1px solid ".concat(d)==null?null:"nuraoyue30",borderWidth:null,borderInlineWidth:null,borderInlineStartWidth:null,borderLeftWidth:null,borderInlineEndWidth:null,borderRightWidth:null,borderBlockWidth:null,borderTopWidth:null,borderBottomWidth:null,borderStyle:null,borderInlineStyle:null,borderInlineStartStyle:null,borderLeftStyle:null,borderInlineEndStyle:null,borderRightStyle:null,borderBlockStyle:null,borderTopStyle:null,borderBottomStyle:null,borderColor:null,borderInlineColor:null,borderInlineStartColor:null,borderLeftColor:null,borderInlineEndColor:null,borderRightColor:null,borderBlockColor:null,borderTopColor:null,borderBottomColor:null,boxShadow:f==null?null:"nura10ya7sz",padding:h==null?null:"nura6rcfto",paddingInline:null,paddingStart:null,paddingLeft:null,paddingEnd:null,paddingRight:null,paddingBlock:null,paddingTop:null,paddingBottom:null,zIndex:g==null?null:"nurabgtp72",width:m==null?null:"nura1bl4301",$$css:!0},{"--color":n??void 0,"--backgroundColor":a??void 0,"--marginTop":(function(b){return typeof b=="number"?b+"px":b??void 0})(u),"--borderRadius":(function(b){return typeof b=="number"?b+"px":b??void 0})(c),"--border":(function(b){return typeof b=="number"?b+"px":b??void 0})("1px solid ".concat(d)),"--boxShadow":f??void 0,"--padding":(function(b){return typeof b=="number"?b+"px":b??void 0})(h),"--zIndex":g??void 0,"--width":(function(b){return typeof b=="number"?b+"px":b??void 0})(m)}]}},gS={cursorPointer:{cursor:"nura1ypdohk",$$css:!0},cursorNotAllowed:{cursor:"nura1h6gzvc",$$css:!0}},bS={block:{display:"nura1lliihq",$$css:!0},flex:{display:"nura78zum5",$$css:!0}},yS={animationStyles:mS,positionStyles:hS,functionStyles:pS,miscStyles:gS,displayStyles:bS},vS=function(n){var a=n.theme,u=n.children;return It.createElement(ht.Suspense,{fallback:It.createElement("div",null,"Loading content...")},It.createElement(lg.Provider,{value:{base:yS,theme:a}},u))};const SS={primary:"var(--nura1t3rxob)",secondary:"var(--nurac0xfl0)",svgPrimary:"var(--nura1lys5j8)",svgSecondary:"var(--nura1tvk7fb)",textPrimary:"var(--nura1r1jtr8)",textSecondary:"var(--nura1x4ihrx)",textHighlight:"var(--nura11xpmtc)",dfxPointBandGreen:"var(--nura189oe4t)",dfxPointBandLightGreen:"var(--nura1m9ex4u)",dfxPointBandYellow:"var(--nura1o1ctcs)",dfxPointBandLightRed:"var(--nura1qem2wd)",dfxPointBandRed:"var(--nurauco1i6)",backgroundPrimary:"var(--nura1eyt6zq)",backgroundSecondary:"var(--nura1p8y2i8)",backgroundTertiary:"var(--nura93gwl2)",placeholder:"var(--nurausgh25)",success:"var(--nuradn5qp2)",danger:"var(--nura1eqaum5)",warning:"var(--nura1a79zww)",outline:"var(--nura13qkcix)",borderPrimary:"var(--nura18gkcxp)",__themeName__:"nura1bg4z2m"},ES={none:"var(--nuraxr9zr7)",xxs:"var(--nura16twfyi)",xs:"var(--nurafuhwbp)",s:"var(--nura1lwdqd5)",m:"var(--nurak4tti0)",l:"var(--nura7x3zcf)",xl:"var(--nura11a4zim)",xxl:"var(--nurant3gmo)",__themeName__:"nura1uv39ic"},TS={0:"var(--nura1k9hmp6)",1:"var(--nura1qwkjhs)",2:"var(--nura2td6xo)",3:"var(--nura1vcttqn)",4:"var(--nura1hrjh3j)",5:"var(--nura1rnt53x)",6:"var(--nurawzfaie)",7:"var(--nura17xc4j6)",8:"var(--nurajaojg1)",9:"var(--nura1qk4uwj)",10:"var(--nura2nxh7v)",px:"var(--nurayb88gy)","0.5":"var(--nura3utnui)","1.5":"var(--nuranvyi1)","2.5":"var(--nura1sa9pp2)","3.5":"var(--nurarh4qzk)",full:"var(--nura1harvob)",__themeName__:"nura11fj8hn"},RS={small:"var(--nurachopq3)",regular:"var(--nura1had6qr)",medium:"var(--nura3eu4ha)",large:"var(--nura1bngygi)",inner:"var(--nura1xrsavr)",none:"var(--nura16zvxss)",__themeName__:"nuracil3y2"},xS={xxs:"var(--nurab1mhng)",xs:"var(--nuraytyjg6)",s:"var(--nurat1ana1)",base:"var(--nurasoc02c)",m:"var(--nurauozfb3)",l:"var(--nura151zclg)",xl:"var(--nurabek6tk)",xxl:"var(--nurax1s4n2)",__themeName__:"nura13v19d"},_S={family:"var(--nura5ws185)",familyCode:"var(--nura15pxpln)",weightLighter:"var(--nuraop3txb)",weightLight:"var(--nurav8kkbq)",weightSemiLight:"var(--nura1wxy3a5)",weightNormal:"var(--nura1vbl1il)",weightMedium:"var(--nuraez42cl)",weightSemiBold:"var(--nura111zgvv)",weightBold:"var(--nuraa6i7ec)",weightBolder:"var(--nuraicucjz)",weightExtraBold:"var(--nura1bthghg)",spacingTighter:"var(--nura13kdxmb)",spacingTight:"var(--nurarrpz26)",spacingNormal:"var(--nuras6s3bh)",spacingWide:"var(--nura1q7jn1b)",spacingWider:"var(--nuraccq7bu)",spacingWidest:"var(--nuracrl1yn)",__themeName__:"nura8l07yk"},CS={none:"var(--nuraal11a2)",tight:"var(--nuraybsm5d)",normal:"var(--nuradim0st)",relaxed:"var(--nura15tybe0)",loose:"var(--nura12eayp6)",extraLoose:"var(--nurawn9jkm)",__themeName__:"nura927nu8"},AS={none:"var(--nurabtcvpl)",small:"var(--nura1afi7qv)",normal:"var(--nura15yqgvb)",medium:"var(--nurasf3o3m)",large:"var(--nuraimulti)",extraLarge:"var(--nura16zmalv)",full:"var(--nurafz7cjn)",__themeName__:"nuraak2exh"},OS={blurNone:"var(--nura137mxtf)",blurSmall:"var(--nura1o0emb5)",blurMedium:"var(--nura13lyf0u)",blurLarge:"var(--nura18g3bz4)",__themeName__:"nura1lutyi5"},wS={none:"var(--nura1v1tnmu)",fast:"var(--nura2kwzeb)",slow:"var(--nura1vvtfo9)",slower:"var(--nuraitlshj)",__themeName__:"nuras8d61c"},kS={10:"var(--nura1i1ejmt)",20:"var(--nura5qk3gp)",30:"var(--nurah9t3ob)",40:"var(--nura43tbvn)",50:"var(--nura1yhukqj)",behind:"var(--nuraeqozx9)",auto:"var(--nura3kqhfb)",__themeName__:"nura14218ip"},DS={colorTokens:SS,sizeTokens:ES,spaceTokens:TS,shadowTokens:RS,fontSizeTokens:xS,fontTokens:_S,leadingTokens:CS,borderRadiusTokens:AS,filterTokens:OS,transitionTokens:wS,elevationTokens:kS},LS={primary:"var(--nura15kgmj)",secondary:"var(--nurax6kfw9)",svgPrimary:"var(--nura4qrh3c)",svgSecondary:"var(--nura4rgbf3)",textPrimary:"var(--nuragb6esp)",textSecondary:"var(--nura1j32yk2)",textHighlight:"var(--nura1p03kfg)",dfxPointBandGreen:"var(--nura376bx6)",dfxPointBandLightGreen:"var(--nuran4vk4j)",dfxPointBandYellow:"var(--nura1dazbhd)",dfxPointBandLightRed:"var(--nura1q5ggap)",dfxPointBandRed:"var(--nuraa6m4zy)",backgroundPrimary:"var(--nura150i0fq)",backgroundSecondary:"var(--nura1jdn895)",backgroundTertiary:"var(--nura8abwj1)",placeholder:"var(--nuraym7x2c)",warning:"var(--nurakl6nur)",danger:"var(--nurauhjdni)",success:"var(--nurai1uixs)",outline:"var(--nura1087wr9)",borderPrimary:"var(--nura1lb4ufl)",__themeName__:"nurazc319s"},NS={none:"var(--nuraez2jv5)",xxs:"var(--nura10zij36)",xs:"var(--nurabjmzjv)",s:"var(--nura1dtjy4r)",m:"var(--nurazykr3n)",l:"var(--nura13jb585)",xl:"var(--nura1wb8x52)",xxl:"var(--nura1bgolzt)",__themeName__:"nura1du2u5v"},MS={0:"var(--nura1afdf2b)",1:"var(--nurag6ayps)",2:"var(--nuralthc6s)",3:"var(--nura1oznd4d)",4:"var(--nura192u6nt)",5:"var(--nura1os0kvx)",6:"var(--nura14mt8wj)",7:"var(--nura1xt2y8)",8:"var(--nuratgqwgb)",9:"var(--nuranq48h4)",10:"var(--nura1bmxp07)",px:"var(--nura1mlaj3q)","0.5":"var(--nuraax6egv)","1.5":"var(--nurafjxrbo)","2.5":"var(--nura83jwqh)","3.5":"var(--nura16yckt)",full:"var(--nurah64jnx)",__themeName__:"nura1w6omlp"},zS={small:"var(--nurafqzbbl)",regular:"var(--nuratmuee3)",medium:"var(--nura15olmqr)",large:"var(--nurajyizgl)",inner:"var(--nura11aqasm)",none:"var(--nura1kc53uu)",__themeName__:"nura1m9jo0c"},BS={xxs:"var(--nura1ntqx68)",xs:"var(--nura1g25ex6)",s:"var(--nuraqga6x8)",base:"var(--nura1yowshf)",m:"var(--nuranllqx7)",l:"var(--nura148rs9k)",xl:"var(--nura1y8tq2k)",xxl:"var(--nuraeix4xg)",__themeName__:"nuragiplfr"},jS={family:"var(--nurab0d2oh)",familyCode:"var(--nura1q6hgg3)",weightLighter:"var(--nura1h50opk)",weightLight:"var(--nura1mlt2cb)",weightSemiLight:"var(--nura1mpp5bz)",weightNormal:"var(--nurapfunkk)",weightMedium:"var(--nura15wuila)",weightSemiBold:"var(--nuran8rt1q)",weightBold:"var(--nuralxs4ab)",weightBolder:"var(--nurao6jd0z)",weightExtraBold:"var(--nura1p1d7fs)",spacingTighter:"var(--nura1mhtijf)",spacingTight:"var(--nural0r81e)",spacingNormal:"var(--nuraipvt1z)",spacingWide:"var(--nura103k51f)",spacingWider:"var(--nuraz6gym2)",spacingWidest:"var(--nurac66gpe)",__themeName__:"nuray4fqpn"},US={none:"var(--nura1ytzsko)",tight:"var(--nura1td2vm4)",normal:"var(--nuraocgciw)",relaxed:"var(--nuraxrifnr)",loose:"var(--nura1gjezia)",extraLoose:"var(--nuradoea5v)",__themeName__:"nurasjkyy3"},IS={none:"var(--nura1obd0uo)",small:"var(--nura1c9ws0i)",normal:"var(--nura1u00lbx)",medium:"var(--nura1v6ju4d)",large:"var(--nura1oqbosc)",extraLarge:"var(--nuraz92cg0)",full:"var(--nura8his1l)",__themeName__:"nura1emvwvy"},$S={blurNone:"var(--nura1guq9b5)",blurSmall:"var(--nuray66o3g)",blurMedium:"var(--nura1we6cbv)",blurLarge:"var(--nura1x368jr)",__themeName__:"nurarsmpdc"},HS={none:"var(--nura176ojlx)",fast:"var(--nura1wlx08b)",slow:"var(--nura1eenqhm)",slower:"var(--nura1f6llm2)",__themeName__:"nura7gcsh8"},GS={10:"var(--nura61urvs)",20:"var(--nura1ei5vz8)",30:"var(--nura1c1ofgz)",40:"var(--nura98b2z7)",50:"var(--nura1qkdzau)",behind:"var(--nurarizrlm)",auto:"var(--nura1drb8yl)",__themeName__:"nura1avxsrv"},FS={colorTokens:LS,sizeTokens:NS,spaceTokens:MS,shadowTokens:zS,fontSizeTokens:BS,fontTokens:jS,leadingTokens:US,borderRadiusTokens:IS,filterTokens:$S,transitionTokens:HS,elevationTokens:GS},WS=Symbol(),nd=Symbol(),di="a",og="f",sg="p",cg="c",dg="t",ld="h",fi="w",ad="o",rd="k";let qS=(i,n)=>new Proxy(i,n);const id=Object.getPrototypeOf,ud=new WeakMap,fg=i=>i&&(ud.has(i)?ud.get(i):id(i)===Object.prototype||id(i)===Array.prototype),ro=i=>typeof i=="object"&&i!==null,YS=i=>Object.values(Object.getOwnPropertyDescriptors(i)).some(n=>!n.configurable&&!n.writable),VS=i=>{if(Array.isArray(i))return Array.from(i);const n=Object.getOwnPropertyDescriptors(i);return Object.values(n).forEach(a=>{a.configurable=!0}),Object.create(id(i),n)},PS=(i,n)=>{const a={[og]:n};let u=!1;const c=(h,g)=>{if(!u){let m=a[di].get(i);if(m||(m={},a[di].set(i,m)),h===fi)m[fi]=!0;else{let b=m[h];b||(b=new Set,m[h]=b),b.add(g)}}},d=()=>{u=!0,a[di].delete(i)},f={get(h,g){return g===nd?i:(c(rd,g),hg(Reflect.get(h,g),a[di],a[cg],a[dg]))},has(h,g){return g===WS?(d(),!0):(c(ld,g),Reflect.has(h,g))},getOwnPropertyDescriptor(h,g){return c(ad,g),Reflect.getOwnPropertyDescriptor(h,g)},ownKeys(h){return c(fi),Reflect.ownKeys(h)}};return n&&(f.set=f.deleteProperty=()=>!1),[f,a]},od=i=>i[nd]||i,hg=(i,n,a,u)=>{if(!fg(i))return i;let c=u&&u.get(i);if(!c){const g=od(i);YS(g)?c=[g,VS(g)]:c=[g],u?.set(i,c)}const[d,f]=c;let h=a&&a.get(d);return(!h||h[1][og]!==!!f)&&(h=PS(d,!!f),h[1][sg]=qS(f||d,h[0]),a&&a.set(d,h)),h[1][di]=n,h[1][cg]=a,h[1][dg]=u,h[1][sg]},KS=(i,n)=>{const a=Reflect.ownKeys(i),u=Reflect.ownKeys(n);return a.length!==u.length||a.some((c,d)=>c!==u[d])},mg=(i,n,a,u,c=Object.is)=>{if(c(i,n))return!1;if(!ro(i)||!ro(n))return!0;const d=a.get(od(i));if(!d)return!0;if(u){if(u.get(i)===n)return!1;u.set(i,n)}let f=null;for(const h of d[ld]||[])if(f=Reflect.has(i,h)!==Reflect.has(n,h),f)return f;if(d[fi]===!0){if(f=KS(i,n),f)return f}else for(const h of d[ad]||[]){const g=!!Reflect.getOwnPropertyDescriptor(i,h),m=!!Reflect.getOwnPropertyDescriptor(n,h);if(f=g!==m,f)return f}for(const h of d[rd]||[])if(f=mg(i[h],n[h],a,u,c),f)return f;if(f===null)throw new Error("invalid used");return f},XS=i=>fg(i)&&i[nd]||null,pg=(i,n=!0)=>{ud.set(i,n)},QS=(i,n,a)=>{const u=[],c=new WeakSet,d=(f,h)=>{var g,m,b;if(c.has(f))return;ro(f)&&c.add(f);const v=ro(f)&&n.get(od(f));if(v){if((g=v[ld])===null||g===void 0||g.forEach(S=>{const A=`:has(${String(S)})`;u.push(h?[...h,A]:[A])}),v[fi]===!0){const S=":ownKeys";u.push(h?[...h,S]:[S])}else(m=v[ad])===null||m===void 0||m.forEach(S=>{const A=`:hasOwn(${String(S)})`;u.push(h?[...h,A]:[A])});(b=v[rd])===null||b===void 0||b.forEach(S=>{"value"in(Object.getOwnPropertyDescriptor(f,S)||{})&&d(f[S],h?[...h,S]:[S])})}else h&&u.push(h)};return d(i),u},sd=i=>typeof i=="object"&&i!==null,ZS=i=>sd(i)&&!io.has(i)&&(Array.isArray(i)||!(Symbol.iterator in i))&&!(i instanceof WeakMap)&&!(i instanceof WeakSet)&&!(i instanceof Error)&&!(i instanceof Number)&&!(i instanceof Date)&&!(i instanceof String)&&!(i instanceof RegExp)&&!(i instanceof ArrayBuffer)&&!(i instanceof Promise),gg=(i,n)=>{const a=bg.get(i);if(a?.[0]===n)return a[1];const u=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i));return pg(u,!0),bg.set(i,[n,u]),Reflect.ownKeys(i).forEach(c=>{if(Object.getOwnPropertyDescriptor(u,c))return;const d=Reflect.get(i,c),{enumerable:f}=Reflect.getOwnPropertyDescriptor(i,c),h={value:d,enumerable:f,configurable:!0};if(io.has(d))pg(d,!1);else if(Jl.has(d)){const[g,m]=Jl.get(d);h.value=gg(g,m())}Object.defineProperty(u,c,h)}),Object.preventExtensions(u)},JS=(i,n,a,u)=>({deleteProperty(c,d){const f=Reflect.get(c,d);a(d);const h=Reflect.deleteProperty(c,d);return h&&u(["delete",[d],f]),h},set(c,d,f,h){const g=!i()&&Reflect.has(c,d),m=Reflect.get(c,d,h);if(g&&(yg(m,f)||uo.has(f)&&yg(m,uo.get(f))))return!0;a(d),sd(f)&&(f=XS(f)||f);const b=!Jl.has(f)&&e1(f)?ta(f):f;return n(d,b),Reflect.set(c,d,b,h),u(["set",[d],f,m]),!0}}),Jl=new WeakMap,io=new WeakSet,bg=new WeakMap,cd=[1],uo=new WeakMap;let yg=Object.is,t1=(i,n)=>new Proxy(i,n),e1=ZS,n1=gg,l1=JS;function ta(i={}){if(!sd(i))throw new Error("object required");const n=uo.get(i);if(n)return n;let a=cd[0];const u=new Set,c=(N,W=++cd[0])=>{a!==W&&(d=a=W,u.forEach(F=>F(N,W)))};let d=a;const f=(N=cd[0])=>(d!==N&&(d=N,g.forEach(([W])=>{const F=W[1](N);F>a&&(a=F)})),a),h=N=>(W,F)=>{const Z=[...W];Z[1]=[N,...Z[1]],c(Z,F)},g=new Map,m=(N,W)=>{const F=!io.has(W)&&Jl.get(W);if(F){if((import.meta.env?import.meta.env.MODE:void 0)!=="production"&&g.has(N))throw new Error("prop listener already exists");if(u.size){const Z=F[2](h(N));g.set(N,[F,Z])}else g.set(N,[F])}},b=N=>{var W;const F=g.get(N);F&&(g.delete(N),(W=F[1])==null||W.call(F))},v=N=>(u.add(N),u.size===1&&g.forEach(([F,Z],J)=>{if((import.meta.env?import.meta.env.MODE:void 0)!=="production"&&Z)throw new Error("remove already exists");const ut=F[2](h(J));g.set(J,[F,ut])}),()=>{u.delete(N),u.size===0&&g.forEach(([F,Z],J)=>{Z&&(Z(),g.set(J,[F]))})});let S=!0;const A=l1(()=>S,m,b,c),M=t1(i,A);uo.set(i,M);const j=[i,f,v];return Jl.set(M,j),Reflect.ownKeys(i).forEach(N=>{const W=Object.getOwnPropertyDescriptor(i,N);"value"in W&&W.writable&&(M[N]=i[N])}),S=!1,M}function vg(i,n,a){const u=Jl.get(i);(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&!u&&console.warn("Please use proxy object");let c;const d=[],f=u[2];let h=!1;const m=f(b=>{d.push(b),c||(c=Promise.resolve().then(()=>{c=void 0,h&&n(d.splice(0))}))});return h=!0,()=>{h=!1,m()}}function Pn(i){const n=Jl.get(i);(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&!n&&console.warn("Please use proxy object");const[a,u]=n;return n1(a,u())}function a1(i){return io.add(i),i}const dd=Symbol();function r1(i,n){const{enabled:a,name:u="",...c}=n||{};let d;try{d=(a??(import.meta.env?import.meta.env.MODE:void 0)!=="production")&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}if(!d){(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&a&&console.warn("[Warning] Please install/enable Redux devtools extension");return}let f=!1;const h=d.connect({name:u,...c}),g=vg(i,b=>{const v=b.filter(([S,A])=>A[0]!==dd).map(([S,A])=>`${S}:${A.map(String).join(".")}`).join(", ");if(v)if(f)f=!1;else{const S=Object.assign({},Pn(i));delete S[dd],h.send({type:v,updatedAt:new Date().toLocaleString()},S)}}),m=h.subscribe(b=>{var v,S,A,M,j,N;if(b.type==="ACTION"&&b.payload)try{Object.assign(i,JSON.parse(b.payload))}catch(W){console.error(`please dispatch a serializable value that JSON.parse() and proxy() support
12
- `,W)}if(b.type==="DISPATCH"&&b.state){if(((v=b.payload)==null?void 0:v.type)==="JUMP_TO_ACTION"||((S=b.payload)==null?void 0:S.type)==="JUMP_TO_STATE"){f=!0;const W=JSON.parse(b.state);Object.assign(i,W)}i[dd]=b}else if(b.type==="DISPATCH"&&((A=b.payload)==null?void 0:A.type)==="COMMIT")h.init(Pn(i));else if(b.type==="DISPATCH"&&((M=b.payload)==null?void 0:M.type)==="IMPORT_STATE"){const W=(j=b.payload.nextLiftedState)==null?void 0:j.actionsById,F=((N=b.payload.nextLiftedState)==null?void 0:N.computedStates)||[];f=!0,F.forEach(({state:Z},J)=>{const ut=W[J]||"No action found";Object.assign(i,Z),J===0?h.init(Pn(i)):h.send(ut,Pn(i))})}});return h.init(Pn(i)),()=>{g(),m?.()}}const i1=(i,n)=>{const a=ht.useRef(void 0);ht.useEffect(()=>{a.current=QS(i,n)}),ht.useDebugValue(a.current)},u1=i1,o1=new WeakMap;function ee(i,n){const u=ht.useMemo(()=>i&&new WeakMap,[i]),c=ht.useRef(void 0);let d=!0;const f=ht.useSyncExternalStore(ht.useCallback(g=>{const m=vg(i,g);return g(),m},[i,void 0]),()=>{const g=Pn(i);try{if(!d&&c.current&&!mg(c.current,g,u,new WeakMap))return c.current}catch{}return g},()=>Pn(i));d=!1,ht.useLayoutEffect(()=>{c.current=f}),(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&u1(f,u);const h=ht.useMemo(()=>new WeakMap,[]);return hg(f,u,h,o1)}var Rl=(i=>(i.Idle="idle",i.Enumerating="enumerating",i.Done="done",i))(Rl||{});const hi={CAMERA_STATUS:"cameraStatus",SELECTED_DEVICE_CHANGED:"selectedDeviceChanged",DEVICE_PIXEL_RATIO_CHANGED:"devicePixelRatioChanged",MEDIA_DEVICE_LIST_CHANGED:"mediaDeviceListChanged"},oo=i=>{let n=i.toFixed(2);return n==="0"&&(n=i.toPrecision(1)),Number(n)},s1=(i,n)=>{let a="";return n.length>0&&((!n.find(u=>u.device.deviceId===i)||i==="")&&(a=n[0].device.deviceId),n.find(u=>u.device.deviceId===i)&&(a=i)),a};let fd=null;class c1 extends EventTarget{mediaDevices=[];selectedDeviceId="";cameraStream=null;cameraWidth=0;cameraHeight=0;cameraFrameRate=0;settingsInputIds=["iso","exposureTime","focusDistance","colorTemperature","zoom"];standardSettingsIds=["contrast","saturation","sharpness","brightness","exposureCompensation"];videoTrackCapabilities={};#t=!1;constructor(){super(),navigator.mediaDevices.ondevicechange=async()=>{this.#t||(this.#t=!0,await this.list(),this.#t=!1)},this.updatePixelRatio=this.updatePixelRatio.bind(this),this.updatePixelRatio()}static init(){return new this}updatePixelRatio(){fd?.();const n=`(resolution: ${window.devicePixelRatio}dppx)`,a=matchMedia(n);a.addEventListener("change",this.updatePixelRatio),fd=()=>{a.removeEventListener("change",this.updatePixelRatio)},setTimeout(()=>{this.#i(this.#g())},1e3),this.#i(this.#g())}async enumerate(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(c=>c.kind==="videoinput").map(c=>{const d=c.getCapabilities();return{device:{label:c.label,deviceId:c.deviceId,kind:"videoinput",groupId:c.groupId},capabilities:d}})}catch(n){return console.error("Error enumerating devices:",n),[]}}async requestPermission(){try{return this.cameraStream=await navigator.mediaDevices.getUserMedia({video:!0}),{success:!0}}catch(n){return n instanceof DOMException&&n.name==="NotAllowedError"?(console.error("Camera permission denied."),{success:!1,error:"permission_denied",message:"Camera permission denied by user"}):n instanceof DOMException&&n.name==="NotFoundError"?(console.error("No camera devices found."),{success:!1,error:"no_devices",message:"No camera devices found on this system"}):(console.error("Error requesting camera permission:",n),{success:!1,error:"unknown",message:n instanceof Error?n.message:"Unknown error occurred"})}finally{this.stop()}}async list(){this.mediaDevices=await this.enumerate(),this.selectedDeviceId=s1(this.selectedDeviceId,this.mediaDevices),this.#i(this.#R()),this.#i(this.#S())}setDeviceId(n){this.mediaDevices.length&&this.mediaDevices.find(a=>a.device.deviceId===n)&&(this.selectedDeviceId=n,this.#i(this.#S()))}#a(){if(this.cameraStream){const[n]=this.cameraStream.getVideoTracks(),a=n.getSettings(),{width:u,height:c,frameRate:d}=a,f=n.getCapabilities();this.cameraWidth=u||0,this.cameraHeight=c||0,this.cameraFrameRate=d||0,this.videoTrackCapabilities=Object.fromEntries([...this.settingsInputIds,...this.standardSettingsIds].map(h=>{const g=f[h];return[h,{isSupported:!!g,min:g&&g.min?oo(g.min):0,max:g&&g.max?oo(g.max):0,step:g&&g.step?oo(g.step):0,value:g&&a[h]?oo(a[h]):0}]}))}}async#v(){const n={video:{width:640,height:360,deviceId:{exact:this.selectedDeviceId}}};this.cameraStream=await navigator.mediaDevices.getUserMedia(n),this.#a()}async start(n,a,u){this.stop();const c=navigator.mediaDevices.getSupportedConstraints();for(const f of["facingMode","aspectRatio"])if(!(f in c))throw new OverconstrainedError(f,"not supported");if(n/a!==16/9)throw new Error("Resolution must have a 16:9 aspect ratio.");const d={video:{...u?{facingMode:u}:{},deviceId:this.selectedDeviceId,aspectRatio:{exact:16/9},frameRate:{ideal:30,min:15,max:30},width:{ideal:n},height:{ideal:a}}};try{return this.cameraStream=await navigator.mediaDevices.getUserMedia(d),this.#a(),this.#i(this.#h(!0)),!0}catch(f){f.name!="OverconstrainedError"?console.log("Error opening camera",f):console.log(`This camera cannot produce the requested ${f.constraint}.`);try{return console.log("Attempt to open the camera with fallback resolution: 640 x 360 pixels"),await this.#v(),this.#i(this.#h(!0)),!0}catch(h){return console.error("Fallback resolution also failed.",h),!1}}}getVideoTrackCapabilities(){return this.videoTrackCapabilities}stop(){this.cameraStream&&(this.cameraStream.getTracks().forEach(n=>n.stop()),this.cameraStream=null,this.#i(this.#h(!1)),this.cameraWidth=0,this.cameraHeight=0,this.cameraFrameRate=0)}#h(n){return new CustomEvent(hi.CAMERA_STATUS,{detail:{isOpen:n,capabilities:this.videoTrackCapabilities}})}#S(){return new CustomEvent(hi.SELECTED_DEVICE_CHANGED,{detail:{deviceId:this.selectedDeviceId}})}#R(){return new CustomEvent(hi.MEDIA_DEVICE_LIST_CHANGED,{detail:{mediaDevices:this.mediaDevices}})}#g(){return new CustomEvent(hi.DEVICE_PIXEL_RATIO_CHANGED,{detail:{devicePixelRatio:window.devicePixelRatio}})}#i(n){this.dispatchEvent(n)}}const d1={CameraController:c1},bt=i=>typeof i=="string",mi=()=>{let i,n;const a=new Promise((u,c)=>{i=u,n=c});return a.resolve=i,a.reject=n,a},Sg=i=>i==null?"":""+i,f1=(i,n,a)=>{i.forEach(u=>{n[u]&&(a[u]=n[u])})},h1=/###/g,Eg=i=>i&&i.indexOf("###")>-1?i.replace(h1,"."):i,Tg=i=>!i||bt(i),pi=(i,n,a)=>{const u=bt(n)?n.split("."):n;let c=0;for(;c<u.length-1;){if(Tg(i))return{};const d=Eg(u[c]);!i[d]&&a&&(i[d]=new a),Object.prototype.hasOwnProperty.call(i,d)?i=i[d]:i={},++c}return Tg(i)?{}:{obj:i,k:Eg(u[c])}},Rg=(i,n,a)=>{const{obj:u,k:c}=pi(i,n,Object);if(u!==void 0||n.length===1){u[c]=a;return}let d=n[n.length-1],f=n.slice(0,n.length-1),h=pi(i,f,Object);for(;h.obj===void 0&&f.length;)d=`${f[f.length-1]}.${d}`,f=f.slice(0,f.length-1),h=pi(i,f,Object),h?.obj&&typeof h.obj[`${h.k}.${d}`]<"u"&&(h.obj=void 0);h.obj[`${h.k}.${d}`]=a},m1=(i,n,a,u)=>{const{obj:c,k:d}=pi(i,n,Object);c[d]=c[d]||[],c[d].push(a)},so=(i,n)=>{const{obj:a,k:u}=pi(i,n);if(a&&Object.prototype.hasOwnProperty.call(a,u))return a[u]},p1=(i,n,a)=>{const u=so(i,a);return u!==void 0?u:so(n,a)},xg=(i,n,a)=>{for(const u in n)u!=="__proto__"&&u!=="constructor"&&(u in i?bt(i[u])||i[u]instanceof String||bt(n[u])||n[u]instanceof String?a&&(i[u]=n[u]):xg(i[u],n[u],a):i[u]=n[u]);return i},Xa=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var g1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const b1=i=>bt(i)?i.replace(/[&<>"'\/]/g,n=>g1[n]):i;class y1{constructor(n){this.capacity=n,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(n){const a=this.regExpMap.get(n);if(a!==void 0)return a;const u=new RegExp(n);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(n,u),this.regExpQueue.push(n),u}}const v1=[" ",",","?","!",";"],S1=new y1(20),E1=(i,n,a)=>{n=n||"",a=a||"";const u=v1.filter(f=>n.indexOf(f)<0&&a.indexOf(f)<0);if(u.length===0)return!0;const c=S1.getRegExp(`(${u.map(f=>f==="?"?"\\?":f).join("|")})`);let d=!c.test(i);if(!d){const f=i.indexOf(a);f>0&&!c.test(i.substring(0,f))&&(d=!0)}return d},hd=function(i,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[n])return Object.prototype.hasOwnProperty.call(i,n)?i[n]:void 0;const u=n.split(a);let c=i;for(let d=0;d<u.length;){if(!c||typeof c!="object")return;let f,h="";for(let g=d;g<u.length;++g)if(g!==d&&(h+=a),h+=u[g],f=c[h],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<u.length-1)continue;d+=g-d+1;break}c=f}return c},co=i=>i?.replace("_","-"),T1={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,n){console?.[i]?.apply?.(console,n)}};let R1=class Ud{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(n,a)}init(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=a.prefix||"i18next:",this.logger=n||T1,this.options=a,this.debug=a.debug}log(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"log","",!0)}warn(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"warn","",!0)}error(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"error","")}deprecate(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"warn","WARNING DEPRECATED: ",!0)}forward(n,a,u,c){return c&&!this.debug?null:(bt(n[0])&&(n[0]=`${u}${this.prefix} ${n[0]}`),this.logger[a](n))}create(n){return new Ud(this.logger,{prefix:`${this.prefix}:${n}:`,...this.options})}clone(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new Ud(this.logger,n)}};var On=new R1;class fo{constructor(){this.observers={}}on(n,a){return n.split(" ").forEach(u=>{this.observers[u]||(this.observers[u]=new Map);const c=this.observers[u].get(a)||0;this.observers[u].set(a,c+1)}),this}off(n,a){if(this.observers[n]){if(!a){delete this.observers[n];return}this.observers[n].delete(a)}}emit(n){for(var a=arguments.length,u=new Array(a>1?a-1:0),c=1;c<a;c++)u[c-1]=arguments[c];this.observers[n]&&Array.from(this.observers[n].entries()).forEach(f=>{let[h,g]=f;for(let m=0;m<g;m++)h(...u)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(f=>{let[h,g]=f;for(let m=0;m<g;m++)h.apply(h,[n,...u])})}}class _g extends fo{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=n||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}removeNamespaces(n){const a=this.options.ns.indexOf(n);a>-1&&this.options.ns.splice(a,1)}getResource(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const d=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,f=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let h;n.indexOf(".")>-1?h=n.split("."):(h=[n,a],u&&(Array.isArray(u)?h.push(...u):bt(u)&&d?h.push(...u.split(d)):h.push(u)));const g=so(this.data,h);return!g&&!a&&!u&&n.indexOf(".")>-1&&(n=h[0],a=h[1],u=h.slice(2).join(".")),g||!f||!bt(u)?g:hd(this.data?.[n]?.[a],u,d)}addResource(n,a,u,c){let d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const f=d.keySeparator!==void 0?d.keySeparator:this.options.keySeparator;let h=[n,a];u&&(h=h.concat(f?u.split(f):u)),n.indexOf(".")>-1&&(h=n.split("."),c=a,a=h[1]),this.addNamespaces(a),Rg(this.data,h,c),d.silent||this.emit("added",n,a,u,c)}addResources(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const d in u)(bt(u[d])||Array.isArray(u[d]))&&this.addResource(n,a,d,u[d],{silent:!0});c.silent||this.emit("added",n,a,u)}addResourceBundle(n,a,u,c,d){let f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},h=[n,a];n.indexOf(".")>-1&&(h=n.split("."),c=u,u=a,a=h[1]),this.addNamespaces(a);let g=so(this.data,h)||{};f.skipCopy||(u=JSON.parse(JSON.stringify(u))),c?xg(g,u,d):g={...g,...u},Rg(this.data,h,g),f.silent||this.emit("added",n,a,u)}removeResourceBundle(n,a){this.hasResourceBundle(n,a)&&delete this.data[n][a],this.removeNamespaces(a),this.emit("removed",n,a)}hasResourceBundle(n,a){return this.getResource(n,a)!==void 0}getResourceBundle(n,a){return a||(a=this.options.defaultNS),this.getResource(n,a)}getDataByLanguage(n){return this.data[n]}hasLanguageSomeTranslations(n){const a=this.getDataByLanguage(n);return!!(a&&Object.keys(a)||[]).find(c=>a[c]&&Object.keys(a[c]).length>0)}toJSON(){return this.data}}var Cg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,n,a,u,c){return i.forEach(d=>{n=this.processors[d]?.process(n,a,u,c)??n}),n}};const Ag={},Og=i=>!bt(i)&&typeof i!="boolean"&&typeof i!="number";class No extends fo{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),f1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=On.create("translator")}changeLanguage(n){n&&(this.language=n)}exists(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return n==null?!1:this.resolve(n,a)?.res!==void 0}extractFromKey(n,a){let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const c=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let d=a.ns||this.options.defaultNS||[];const f=u&&n.indexOf(u)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!E1(n,u,c);if(f&&!h){const g=n.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:n,namespaces:bt(d)?[d]:d};const m=n.split(u);(u!==c||u===c&&this.options.ns.indexOf(m[0])>-1)&&(d=m.shift()),n=m.join(c)}return{key:n,namespaces:bt(d)?[d]:d}}translate(n,a,u){if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),n==null)return"";Array.isArray(n)||(n=[String(n)]);const c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,d=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:f,namespaces:h}=this.extractFromKey(n[n.length-1],a),g=h[h.length-1],m=a.lng||this.language,b=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(m?.toLowerCase()==="cimode"){if(b){const et=a.nsSeparator||this.options.nsSeparator;return c?{res:`${g}${et}${f}`,usedKey:f,exactUsedKey:f,usedLng:m,usedNS:g,usedParams:this.getUsedParamsDetails(a)}:`${g}${et}${f}`}return c?{res:f,usedKey:f,exactUsedKey:f,usedLng:m,usedNS:g,usedParams:this.getUsedParamsDetails(a)}:f}const v=this.resolve(n,a);let S=v?.res;const A=v?.usedKey||f,M=v?.exactUsedKey||f,j=["[object Number]","[object Function]","[object RegExp]"],N=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,W=!this.i18nFormat||this.i18nFormat.handleAsObject,F=a.count!==void 0&&!bt(a.count),Z=No.hasDefaultValue(a),J=F?this.pluralResolver.getSuffix(m,a.count,a):"",ut=a.ordinal&&F?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",q=F&&!a.ordinal&&a.count===0,k=q&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${J}`]||a[`defaultValue${ut}`]||a.defaultValue;let Y=S;W&&!S&&Z&&(Y=k);const pt=Og(Y),Rt=Object.prototype.toString.apply(Y);if(W&&Y&&pt&&j.indexOf(Rt)<0&&!(bt(N)&&Array.isArray(Y))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const et=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,Y,{...a,ns:h}):`key '${f} (${this.language})' returned an object instead of string.`;return c?(v.res=et,v.usedParams=this.getUsedParamsDetails(a),v):et}if(d){const et=Array.isArray(Y),tt=et?[]:{},At=et?M:A;for(const Q in Y)if(Object.prototype.hasOwnProperty.call(Y,Q)){const V=`${At}${d}${Q}`;Z&&!S?tt[Q]=this.translate(V,{...a,defaultValue:Og(k)?k[Q]:void 0,joinArrays:!1,ns:h}):tt[Q]=this.translate(V,{...a,joinArrays:!1,ns:h}),tt[Q]===V&&(tt[Q]=Y[Q])}S=tt}}else if(W&&bt(N)&&Array.isArray(S))S=S.join(N),S&&(S=this.extendTranslation(S,n,a,u));else{let et=!1,tt=!1;!this.isValidLookup(S)&&Z&&(et=!0,S=k),this.isValidLookup(S)||(tt=!0,S=f);const Q=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&tt?void 0:S,V=Z&&k!==S&&this.options.updateMissing;if(tt||et||V){if(this.logger.log(V?"updateKey":"missingKey",m,g,f,V?k:S),d){const P=this.resolve(f,{...a,keySeparator:!1});P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let C=[];const z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&z&&z[0])for(let P=0;P<z.length;P++)C.push(z[P]);else this.options.saveMissingTo==="all"?C=this.languageUtils.toResolveHierarchy(a.lng||this.language):C.push(a.lng||this.language);const X=(P,ft,T)=>{const U=Z&&T!==S?T:Q;this.options.missingKeyHandler?this.options.missingKeyHandler(P,g,ft,U,V,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(P,g,ft,U,V,a),this.emit("missingKey",P,g,ft,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&F?C.forEach(P=>{const ft=this.pluralResolver.getSuffixes(P,a);q&&a[`defaultValue${this.options.pluralSeparator}zero`]&&ft.indexOf(`${this.options.pluralSeparator}zero`)<0&&ft.push(`${this.options.pluralSeparator}zero`),ft.forEach(T=>{X([P],f+T,a[`defaultValue${T}`]||k)})}):X(C,f,k))}S=this.extendTranslation(S,n,a,v,u),tt&&S===f&&this.options.appendNamespaceToMissingKey&&(S=`${g}:${f}`),(tt||et)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}:${f}`:f,et?S:void 0))}return c?(v.res=S,v.usedParams=this.getUsedParamsDetails(a),v):S}extendTranslation(n,a,u,c,d){var f=this;if(this.i18nFormat?.parse)n=this.i18nFormat.parse(n,{...this.options.interpolation.defaultVariables,...u},u.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!u.skipInterpolation){u.interpolation&&this.interpolator.init({...u,interpolation:{...this.options.interpolation,...u.interpolation}});const m=bt(n)&&(u?.interpolation?.skipOnVariables!==void 0?u.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let b;if(m){const S=n.match(this.interpolator.nestingRegexp);b=S&&S.length}let v=u.replace&&!bt(u.replace)?u.replace:u;if(this.options.interpolation.defaultVariables&&(v={...this.options.interpolation.defaultVariables,...v}),n=this.interpolator.interpolate(n,v,u.lng||this.language||c.usedLng,u),m){const S=n.match(this.interpolator.nestingRegexp),A=S&&S.length;b<A&&(u.nest=!1)}!u.lng&&c&&c.res&&(u.lng=this.language||c.usedLng),u.nest!==!1&&(n=this.interpolator.nest(n,function(){for(var S=arguments.length,A=new Array(S),M=0;M<S;M++)A[M]=arguments[M];return d?.[0]===A[0]&&!u.context?(f.logger.warn(`It seems you are nesting recursively key: ${A[0]} in key: ${a[0]}`),null):f.translate(...A,a)},u)),u.interpolation&&this.interpolator.reset()}const h=u.postProcess||this.options.postProcess,g=bt(h)?[h]:h;return n!=null&&g?.length&&u.applyPostProcessor!==!1&&(n=Cg.handle(g,n,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(u)},...u}:u,this)),n}resolve(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u,c,d,f,h;return bt(n)&&(n=[n]),n.forEach(g=>{if(this.isValidLookup(u))return;const m=this.extractFromKey(g,a),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const S=a.count!==void 0&&!bt(a.count),A=S&&!a.ordinal&&a.count===0,M=a.context!==void 0&&(bt(a.context)||typeof a.context=="number")&&a.context!=="",j=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);v.forEach(N=>{this.isValidLookup(u)||(h=N,!Ag[`${j[0]}-${N}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(h)&&(Ag[`${j[0]}-${N}`]=!0,this.logger.warn(`key "${c}" for languages "${j.join(", ")}" won't get resolved as namespace "${h}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),j.forEach(W=>{if(this.isValidLookup(u))return;f=W;const F=[b];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(F,b,W,N,a);else{let J;S&&(J=this.pluralResolver.getSuffix(W,a.count,a));const ut=`${this.options.pluralSeparator}zero`,q=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(S&&(F.push(b+J),a.ordinal&&J.indexOf(q)===0&&F.push(b+J.replace(q,this.options.pluralSeparator)),A&&F.push(b+ut)),M){const k=`${b}${this.options.contextSeparator}${a.context}`;F.push(k),S&&(F.push(k+J),a.ordinal&&J.indexOf(q)===0&&F.push(k+J.replace(q,this.options.pluralSeparator)),A&&F.push(k+ut))}}let Z;for(;Z=F.pop();)this.isValidLookup(u)||(d=Z,u=this.getResource(W,N,Z,a))}))})}),{res:u,usedKey:c,exactUsedKey:d,usedLng:f,usedNS:h}}isValidLookup(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}getResource(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(n,a,u,c):this.resourceStore.getResource(n,a,u,c)}getUsedParamsDetails(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],u=n.replace&&!bt(n.replace);let c=u?n.replace:n;if(u&&typeof n.count<"u"&&(c.count=n.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!u){c={...c};for(const d of a)delete c[d]}return c}static hasDefaultValue(n){const a="defaultValue";for(const u in n)if(Object.prototype.hasOwnProperty.call(n,u)&&a===u.substring(0,a.length)&&n[u]!==void 0)return!0;return!1}}class wg{constructor(n){this.options=n,this.supportedLngs=this.options.supportedLngs||!1,this.logger=On.create("languageUtils")}getScriptPartFromCode(n){if(n=co(n),!n||n.indexOf("-")<0)return null;const a=n.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(n){if(n=co(n),!n||n.indexOf("-")<0)return n;const a=n.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(n){if(bt(n)&&n.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(n)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?n.toLowerCase():n)}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}isSupportedCode(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}getBestMatchFromCodes(n){if(!n)return null;let a;return n.forEach(u=>{if(a)return;const c=this.formatLanguageCode(u);(!this.options.supportedLngs||this.isSupportedCode(c))&&(a=c)}),!a&&this.options.supportedLngs&&n.forEach(u=>{if(a)return;const c=this.getLanguagePartFromCode(u);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(d=>{if(d===c)return d;if(!(d.indexOf("-")<0&&c.indexOf("-")<0)&&(d.indexOf("-")>0&&c.indexOf("-")<0&&d.substring(0,d.indexOf("-"))===c||d.indexOf(c)===0&&c.length>1))return d})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(n,a){if(!n)return[];if(typeof n=="function"&&(n=n(a)),bt(n)&&(n=[n]),Array.isArray(n))return n;if(!a)return n.default||[];let u=n[a];return u||(u=n[this.getScriptPartFromCode(a)]),u||(u=n[this.formatLanguageCode(a)]),u||(u=n[this.getLanguagePartFromCode(a)]),u||(u=n.default),u||[]}toResolveHierarchy(n,a){const u=this.getFallbackCodes(a||this.options.fallbackLng||[],n),c=[],d=f=>{f&&(this.isSupportedCode(f)?c.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return bt(n)&&(n.indexOf("-")>-1||n.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&d(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&d(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&d(this.getLanguagePartFromCode(n))):bt(n)&&d(this.formatLanguageCode(n)),u.forEach(f=>{c.indexOf(f)<0&&d(this.formatLanguageCode(f))}),c}}const kg={zero:0,one:1,two:2,few:3,many:4,other:5},Dg={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class x1{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=n,this.options=a,this.logger=On.create("pluralResolver"),this.pluralRulesCache={}}addRule(n,a){this.rules[n]=a}clearCache(){this.pluralRulesCache={}}getRule(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const u=co(n==="dev"?"en":n),c=a.ordinal?"ordinal":"cardinal",d=JSON.stringify({cleanedCode:u,type:c});if(d in this.pluralRulesCache)return this.pluralRulesCache[d];let f;try{f=new Intl.PluralRules(u,{type:c})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Dg;if(!n.match(/-|_/))return Dg;const g=this.languageUtils.getLanguagePartFromCode(n);f=this.getRule(g,a)}return this.pluralRulesCache[d]=f,f}needsPlural(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=this.getRule(n,a);return u||(u=this.getRule("dev",a)),u?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,u).map(c=>`${a}${c}`)}getSuffixes(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=this.getRule(n,a);return u||(u=this.getRule("dev",a)),u?u.resolvedOptions().pluralCategories.sort((c,d)=>kg[c]-kg[d]).map(c=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const c=this.getRule(n,u);return c?`${this.options.prepend}${u.ordinal?`ordinal${this.options.prepend}`:""}${c.select(a)}`:(this.logger.warn(`no plural rule found for: ${n}`),this.getSuffix("dev",a,u))}}const Lg=function(i,n,a){let u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,d=p1(i,n,a);return!d&&c&&bt(a)&&(d=hd(i,a,u),d===void 0&&(d=hd(n,a,u))),d},md=i=>i.replace(/\$/g,"$$$$");class _1{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=On.create("interpolator"),this.options=n,this.format=n?.interpolation?.format||(a=>a),this.init(n)}init(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});const{escape:a,escapeValue:u,useRawValueToEscape:c,prefix:d,prefixEscaped:f,suffix:h,suffixEscaped:g,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:S,nestingPrefixEscaped:A,nestingSuffix:M,nestingSuffixEscaped:j,nestingOptionsSeparator:N,maxReplaces:W,alwaysFormat:F}=n.interpolation;this.escape=a!==void 0?a:b1,this.escapeValue=u!==void 0?u:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=d?Xa(d):f||"{{",this.suffix=h?Xa(h):g||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=S?Xa(S):A||Xa("$t("),this.nestingSuffix=M?Xa(M):j||Xa(")"),this.nestingOptionsSeparator=N||",",this.maxReplaces=W||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const n=(a,u)=>a?.source===u?(a.lastIndex=0,a):new RegExp(u,"g");this.regexp=n(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=n(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=n(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(n,a,u,c){let d,f,h;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=A=>{if(A.indexOf(this.formatSeparator)<0){const W=Lg(a,g,A,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(W,void 0,u,{...c,...a,interpolationkey:A}):W}const M=A.split(this.formatSeparator),j=M.shift().trim(),N=M.join(this.formatSeparator).trim();return this.format(Lg(a,g,j,this.options.keySeparator,this.options.ignoreJSONStructure),N,u,{...c,...a,interpolationkey:j})};this.resetRegExp();const b=c?.missingInterpolationHandler||this.options.missingInterpolationHandler,v=c?.interpolation?.skipOnVariables!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:A=>md(A)},{regex:this.regexp,safeValue:A=>this.escapeValue?md(this.escape(A)):md(A)}].forEach(A=>{for(h=0;d=A.regex.exec(n);){const M=d[1].trim();if(f=m(M),f===void 0)if(typeof b=="function"){const N=b(n,d,c);f=bt(N)?N:""}else if(c&&Object.prototype.hasOwnProperty.call(c,M))f="";else if(v){f=d[0];continue}else this.logger.warn(`missed to pass in variable ${M} for interpolating ${n}`),f="";else!bt(f)&&!this.useRawValueToEscape&&(f=Sg(f));const j=A.safeValue(f);if(n=n.replace(d[0],j),v?(A.regex.lastIndex+=f.length,A.regex.lastIndex-=d[0].length):A.regex.lastIndex=0,h++,h>=this.maxReplaces)break}}),n}nest(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c,d,f;const h=(g,m)=>{const b=this.nestingOptionsSeparator;if(g.indexOf(b)<0)return g;const v=g.split(new RegExp(`${b}[ ]*{`));let S=`{${v[1]}`;g=v[0],S=this.interpolate(S,f);const A=S.match(/'/g),M=S.match(/"/g);((A?.length??0)%2===0&&!M||M.length%2!==0)&&(S=S.replace(/'/g,'"'));try{f=JSON.parse(S),m&&(f={...m,...f})}catch(j){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,j),`${g}${b}${S}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;c=this.nestingRegexp.exec(n);){let g=[];f={...u},f=f.replace&&!bt(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;let m=!1;if(c[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(c[1])){const b=c[1].split(this.formatSeparator).map(v=>v.trim());c[1]=b.shift(),g=b,m=!0}if(d=a(h.call(this,c[1].trim(),f),f),d&&c[0]===n&&!bt(d))return d;bt(d)||(d=Sg(d)),d||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${n}`),d=""),m&&(d=g.reduce((b,v)=>this.format(b,v,u.lng,{...u,interpolationkey:c[1].trim()}),d.trim())),n=n.replace(c[0],d),this.regexp.lastIndex=0}return n}}const C1=i=>{let n=i.toLowerCase().trim();const a={};if(i.indexOf("(")>-1){const u=i.split("(");n=u[0].toLowerCase().trim();const c=u[1].substring(0,u[1].length-1);n==="currency"&&c.indexOf(":")<0?a.currency||(a.currency=c.trim()):n==="relativetime"&&c.indexOf(":")<0?a.range||(a.range=c.trim()):c.split(";").forEach(f=>{if(f){const[h,...g]=f.split(":"),m=g.join(":").trim().replace(/^'+|'+$/g,""),b=h.trim();a[b]||(a[b]=m),m==="false"&&(a[b]=!1),m==="true"&&(a[b]=!0),isNaN(m)||(a[b]=parseInt(m,10))}})}return{formatName:n,formatOptions:a}},Qa=i=>{const n={};return(a,u,c)=>{let d=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(d={...d,[c.interpolationkey]:void 0});const f=u+JSON.stringify(d);let h=n[f];return h||(h=i(co(u),c),n[f]=h),h(a)}};class A1{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=On.create("formatter"),this.options=n,this.formats={number:Qa((a,u)=>{const c=new Intl.NumberFormat(a,{...u});return d=>c.format(d)}),currency:Qa((a,u)=>{const c=new Intl.NumberFormat(a,{...u,style:"currency"});return d=>c.format(d)}),datetime:Qa((a,u)=>{const c=new Intl.DateTimeFormat(a,{...u});return d=>c.format(d)}),relativetime:Qa((a,u)=>{const c=new Intl.RelativeTimeFormat(a,{...u});return d=>c.format(d,u.range||"day")}),list:Qa((a,u)=>{const c=new Intl.ListFormat(a,{...u});return d=>c.format(d)})},this.init(n)}init(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=a.interpolation.formatSeparator||","}add(n,a){this.formats[n.toLowerCase().trim()]=a}addCached(n,a){this.formats[n.toLowerCase().trim()]=Qa(a)}format(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const d=a.split(this.formatSeparator);if(d.length>1&&d[0].indexOf("(")>1&&d[0].indexOf(")")<0&&d.find(h=>h.indexOf(")")>-1)){const h=d.findIndex(g=>g.indexOf(")")>-1);d[0]=[d[0],...d.splice(1,h)].join(this.formatSeparator)}return d.reduce((h,g)=>{const{formatName:m,formatOptions:b}=C1(g);if(this.formats[m]){let v=h;try{const S=c?.formatParams?.[c.interpolationkey]||{},A=S.locale||S.lng||c.locale||c.lng||u;v=this.formats[m](h,A,{...b,...c,...S})}catch(S){this.logger.warn(S)}return v}else this.logger.warn(`there was no format function for ${m}`);return h},n)}}const O1=(i,n)=>{i.pending[n]!==void 0&&(delete i.pending[n],i.pendingCount--)};class w1 extends fo{constructor(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=n,this.store=a,this.services=u,this.languageUtils=u.languageUtils,this.options=c,this.logger=On.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(u,c.backend,c)}queueLoad(n,a,u,c){const d={},f={},h={},g={};return n.forEach(m=>{let b=!0;a.forEach(v=>{const S=`${m}|${v}`;!u.reload&&this.store.hasResourceBundle(m,v)?this.state[S]=2:this.state[S]<0||(this.state[S]===1?f[S]===void 0&&(f[S]=!0):(this.state[S]=1,b=!1,f[S]===void 0&&(f[S]=!0),d[S]===void 0&&(d[S]=!0),g[v]===void 0&&(g[v]=!0)))}),b||(h[m]=!0)}),(Object.keys(d).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(d),pending:Object.keys(f),toLoadLanguages:Object.keys(h),toLoadNamespaces:Object.keys(g)}}loaded(n,a,u){const c=n.split("|"),d=c[0],f=c[1];a&&this.emit("failedLoading",d,f,a),!a&&u&&this.store.addResourceBundle(d,f,u,void 0,void 0,{skipCopy:!0}),this.state[n]=a?-1:2,a&&u&&(this.state[n]=0);const h={};this.queue.forEach(g=>{m1(g.loaded,[d],f),O1(g,n),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(m=>{h[m]||(h[m]={});const b=g.loaded[m];b.length&&b.forEach(v=>{h[m][v]===void 0&&(h[m][v]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(g=>!g.done)}read(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,f=arguments.length>5?arguments[5]:void 0;if(!n.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:n,ns:a,fcName:u,tried:c,wait:d,callback:f});return}this.readingCalls++;const h=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,n,a,u,c+1,d*2,f)},d);return}f(m,b)},g=this.backend[u].bind(this.backend);if(g.length===2){try{const m=g(n,a);m&&typeof m.then=="function"?m.then(b=>h(null,b)).catch(h):h(null,m)}catch(m){h(m)}return}return g(n,a,h)}prepareLoading(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();bt(n)&&(n=this.languageUtils.toResolveHierarchy(n)),bt(a)&&(a=[a]);const d=this.queueLoad(n,a,u,c);if(!d.toLoad.length)return d.pending.length||c(),null;d.toLoad.forEach(f=>{this.loadOne(f)})}load(n,a,u){this.prepareLoading(n,a,{},u)}reload(n,a,u){this.prepareLoading(n,a,{reload:!0},u)}loadOne(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const u=n.split("|"),c=u[0],d=u[1];this.read(c,d,"read",void 0,void 0,(f,h)=>{f&&this.logger.warn(`${a}loading namespace ${d} for language ${c} failed`,f),!f&&h&&this.logger.log(`${a}loaded namespace ${d} for language ${c}`,h),this.loaded(n,f,h)})}saveMissing(n,a,u,c,d){let f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${u}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(u==null||u==="")){if(this.backend?.create){const g={...f,isUpdate:d},m=this.backend.create.bind(this.backend);if(m.length<6)try{let b;m.length===5?b=m(n,a,u,c,g):b=m(n,a,u,c),b&&typeof b.then=="function"?b.then(v=>h(null,v)).catch(h):h(null,b)}catch(b){h(b)}else m(n,a,u,c,h,g)}!n||!n[0]||this.store.addResource(n[0],a,u,c)}}}const Ng=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let n={};if(typeof i[1]=="object"&&(n=i[1]),bt(i[1])&&(n.defaultValue=i[1]),bt(i[2])&&(n.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const a=i[3]||i[2];Object.keys(a).forEach(u=>{n[u]=a[u]})}return n},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Mg=i=>(bt(i.ns)&&(i.ns=[i.ns]),bt(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),bt(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),ho=()=>{},k1=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(a=>{typeof i[a]=="function"&&(i[a]=i[a].bind(i))})};class Ii extends fo{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Mg(n),this.services={},this.logger=On,this.modules={external:[]},k1(this),a&&!this.isInitialized&&!n.isClone){if(!this.options.initAsync)return this.init(n,a),this;setTimeout(()=>{this.init(n,a)},0)}}init(){var n=this;let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof a=="function"&&(u=a,a={}),a.defaultNS==null&&a.ns&&(bt(a.ns)?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));const c=Ng();this.options={...c,...this.options,...Mg(a)},this.options.interpolation={...c.interpolation,...this.options.interpolation},a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);const d=b=>b?typeof b=="function"?new b:b:null;if(!this.options.isClone){this.modules.logger?On.init(d(this.modules.logger),this.options):On.init(null,this.options);let b;this.modules.formatter?b=this.modules.formatter:b=A1;const v=new wg(this.options);this.store=new _g(this.options.resources,this.options);const S=this.services;S.logger=On,S.resourceStore=this.store,S.languageUtils=v,S.pluralResolver=new x1(v,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),b&&(!this.options.interpolation.format||this.options.interpolation.format===c.interpolation.format)&&(S.formatter=d(b),S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new _1(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new w1(d(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",function(A){for(var M=arguments.length,j=new Array(M>1?M-1:0),N=1;N<M;N++)j[N-1]=arguments[N];n.emit(A,...j)}),this.modules.languageDetector&&(S.languageDetector=d(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=d(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new No(this.services,this.options),this.translator.on("*",function(A){for(var M=arguments.length,j=new Array(M>1?M-1:0),N=1;N<M;N++)j[N-1]=arguments[N];n.emit(A,...j)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,u||(u=ho),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const b=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);b.length>0&&b[0]!=="dev"&&(this.options.lng=b[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(b=>{this[b]=function(){return n.store[b](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(b=>{this[b]=function(){return n.store[b](...arguments),n}});const g=mi(),m=()=>{const b=(v,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(S),u(v,S)};if(this.languages&&!this.isInitialized)return b(null,this.t.bind(this));this.changeLanguage(this.options.lng,b)};return this.options.resources||!this.options.initAsync?m():setTimeout(m,0),g}loadResources(n){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ho;const c=bt(n)?n:this.language;if(typeof n=="function"&&(u=n),!this.options.resources||this.options.partialBundledLanguages){if(c?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return u();const d=[],f=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(m=>{m!=="cimode"&&d.indexOf(m)<0&&d.push(m)})};c?f(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(h=>f(h)),this.services.backendConnector.load(d,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),u(h)})}else u(null)}reloadResources(n,a,u){const c=mi();return typeof n=="function"&&(u=n,n=void 0),typeof a=="function"&&(u=a,a=void 0),n||(n=this.languages),a||(a=this.options.ns),u||(u=ho),this.services.backendConnector.reload(n,a,d=>{c.resolve(),u(d)}),c}use(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&Cg.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}setResolvedLanguage(n){if(!(!n||!this.languages)&&!(["cimode","dev"].indexOf(n)>-1))for(let a=0;a<this.languages.length;a++){const u=this.languages[a];if(!(["cimode","dev"].indexOf(u)>-1)&&this.store.hasLanguageSomeTranslations(u)){this.resolvedLanguage=u;break}}}changeLanguage(n,a){var u=this;this.isLanguageChangingTo=n;const c=mi();this.emit("languageChanging",n);const d=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,m)=>{m?(d(m),this.translator.changeLanguage(m),this.isLanguageChangingTo=void 0,this.emit("languageChanged",m),this.logger.log("languageChanged",m)):this.isLanguageChangingTo=void 0,c.resolve(function(){return u.t(...arguments)}),a&&a(g,function(){return u.t(...arguments)})},h=g=>{!n&&!g&&this.services.languageDetector&&(g=[]);const m=bt(g)?g:this.services.languageUtils.getBestMatchFromCodes(g);m&&(this.language||d(m),this.translator.language||this.translator.changeLanguage(m),this.services.languageDetector?.cacheUserLanguage?.(m)),this.loadResources(m,b=>{f(b,m)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(n),c}getFixedT(n,a,u){var c=this;const d=function(f,h){let g;if(typeof h!="object"){for(var m=arguments.length,b=new Array(m>2?m-2:0),v=2;v<m;v++)b[v-2]=arguments[v];g=c.options.overloadTranslationOptionHandler([f,h].concat(b))}else g={...h};g.lng=g.lng||d.lng,g.lngs=g.lngs||d.lngs,g.ns=g.ns||d.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||u||d.keyPrefix);const S=c.options.keySeparator||".";let A;return g.keyPrefix&&Array.isArray(f)?A=f.map(M=>`${g.keyPrefix}${S}${M}`):A=g.keyPrefix?`${g.keyPrefix}${S}${f}`:f,c.t(A,g)};return bt(n)?d.lng=n:d.lngs=n,d.ns=a,d.keyPrefix=u,d}t(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.translator?.translate(...a)}exists(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.translator?.exists(...a)}setDefaultNamespace(n){this.options.defaultNS=n}hasLoadedNamespace(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const u=a.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,d=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;const f=(h,g)=>{const m=this.services.backendConnector.state[`${h}|${g}`];return m===-1||m===0||m===2};if(a.precheck){const h=a.precheck(this,f);if(h!==void 0)return h}return!!(this.hasResourceBundle(u,n)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(u,n)&&(!c||f(d,n)))}loadNamespaces(n,a){const u=mi();return this.options.ns?(bt(n)&&(n=[n]),n.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}loadLanguages(n,a){const u=mi();bt(n)&&(n=[n]);const c=this.options.preload||[],d=n.filter(f=>c.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return d.length?(this.options.preload=c.concat(d),this.loadResources(f=>{u.resolve(),a&&a(f)}),u):(a&&a(),Promise.resolve())}dir(n){if(n||(n=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!n)return"rtl";const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],u=this.services?.languageUtils||new wg(Ng());return a.indexOf(u.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;return new Ii(n,a)}cloneInstance(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ho;const u=n.forkResourceStore;u&&delete n.forkResourceStore;const c={...this.options,...n,isClone:!0},d=new Ii(c);if((n.debug!==void 0||n.prefix!==void 0)&&(d.logger=d.logger.clone(n)),["store","services","language"].forEach(h=>{d[h]=this[h]}),d.services={...this.services},d.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},u){const h=Object.keys(this.store.data).reduce((g,m)=>(g[m]={...this.store.data[m]},Object.keys(g[m]).reduce((b,v)=>(b[v]={...g[m][v]},b),{})),{});d.store=new _g(h,c),d.services.resourceStore=d.store}return d.translator=new No(d.services,c),d.translator.on("*",function(h){for(var g=arguments.length,m=new Array(g>1?g-1:0),b=1;b<g;b++)m[b-1]=arguments[b];d.emit(h,...m)}),d.init(c,a),d.translator.options=c,d.translator.backendConnector.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},d}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ft=Ii.createInstance();Ft.createInstance=Ii.createInstance,Ft.createInstance,Ft.dir,Ft.init,Ft.loadResources,Ft.reloadResources,Ft.use,Ft.changeLanguage,Ft.getFixedT,Ft.t,Ft.exists,Ft.setDefaultNamespace,Ft.hasLoadedNamespace,Ft.loadNamespaces,Ft.loadLanguages;const ea={checkConstraints:!0,cameraFacingMode:"user",cameraAutoStart:!1,measurementAutoStart:!1,cancelWhenLowSNR:!0},mo=i=>typeof i=="boolean",D1=i=>i==="user"||i==="environment",L1=i=>{if(!i||typeof i!="object"||i===null)return ea;const n=i;return{checkConstraints:mo(n.checkConstraints)?n.checkConstraints:ea.checkConstraints,cameraFacingMode:D1(n.cameraFacingMode)?n.cameraFacingMode:ea.cameraFacingMode,cameraAutoStart:mo(n.cameraAutoStart)?n.cameraAutoStart:ea.cameraAutoStart,measurementAutoStart:mo(n.measurementAutoStart)?n.measurementAutoStart:ea.measurementAutoStart,cancelWhenLowSNR:mo(n.cancelWhenLowSNR)?n.cancelWhenLowSNR:ea.cancelWhenLowSNR}},na=ta({config:ea,setConfig:i=>{na.config=i}});var N1=(i=>(i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NETWORK_ERROR="NETWORK_ERROR",i.UNSUPPORTED_BROWSER="UNSUPPORTED_BROWSER",i.TOKEN_RENEWAL_FAILED="TOKEN_RENEWAL_FAILED",i))(N1||{}),M1=(i=>(i.INFO="INFO",i.WARN="WARN",i.ERROR="ERROR",i))(M1||{});const Sn={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},mn={CAMERA_STARTED:{event:Sn.CAMERA_STARTED,level:"INFO"},APP_LOADED:{event:Sn.APP_LOADED,level:"INFO"},MEASUREMENT_PREPARED:{event:Sn.MEASUREMENT_PREPARED,level:"INFO"},ASSETS_DOWNLOADED:{event:Sn.ASSETS_DOWNLOADED,level:"INFO"},MEASUREMENT_STARTED:{event:Sn.MEASUREMENT_STARTED,level:"INFO"},MEASUREMENT_COMPLETED:{event:Sn.MEASUREMENT_COMPLETED,level:"INFO"},CAMERA_PERMISSION_GRANTED:{event:Sn.CAMERA_PERMISSION_GRANTED,level:"INFO"},INTERMEDIATE_RESULTS:{event:Sn.INTERMEDIATE_RESULTS,level:"INFO"},RESULTS_RECEIVED:{event:Sn.RESULTS_RECEIVED,level:"INFO"},PAGE_UNLOADED:{event:Sn.PAGE_UNLOADED,level:"INFO"},PAGE_VISIBILITY_CHANGE:{event:Sn.PAGE_VISIBILITY_CHANGE,level:"INFO"}};var Ke=(i=>(i.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",i.WORKER_ERROR="WORKER_ERROR",i.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",i.NO_DEVICES_FOUND="NO_DEVICES_FOUND",i.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",i.CAMERA_START_FAILED="CAMERA_START_FAILED",i.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",i.COLLECTOR="COLLECTOR",i.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",i.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",i))(Ke||{});const z1=process.env.IS_DEVELOPMENT,B1=()=>{const i=new Date,n=(i.getMonth()+1).toString().padStart(2,"0"),a=i.getDate().toString().padStart(2,"0"),u=i.getFullYear();let c=i.getHours();const d=i.getMinutes().toString().padStart(2,"0"),f=i.getSeconds().toString().padStart(2,"0"),h=i.getMilliseconds().toString().padStart(3,"0"),g=c>=12?"PM":"AM";return c=c%12||12,`[${n}/${a}/${u}, ${c}:${d}:${f}.${h} ${g}]`},Jt=ta({logs:[],addLog:(i,n,a)=>{if(z1)console.log(i);else{const u=B1(),c={message:i,category:n,timestamp:u,meta:a};Jt.logs.push(c)}},getLogs:()=>Jt.logs,clearLogs:()=>{Jt.logs=[]}}),fe={ANALYSIS_ERROR:"Analysis error occurred",LIVENESS_ERROR:"Liveness error occurred",CHUNK_SENT:"Chunk sent",COLLECTOR_ERROR:"Collector Error",MEDIA_ELEMENT_RESIZED:"Media element resized",CAMERA_START_FAILED:"Camera failed to start",CAMERA_PERMISSION_DENIED:"Camera permission denied",CAMERA_PERMISSION_GRANTED:"Camera permission granted",PAGE_NOT_VISIBLE:"Page not visible during measurement",MEASUREMENT_LOW_SNR:"Measurement canceled due to low SNR",MEASUREMENT_PREPARE_FAILED:"Measurement preparation failed",WORKER_ERROR:"Worker error occurred",PROFILE_BYPASS_ENABLED:"Profile bypass enabled",PROFILE_INVALID:"Profile invalid",PROFILE_SET:"Profile set",CAMERA_STOP_RESET_FAILED:"Camera stop/reset failed",CAMERA_STOPPED_AT_ANALYZING_START:"Camera stopped at analyzing start"};var ae=(i=>(i.measurement="Measurement",i.collector="Collector",i.camera="Camera",i.app="App",i))(ae||{});const xl={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"},gi={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};let pd=null;const j1=i=>{pd=i},_l=i=>{pd?pd.dispatchEvent(i):console.warn("Event dispatch failed: mountElement not set")},Cl=i=>{const n=new CustomEvent(xl.ERROR,{detail:i});_l(n)},Xe=(i,n={})=>{const{event:a,level:u}=i,c=new CustomEvent(xl.APPEVENT,{detail:{event:a,level:u,timestamp:new Date().toISOString(),...n}});_l(c)},{CameraController:U1}=d1,{CAMERA_STATUS:I1,SELECTED_DEVICE_CHANGED:$1,MEDIA_DEVICE_LIST_CHANGED:H1}=hi,xe=ta({deviceId:"",isPermissionGranted:!1,enumerationPhase:Rl.Idle,isOpen:!1,capabilities:null,mediaDevices:[],cameraStream:null,trackinfo:{cameraWidth:0,cameraHeight:0,cameraFrameRate:0},start:async(i,n)=>{const{cameraFacingMode:a}=na.config,u=await Qe.start(i,n,a);if(!u)return Jt.addLog(fe.CAMERA_START_FAILED,ae.camera),Cl({code:Ke.CAMERA_START_FAILED,message:""}),u;const{cameraWidth:c,cameraHeight:d,cameraFrameRate:f}=Qe;return xe.trackinfo={cameraWidth:c,cameraHeight:d,cameraFrameRate:f},u},stop:()=>{xe.isOpen&&Qe.stop(),xe.trackinfo={cameraWidth:0,cameraHeight:0,cameraFrameRate:0}},requestPermission:async()=>{const i=await Qe.requestPermission();xe.isPermissionGranted=i.success,xe.isPermissionGranted?(Xe(mn.CAMERA_PERMISSION_GRANTED),Jt.addLog(fe.CAMERA_PERMISSION_GRANTED,ae.camera,{})):(Jt.addLog(fe.CAMERA_PERMISSION_DENIED,ae.camera,{}),Cl({code:Ke.CAMERA_PERMISSION_DENIED,message:Ft.t("ERR_CAMERA_PERMISSION_DENIED")}))},listCameras:async()=>{xe.enumerationPhase=Rl.Enumerating,await Qe.list();const i=Qe.mediaDevices.map(a=>({device:{...a.device},capabilities:{...a.capabilities}}));xe.mediaDevices=[...i];const{cameraFacingMode:n}=na.config;if(n&&i.length>0){const a=G1(i,n);a&&(Qe.setDeviceId(a.device.deviceId),Jt.addLog(`Auto-selected ${n} camera: ${a.device.label}`,ae.camera))}xe.enumerationPhase=Rl.Done},updateDeviceId:i=>{Qe.setDeviceId(i)}}),G1=(i,n)=>i.find(a=>{const u=a.capabilities;return u&&"facingMode"in u&&u.facingMode?(Array.isArray(u.facingMode)?u.facingMode:[u.facingMode]).includes(n):!1})||null,Qe=U1.init(),F1=async i=>{const{deviceId:n}=i.detail;xe.deviceId=n},W1=async i=>{const{isOpen:n}=i.detail;if(n){const{capabilities:a}=i.detail;xe.capabilities=a,xe.cameraStream=Qe.cameraStream?a1(Qe.cameraStream):null}else xe.capabilities=null,xe.cameraStream=null;xe.isOpen=n},q1=async i=>{const{mediaDevices:n}=i.detail;xe.mediaDevices=n,xe.enumerationPhase=Rl.Done};Qe.addEventListener($1,F1),Qe.addEventListener(H1,q1),Qe.addEventListener(I1,W1);var zg="0.1.0-beta.2",Za=(i=>(i.DELETE="DELETE",i.GET="GET",i.PATCH="PATCH",i.POST="POST",i.PUT="PUT",i.CONNECT="CONNECT",i))(Za||{}),la=(i=>(i.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",i))(la||{});const Bg=typeof DedicatedWorkerGlobalScope<"u",po=async({baseUrl:i,urlFragment:n,method:a,headers:u,data:c},d)=>{const f=`${i}/${n}`;let h={Code:"",Message:""};try{const g=await fetch(f,{method:a,cache:"no-store",credentials:"include",headers:u,...c!=null&&{body:JSON.stringify(c)}}),m=g.headers.get("content-type"),b=g.status.toString();h={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},b==="503"&&(h={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),b==="429"&&(h={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),m!=null&&(m.startsWith("application/json;")&&(h=await g.json()),m.startsWith("text/plain;")&&(h={data:await g.text()}));let v=g.headers;if(Bg){const S={};g.headers.forEach((A,M)=>{S[M]=A}),v=S}try{d(b,b==="200"?void 0:h)}catch(S){console.error("Error running onAfterRESTCall callback",S)}return{status:b,headers:v,body:h}}catch(g){return g instanceof SyntaxError?h={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:h={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:Bg?{}:new Headers,body:h}}},go=()=>new Headers({"Content-Type":"application/json"});var Y1=Object.defineProperty,V1=(i,n,a)=>n in i?Y1(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,P1=(i,n,a)=>V1(i,n+"",a);class gd{constructor(n){P1(this,"parent"),this.parent=n}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:la.ON_BEFORE_REST_CALL_ERROR,Message:la.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(n){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:Za[n],headers:go()}}getHeaderWithDeviceToken(){const n=go();return n.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),n}getHeaderWithUserToken(){const n=go();return n.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),n}getHeaderWithSessionEnabled(){const n=go();return n.set("x-nura-session","true"),n}}class K1 extends gd{async create(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:n},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:f.ID}),{status:d,body:f,headers:h}}}class X1 extends gd{async retrieveSdkConfigData(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:n},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:f.ConfigFile,studyCfgHash:f.MD5Hash}),{status:d,body:f,headers:h}}}class Q1 extends gd{async renew(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:n},this.parent.onAfterRESTCall);if(d==="200"){const g=f.Token,m=f.RefreshToken,b={...a==="user"&&{userToken:g,userRefreshToken:m},...a==="device"&&{deviceToken:g,deviceRefreshToken:m}};this.parent.setSession(b)}return{status:d,body:f,headers:h}}async validate(n){const{Code:a,Message:u}=await this.onBeforeRESTCall();return a===la.ON_BEFORE_REST_CALL_ERROR?{status:a,body:{Code:a,Message:u},headers:new Headers}:await po({...this.getDefaults(Za.GET),headers:n==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Z1=Object.defineProperty,jg=i=>{throw TypeError(i)},J1=(i,n,a)=>n in i?Z1(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,bd=(i,n,a)=>J1(i,typeof n!="symbol"?n+"":n,a),Ug=(i,n,a)=>n.has(i)||jg("Cannot "+a),yd=(i,n,a)=>(Ug(i,n,"read from private field"),a?a.call(i):n.get(i)),Ig=(i,n,a)=>n.has(i)?jg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,a),bo=(i,n,a,u)=>(Ug(i,n,"write to private field"),n.set(i,a),a),bi,Ja;class tE{constructor(n){Ig(this,bi,{http:new URL("https://api.deepaffex.ai")}),Ig(this,Ja),bd(this,"onBeforeRESTCall"),bd(this,"onAfterRESTCall"),bd(this,"http"),bo(this,Ja,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new K1(this),studies:new X1(this),auths:new Q1(this)},this.onBeforeRESTCall=n?.onBeforeRESTCall?n.onBeforeRESTCall:()=>{},this.onAfterRESTCall=n?.onAfterRESTCall?n.onAfterRESTCall:()=>{},n?.url!=null&&bo(this,bi,n.url)}static new(n){return new this(n??void 0)}getUrl(){return JSON.stringify(yd(this,bi))}setUrl(n){bo(this,bi,{http:new URL(n)})}getSession(){return yd(this,Ja)}setSession(n){const a=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(n).every(d=>a.includes(d)&&typeof n[d]=="string")&&bo(this,Ja,{...yd(this,Ja),...n})}}bi=new WeakMap,Ja=new WeakMap;const eE=i=>tE.new(i);var nE=Object.defineProperty,$g=i=>{throw TypeError(i)},lE=(i,n,a)=>n in i?nE(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,aE=(i,n,a)=>lE(i,n+"",a),rE=(i,n,a)=>n.has(i)||$g("Cannot "+a),iE=(i,n,a)=>n.has(i)?$g("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,a),vd=(i,n,a)=>(rE(i,n,"access private method"),a),yi,Sd,Hg;let Gg=i=>new Int8Array(i);class uE extends EventTarget{constructor(){super(...arguments),iE(this,yi),aE(this,"canDecompress",!1)}static init(){return new this}dispatch(n,a){this.dispatchEvent(new CustomEvent(n,{detail:a}))}getBytesDownloadedEvent(n,a,u,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:n,uncompressedSize:a,url:u,done:c}})}getBytesDownloadErrorEvent(n,a){return new CustomEvent("downloadedError",{detail:{url:n,error:a}})}decompressBrotli(n){const a=atob(n),u=new Uint8Array(a.length);for(let f=0;f<a.length;f++)u[f]=a.charCodeAt(f);const c=new Int8Array(u.length);for(let f=0;f<u.length;f++)c[f]=u[f]>=128?u[f]-256:u[f];return Gg(c).buffer}async fetchAsset(n,a,u,c,d){const f=a+u,h=n.find(m=>m.file===u).uncompressedSize,g=(m,b,v,S)=>vd(this,yi,Sd).call(this,this.getBytesDownloadedEvent(m,b,v,S));try{const b=(await fetch(f)).body?.getReader();if(!b)throw new Error("Failed to get reader from response body.");let v=0;const S=new ReadableStream({async start(M){await j();async function j(){const{done:N,value:W}=await b.read();if(N){M.close(),g(v,h,f,!0);return}W&&(M.enqueue(W),v+=W.length,g(v,h,f,!1)),await j()}}}),A=new Response(S);if(c){const M=await A.json(),{base64EncodedValue:j}=M;if(d==="gzip"){await vd(this,yi,Hg).call(this,j);return}return this.decompressBrotli(j)}else return await A.arrayBuffer()}catch(m){vd(this,yi,Sd).call(this,this.getBytesDownloadErrorEvent(f,m))}}}yi=new WeakSet,Sd=function(i){this.dispatchEvent(i)},Hg=async function(i){const n=Uint8Array.from(atob(i),m=>m.charCodeAt(0)),u=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(u).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),f=new Blob([d],{type:"application/javascript"}),h=URL.createObjectURL(f);Gg=(await import(h)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(h)};var oE=Object.defineProperty,sE=(i,n,a)=>n in i?oE(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,Fg=(i,n,a)=>sE(i,typeof n!="symbol"?n+"":n,a);class cE{constructor(){Fg(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),Fg(this,"debugLogs",[])}appendLog(n){this.debugLogs.push(n)}transferLogs(){}generateHTMLTable(){return`
12
+ `,W)}if(b.type==="DISPATCH"&&b.state){if(((v=b.payload)==null?void 0:v.type)==="JUMP_TO_ACTION"||((S=b.payload)==null?void 0:S.type)==="JUMP_TO_STATE"){f=!0;const W=JSON.parse(b.state);Object.assign(i,W)}i[dd]=b}else if(b.type==="DISPATCH"&&((A=b.payload)==null?void 0:A.type)==="COMMIT")h.init(Pn(i));else if(b.type==="DISPATCH"&&((M=b.payload)==null?void 0:M.type)==="IMPORT_STATE"){const W=(j=b.payload.nextLiftedState)==null?void 0:j.actionsById,F=((N=b.payload.nextLiftedState)==null?void 0:N.computedStates)||[];f=!0,F.forEach(({state:Z},J)=>{const ut=W[J]||"No action found";Object.assign(i,Z),J===0?h.init(Pn(i)):h.send(ut,Pn(i))})}});return h.init(Pn(i)),()=>{g(),m?.()}}const i1=(i,n)=>{const a=ht.useRef(void 0);ht.useEffect(()=>{a.current=QS(i,n)}),ht.useDebugValue(a.current)},u1=i1,o1=new WeakMap;function ee(i,n){const u=ht.useMemo(()=>i&&new WeakMap,[i]),c=ht.useRef(void 0),d=ht.useRef(!1),f=ht.useSyncExternalStore(ht.useCallback(g=>{d.current=!0;const m=vg(i,g);return g(),()=>{m(),d.current=!1}},[i,void 0]),()=>{const g=Pn(i);try{if(d.current&&c.current&&!mg(c.current,g,u,new WeakMap))return c.current}catch{}return g},()=>Pn(i));ht.useLayoutEffect(()=>{c.current=f}),(import.meta.env?import.meta.env.MODE:void 0)!=="production"&&u1(f,u);const h=ht.useMemo(()=>new WeakMap,[]);return hg(f,u,h,o1)}var Rl=(i=>(i.Idle="idle",i.Enumerating="enumerating",i.Done="done",i))(Rl||{});const hi={CAMERA_STATUS:"cameraStatus",SELECTED_DEVICE_CHANGED:"selectedDeviceChanged",DEVICE_PIXEL_RATIO_CHANGED:"devicePixelRatioChanged",MEDIA_DEVICE_LIST_CHANGED:"mediaDeviceListChanged"},oo=i=>{let n=i.toFixed(2);return n==="0"&&(n=i.toPrecision(1)),Number(n)},s1=(i,n)=>{let a="";return n.length>0&&((!n.find(u=>u.device.deviceId===i)||i==="")&&(a=n[0].device.deviceId),n.find(u=>u.device.deviceId===i)&&(a=i)),a};let fd=null;class c1 extends EventTarget{mediaDevices=[];selectedDeviceId="";cameraStream=null;cameraWidth=0;cameraHeight=0;cameraFrameRate=0;settingsInputIds=["iso","exposureTime","focusDistance","colorTemperature","zoom"];standardSettingsIds=["contrast","saturation","sharpness","brightness","exposureCompensation"];videoTrackCapabilities={};#t=!1;constructor(){super(),navigator.mediaDevices.ondevicechange=async()=>{this.#t||(this.#t=!0,await this.list(),this.#t=!1)},this.updatePixelRatio=this.updatePixelRatio.bind(this),this.updatePixelRatio()}static init(){return new this}updatePixelRatio(){fd?.();const n=`(resolution: ${window.devicePixelRatio}dppx)`,a=matchMedia(n);a.addEventListener("change",this.updatePixelRatio),fd=()=>{a.removeEventListener("change",this.updatePixelRatio)},setTimeout(()=>{this.#i(this.#g())},1e3),this.#i(this.#g())}async enumerate(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(c=>c.kind==="videoinput").map(c=>{const d=c.getCapabilities();return{device:{label:c.label,deviceId:c.deviceId,kind:"videoinput",groupId:c.groupId},capabilities:d}})}catch(n){return console.error("Error enumerating devices:",n),[]}}async requestPermission(){try{return this.cameraStream=await navigator.mediaDevices.getUserMedia({video:!0}),{success:!0}}catch(n){return n instanceof DOMException&&n.name==="NotAllowedError"?(console.error("Camera permission denied."),{success:!1,error:"permission_denied",message:"Camera permission denied by user"}):n instanceof DOMException&&n.name==="NotFoundError"?(console.error("No camera devices found."),{success:!1,error:"no_devices",message:"No camera devices found on this system"}):(console.error("Error requesting camera permission:",n),{success:!1,error:"unknown",message:n instanceof Error?n.message:"Unknown error occurred"})}finally{this.stop()}}async list(){this.mediaDevices=await this.enumerate(),this.selectedDeviceId=s1(this.selectedDeviceId,this.mediaDevices),this.#i(this.#R()),this.#i(this.#S())}setDeviceId(n){this.mediaDevices.length&&this.mediaDevices.find(a=>a.device.deviceId===n)&&(this.selectedDeviceId=n,this.#i(this.#S()))}#a(){if(this.cameraStream){const[n]=this.cameraStream.getVideoTracks(),a=n.getSettings(),{width:u,height:c,frameRate:d}=a,f=n.getCapabilities();this.cameraWidth=u||0,this.cameraHeight=c||0,this.cameraFrameRate=d||0,this.videoTrackCapabilities=Object.fromEntries([...this.settingsInputIds,...this.standardSettingsIds].map(h=>{const g=f[h];return[h,{isSupported:!!g,min:g&&g.min?oo(g.min):0,max:g&&g.max?oo(g.max):0,step:g&&g.step?oo(g.step):0,value:g&&a[h]?oo(a[h]):0}]}))}}async#v(){const n={video:{width:640,height:360,deviceId:{exact:this.selectedDeviceId}}};this.cameraStream=await navigator.mediaDevices.getUserMedia(n),this.#a()}async start(n,a,u){this.stop();const c=navigator.mediaDevices.getSupportedConstraints();for(const f of["facingMode","aspectRatio"])if(!(f in c))throw new OverconstrainedError(f,"not supported");if(n/a!==16/9)throw new Error("Resolution must have a 16:9 aspect ratio.");const d={video:{...u?{facingMode:u}:{},deviceId:this.selectedDeviceId,aspectRatio:{exact:16/9},frameRate:{ideal:30,min:15,max:30},width:{ideal:n},height:{ideal:a}}};try{return this.cameraStream=await navigator.mediaDevices.getUserMedia(d),this.#a(),this.#i(this.#h(!0)),!0}catch(f){f.name!="OverconstrainedError"?console.log("Error opening camera",f):console.log(`This camera cannot produce the requested ${f.constraint}.`);try{return console.log("Attempt to open the camera with fallback resolution: 640 x 360 pixels"),await this.#v(),this.#i(this.#h(!0)),!0}catch(h){return console.error("Fallback resolution also failed.",h),!1}}}getVideoTrackCapabilities(){return this.videoTrackCapabilities}stop(){this.cameraStream&&(this.cameraStream.getTracks().forEach(n=>n.stop()),this.cameraStream=null,this.#i(this.#h(!1)),this.cameraWidth=0,this.cameraHeight=0,this.cameraFrameRate=0)}#h(n){return new CustomEvent(hi.CAMERA_STATUS,{detail:{isOpen:n,capabilities:this.videoTrackCapabilities}})}#S(){return new CustomEvent(hi.SELECTED_DEVICE_CHANGED,{detail:{deviceId:this.selectedDeviceId}})}#R(){return new CustomEvent(hi.MEDIA_DEVICE_LIST_CHANGED,{detail:{mediaDevices:this.mediaDevices}})}#g(){return new CustomEvent(hi.DEVICE_PIXEL_RATIO_CHANGED,{detail:{devicePixelRatio:window.devicePixelRatio}})}#i(n){this.dispatchEvent(n)}}const d1={CameraController:c1},bt=i=>typeof i=="string",mi=()=>{let i,n;const a=new Promise((u,c)=>{i=u,n=c});return a.resolve=i,a.reject=n,a},Sg=i=>i==null?"":""+i,f1=(i,n,a)=>{i.forEach(u=>{n[u]&&(a[u]=n[u])})},h1=/###/g,Eg=i=>i&&i.indexOf("###")>-1?i.replace(h1,"."):i,Tg=i=>!i||bt(i),pi=(i,n,a)=>{const u=bt(n)?n.split("."):n;let c=0;for(;c<u.length-1;){if(Tg(i))return{};const d=Eg(u[c]);!i[d]&&a&&(i[d]=new a),Object.prototype.hasOwnProperty.call(i,d)?i=i[d]:i={},++c}return Tg(i)?{}:{obj:i,k:Eg(u[c])}},Rg=(i,n,a)=>{const{obj:u,k:c}=pi(i,n,Object);if(u!==void 0||n.length===1){u[c]=a;return}let d=n[n.length-1],f=n.slice(0,n.length-1),h=pi(i,f,Object);for(;h.obj===void 0&&f.length;)d=`${f[f.length-1]}.${d}`,f=f.slice(0,f.length-1),h=pi(i,f,Object),h?.obj&&typeof h.obj[`${h.k}.${d}`]<"u"&&(h.obj=void 0);h.obj[`${h.k}.${d}`]=a},m1=(i,n,a,u)=>{const{obj:c,k:d}=pi(i,n,Object);c[d]=c[d]||[],c[d].push(a)},so=(i,n)=>{const{obj:a,k:u}=pi(i,n);if(a&&Object.prototype.hasOwnProperty.call(a,u))return a[u]},p1=(i,n,a)=>{const u=so(i,a);return u!==void 0?u:so(n,a)},xg=(i,n,a)=>{for(const u in n)u!=="__proto__"&&u!=="constructor"&&(u in i?bt(i[u])||i[u]instanceof String||bt(n[u])||n[u]instanceof String?a&&(i[u]=n[u]):xg(i[u],n[u],a):i[u]=n[u]);return i},Xa=i=>i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var g1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const b1=i=>bt(i)?i.replace(/[&<>"'\/]/g,n=>g1[n]):i;class y1{constructor(n){this.capacity=n,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(n){const a=this.regExpMap.get(n);if(a!==void 0)return a;const u=new RegExp(n);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(n,u),this.regExpQueue.push(n),u}}const v1=[" ",",","?","!",";"],S1=new y1(20),E1=(i,n,a)=>{n=n||"",a=a||"";const u=v1.filter(f=>n.indexOf(f)<0&&a.indexOf(f)<0);if(u.length===0)return!0;const c=S1.getRegExp(`(${u.map(f=>f==="?"?"\\?":f).join("|")})`);let d=!c.test(i);if(!d){const f=i.indexOf(a);f>0&&!c.test(i.substring(0,f))&&(d=!0)}return d},hd=function(i,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!i)return;if(i[n])return Object.prototype.hasOwnProperty.call(i,n)?i[n]:void 0;const u=n.split(a);let c=i;for(let d=0;d<u.length;){if(!c||typeof c!="object")return;let f,h="";for(let g=d;g<u.length;++g)if(g!==d&&(h+=a),h+=u[g],f=c[h],f!==void 0){if(["string","number","boolean"].indexOf(typeof f)>-1&&g<u.length-1)continue;d+=g-d+1;break}c=f}return c},co=i=>i?.replace("_","-"),T1={type:"logger",log(i){this.output("log",i)},warn(i){this.output("warn",i)},error(i){this.output("error",i)},output(i,n){console?.[i]?.apply?.(console,n)}};let R1=class Ud{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(n,a)}init(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=a.prefix||"i18next:",this.logger=n||T1,this.options=a,this.debug=a.debug}log(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"log","",!0)}warn(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"warn","",!0)}error(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"error","")}deprecate(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.forward(a,"warn","WARNING DEPRECATED: ",!0)}forward(n,a,u,c){return c&&!this.debug?null:(bt(n[0])&&(n[0]=`${u}${this.prefix} ${n[0]}`),this.logger[a](n))}create(n){return new Ud(this.logger,{prefix:`${this.prefix}:${n}:`,...this.options})}clone(n){return n=n||this.options,n.prefix=n.prefix||this.prefix,new Ud(this.logger,n)}};var On=new R1;class fo{constructor(){this.observers={}}on(n,a){return n.split(" ").forEach(u=>{this.observers[u]||(this.observers[u]=new Map);const c=this.observers[u].get(a)||0;this.observers[u].set(a,c+1)}),this}off(n,a){if(this.observers[n]){if(!a){delete this.observers[n];return}this.observers[n].delete(a)}}emit(n){for(var a=arguments.length,u=new Array(a>1?a-1:0),c=1;c<a;c++)u[c-1]=arguments[c];this.observers[n]&&Array.from(this.observers[n].entries()).forEach(f=>{let[h,g]=f;for(let m=0;m<g;m++)h(...u)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(f=>{let[h,g]=f;for(let m=0;m<g;m++)h.apply(h,[n,...u])})}}class _g extends fo{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=n||{},this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(n){this.options.ns.indexOf(n)<0&&this.options.ns.push(n)}removeNamespaces(n){const a=this.options.ns.indexOf(n);a>-1&&this.options.ns.splice(a,1)}getResource(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const d=c.keySeparator!==void 0?c.keySeparator:this.options.keySeparator,f=c.ignoreJSONStructure!==void 0?c.ignoreJSONStructure:this.options.ignoreJSONStructure;let h;n.indexOf(".")>-1?h=n.split("."):(h=[n,a],u&&(Array.isArray(u)?h.push(...u):bt(u)&&d?h.push(...u.split(d)):h.push(u)));const g=so(this.data,h);return!g&&!a&&!u&&n.indexOf(".")>-1&&(n=h[0],a=h[1],u=h.slice(2).join(".")),g||!f||!bt(u)?g:hd(this.data?.[n]?.[a],u,d)}addResource(n,a,u,c){let d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const f=d.keySeparator!==void 0?d.keySeparator:this.options.keySeparator;let h=[n,a];u&&(h=h.concat(f?u.split(f):u)),n.indexOf(".")>-1&&(h=n.split("."),c=a,a=h[1]),this.addNamespaces(a),Rg(this.data,h,c),d.silent||this.emit("added",n,a,u,c)}addResources(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const d in u)(bt(u[d])||Array.isArray(u[d]))&&this.addResource(n,a,d,u[d],{silent:!0});c.silent||this.emit("added",n,a,u)}addResourceBundle(n,a,u,c,d){let f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},h=[n,a];n.indexOf(".")>-1&&(h=n.split("."),c=u,u=a,a=h[1]),this.addNamespaces(a);let g=so(this.data,h)||{};f.skipCopy||(u=JSON.parse(JSON.stringify(u))),c?xg(g,u,d):g={...g,...u},Rg(this.data,h,g),f.silent||this.emit("added",n,a,u)}removeResourceBundle(n,a){this.hasResourceBundle(n,a)&&delete this.data[n][a],this.removeNamespaces(a),this.emit("removed",n,a)}hasResourceBundle(n,a){return this.getResource(n,a)!==void 0}getResourceBundle(n,a){return a||(a=this.options.defaultNS),this.getResource(n,a)}getDataByLanguage(n){return this.data[n]}hasLanguageSomeTranslations(n){const a=this.getDataByLanguage(n);return!!(a&&Object.keys(a)||[]).find(c=>a[c]&&Object.keys(a[c]).length>0)}toJSON(){return this.data}}var Cg={processors:{},addPostProcessor(i){this.processors[i.name]=i},handle(i,n,a,u,c){return i.forEach(d=>{n=this.processors[d]?.process(n,a,u,c)??n}),n}};const Ag={},Og=i=>!bt(i)&&typeof i!="boolean"&&typeof i!="number";class No extends fo{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),f1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],n,this),this.options=a,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=On.create("translator")}changeLanguage(n){n&&(this.language=n)}exists(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};return n==null?!1:this.resolve(n,a)?.res!==void 0}extractFromKey(n,a){let u=a.nsSeparator!==void 0?a.nsSeparator:this.options.nsSeparator;u===void 0&&(u=":");const c=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let d=a.ns||this.options.defaultNS||[];const f=u&&n.indexOf(u)>-1,h=!this.options.userDefinedKeySeparator&&!a.keySeparator&&!this.options.userDefinedNsSeparator&&!a.nsSeparator&&!E1(n,u,c);if(f&&!h){const g=n.match(this.interpolator.nestingRegexp);if(g&&g.length>0)return{key:n,namespaces:bt(d)?[d]:d};const m=n.split(u);(u!==c||u===c&&this.options.ns.indexOf(m[0])>-1)&&(d=m.shift()),n=m.join(c)}return{key:n,namespaces:bt(d)?[d]:d}}translate(n,a,u){if(typeof a!="object"&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),typeof a=="object"&&(a={...a}),a||(a={}),n==null)return"";Array.isArray(n)||(n=[String(n)]);const c=a.returnDetails!==void 0?a.returnDetails:this.options.returnDetails,d=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,{key:f,namespaces:h}=this.extractFromKey(n[n.length-1],a),g=h[h.length-1],m=a.lng||this.language,b=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(m?.toLowerCase()==="cimode"){if(b){const et=a.nsSeparator||this.options.nsSeparator;return c?{res:`${g}${et}${f}`,usedKey:f,exactUsedKey:f,usedLng:m,usedNS:g,usedParams:this.getUsedParamsDetails(a)}:`${g}${et}${f}`}return c?{res:f,usedKey:f,exactUsedKey:f,usedLng:m,usedNS:g,usedParams:this.getUsedParamsDetails(a)}:f}const v=this.resolve(n,a);let S=v?.res;const A=v?.usedKey||f,M=v?.exactUsedKey||f,j=["[object Number]","[object Function]","[object RegExp]"],N=a.joinArrays!==void 0?a.joinArrays:this.options.joinArrays,W=!this.i18nFormat||this.i18nFormat.handleAsObject,F=a.count!==void 0&&!bt(a.count),Z=No.hasDefaultValue(a),J=F?this.pluralResolver.getSuffix(m,a.count,a):"",ut=a.ordinal&&F?this.pluralResolver.getSuffix(m,a.count,{ordinal:!1}):"",q=F&&!a.ordinal&&a.count===0,k=q&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${J}`]||a[`defaultValue${ut}`]||a.defaultValue;let Y=S;W&&!S&&Z&&(Y=k);const pt=Og(Y),Rt=Object.prototype.toString.apply(Y);if(W&&Y&&pt&&j.indexOf(Rt)<0&&!(bt(N)&&Array.isArray(Y))){if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const et=this.options.returnedObjectHandler?this.options.returnedObjectHandler(A,Y,{...a,ns:h}):`key '${f} (${this.language})' returned an object instead of string.`;return c?(v.res=et,v.usedParams=this.getUsedParamsDetails(a),v):et}if(d){const et=Array.isArray(Y),tt=et?[]:{},At=et?M:A;for(const Q in Y)if(Object.prototype.hasOwnProperty.call(Y,Q)){const V=`${At}${d}${Q}`;Z&&!S?tt[Q]=this.translate(V,{...a,defaultValue:Og(k)?k[Q]:void 0,joinArrays:!1,ns:h}):tt[Q]=this.translate(V,{...a,joinArrays:!1,ns:h}),tt[Q]===V&&(tt[Q]=Y[Q])}S=tt}}else if(W&&bt(N)&&Array.isArray(S))S=S.join(N),S&&(S=this.extendTranslation(S,n,a,u));else{let et=!1,tt=!1;!this.isValidLookup(S)&&Z&&(et=!0,S=k),this.isValidLookup(S)||(tt=!0,S=f);const Q=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&tt?void 0:S,V=Z&&k!==S&&this.options.updateMissing;if(tt||et||V){if(this.logger.log(V?"updateKey":"missingKey",m,g,f,V?k:S),d){const P=this.resolve(f,{...a,keySeparator:!1});P&&P.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let C=[];const z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if(this.options.saveMissingTo==="fallback"&&z&&z[0])for(let P=0;P<z.length;P++)C.push(z[P]);else this.options.saveMissingTo==="all"?C=this.languageUtils.toResolveHierarchy(a.lng||this.language):C.push(a.lng||this.language);const X=(P,ft,T)=>{const U=Z&&T!==S?T:Q;this.options.missingKeyHandler?this.options.missingKeyHandler(P,g,ft,U,V,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(P,g,ft,U,V,a),this.emit("missingKey",P,g,ft,S)};this.options.saveMissing&&(this.options.saveMissingPlurals&&F?C.forEach(P=>{const ft=this.pluralResolver.getSuffixes(P,a);q&&a[`defaultValue${this.options.pluralSeparator}zero`]&&ft.indexOf(`${this.options.pluralSeparator}zero`)<0&&ft.push(`${this.options.pluralSeparator}zero`),ft.forEach(T=>{X([P],f+T,a[`defaultValue${T}`]||k)})}):X(C,f,k))}S=this.extendTranslation(S,n,a,v,u),tt&&S===f&&this.options.appendNamespaceToMissingKey&&(S=`${g}:${f}`),(tt||et)&&this.options.parseMissingKeyHandler&&(S=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${g}:${f}`:f,et?S:void 0))}return c?(v.res=S,v.usedParams=this.getUsedParamsDetails(a),v):S}extendTranslation(n,a,u,c,d){var f=this;if(this.i18nFormat?.parse)n=this.i18nFormat.parse(n,{...this.options.interpolation.defaultVariables,...u},u.lng||this.language||c.usedLng,c.usedNS,c.usedKey,{resolved:c});else if(!u.skipInterpolation){u.interpolation&&this.interpolator.init({...u,interpolation:{...this.options.interpolation,...u.interpolation}});const m=bt(n)&&(u?.interpolation?.skipOnVariables!==void 0?u.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let b;if(m){const S=n.match(this.interpolator.nestingRegexp);b=S&&S.length}let v=u.replace&&!bt(u.replace)?u.replace:u;if(this.options.interpolation.defaultVariables&&(v={...this.options.interpolation.defaultVariables,...v}),n=this.interpolator.interpolate(n,v,u.lng||this.language||c.usedLng,u),m){const S=n.match(this.interpolator.nestingRegexp),A=S&&S.length;b<A&&(u.nest=!1)}!u.lng&&c&&c.res&&(u.lng=this.language||c.usedLng),u.nest!==!1&&(n=this.interpolator.nest(n,function(){for(var S=arguments.length,A=new Array(S),M=0;M<S;M++)A[M]=arguments[M];return d?.[0]===A[0]&&!u.context?(f.logger.warn(`It seems you are nesting recursively key: ${A[0]} in key: ${a[0]}`),null):f.translate(...A,a)},u)),u.interpolation&&this.interpolator.reset()}const h=u.postProcess||this.options.postProcess,g=bt(h)?[h]:h;return n!=null&&g?.length&&u.applyPostProcessor!==!1&&(n=Cg.handle(g,n,a,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...c,usedParams:this.getUsedParamsDetails(u)},...u}:u,this)),n}resolve(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u,c,d,f,h;return bt(n)&&(n=[n]),n.forEach(g=>{if(this.isValidLookup(u))return;const m=this.extractFromKey(g,a),b=m.key;c=b;let v=m.namespaces;this.options.fallbackNS&&(v=v.concat(this.options.fallbackNS));const S=a.count!==void 0&&!bt(a.count),A=S&&!a.ordinal&&a.count===0,M=a.context!==void 0&&(bt(a.context)||typeof a.context=="number")&&a.context!=="",j=a.lngs?a.lngs:this.languageUtils.toResolveHierarchy(a.lng||this.language,a.fallbackLng);v.forEach(N=>{this.isValidLookup(u)||(h=N,!Ag[`${j[0]}-${N}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(h)&&(Ag[`${j[0]}-${N}`]=!0,this.logger.warn(`key "${c}" for languages "${j.join(", ")}" won't get resolved as namespace "${h}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),j.forEach(W=>{if(this.isValidLookup(u))return;f=W;const F=[b];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(F,b,W,N,a);else{let J;S&&(J=this.pluralResolver.getSuffix(W,a.count,a));const ut=`${this.options.pluralSeparator}zero`,q=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(S&&(F.push(b+J),a.ordinal&&J.indexOf(q)===0&&F.push(b+J.replace(q,this.options.pluralSeparator)),A&&F.push(b+ut)),M){const k=`${b}${this.options.contextSeparator}${a.context}`;F.push(k),S&&(F.push(k+J),a.ordinal&&J.indexOf(q)===0&&F.push(k+J.replace(q,this.options.pluralSeparator)),A&&F.push(k+ut))}}let Z;for(;Z=F.pop();)this.isValidLookup(u)||(d=Z,u=this.getResource(W,N,Z,a))}))})}),{res:u,usedKey:c,exactUsedKey:d,usedLng:f,usedNS:h}}isValidLookup(n){return n!==void 0&&!(!this.options.returnNull&&n===null)&&!(!this.options.returnEmptyString&&n==="")}getResource(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(n,a,u,c):this.resourceStore.getResource(n,a,u,c)}getUsedParamsDetails(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],u=n.replace&&!bt(n.replace);let c=u?n.replace:n;if(u&&typeof n.count<"u"&&(c.count=n.count),this.options.interpolation.defaultVariables&&(c={...this.options.interpolation.defaultVariables,...c}),!u){c={...c};for(const d of a)delete c[d]}return c}static hasDefaultValue(n){const a="defaultValue";for(const u in n)if(Object.prototype.hasOwnProperty.call(n,u)&&a===u.substring(0,a.length)&&n[u]!==void 0)return!0;return!1}}class wg{constructor(n){this.options=n,this.supportedLngs=this.options.supportedLngs||!1,this.logger=On.create("languageUtils")}getScriptPartFromCode(n){if(n=co(n),!n||n.indexOf("-")<0)return null;const a=n.split("-");return a.length===2||(a.pop(),a[a.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(a.join("-"))}getLanguagePartFromCode(n){if(n=co(n),!n||n.indexOf("-")<0)return n;const a=n.split("-");return this.formatLanguageCode(a[0])}formatLanguageCode(n){if(bt(n)&&n.indexOf("-")>-1){let a;try{a=Intl.getCanonicalLocales(n)[0]}catch{}return a&&this.options.lowerCaseLng&&(a=a.toLowerCase()),a||(this.options.lowerCaseLng?n.toLowerCase():n)}return this.options.cleanCode||this.options.lowerCaseLng?n.toLowerCase():n}isSupportedCode(n){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(n=this.getLanguagePartFromCode(n)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(n)>-1}getBestMatchFromCodes(n){if(!n)return null;let a;return n.forEach(u=>{if(a)return;const c=this.formatLanguageCode(u);(!this.options.supportedLngs||this.isSupportedCode(c))&&(a=c)}),!a&&this.options.supportedLngs&&n.forEach(u=>{if(a)return;const c=this.getLanguagePartFromCode(u);if(this.isSupportedCode(c))return a=c;a=this.options.supportedLngs.find(d=>{if(d===c)return d;if(!(d.indexOf("-")<0&&c.indexOf("-")<0)&&(d.indexOf("-")>0&&c.indexOf("-")<0&&d.substring(0,d.indexOf("-"))===c||d.indexOf(c)===0&&c.length>1))return d})}),a||(a=this.getFallbackCodes(this.options.fallbackLng)[0]),a}getFallbackCodes(n,a){if(!n)return[];if(typeof n=="function"&&(n=n(a)),bt(n)&&(n=[n]),Array.isArray(n))return n;if(!a)return n.default||[];let u=n[a];return u||(u=n[this.getScriptPartFromCode(a)]),u||(u=n[this.formatLanguageCode(a)]),u||(u=n[this.getLanguagePartFromCode(a)]),u||(u=n.default),u||[]}toResolveHierarchy(n,a){const u=this.getFallbackCodes(a||this.options.fallbackLng||[],n),c=[],d=f=>{f&&(this.isSupportedCode(f)?c.push(f):this.logger.warn(`rejecting language code not found in supportedLngs: ${f}`))};return bt(n)&&(n.indexOf("-")>-1||n.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&d(this.formatLanguageCode(n)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&d(this.getScriptPartFromCode(n)),this.options.load!=="currentOnly"&&d(this.getLanguagePartFromCode(n))):bt(n)&&d(this.formatLanguageCode(n)),u.forEach(f=>{c.indexOf(f)<0&&d(this.formatLanguageCode(f))}),c}}const kg={zero:0,one:1,two:2,few:3,many:4,other:5},Dg={select:i=>i===1?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class x1{constructor(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=n,this.options=a,this.logger=On.create("pluralResolver"),this.pluralRulesCache={}}addRule(n,a){this.rules[n]=a}clearCache(){this.pluralRulesCache={}}getRule(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const u=co(n==="dev"?"en":n),c=a.ordinal?"ordinal":"cardinal",d=JSON.stringify({cleanedCode:u,type:c});if(d in this.pluralRulesCache)return this.pluralRulesCache[d];let f;try{f=new Intl.PluralRules(u,{type:c})}catch{if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),Dg;if(!n.match(/-|_/))return Dg;const g=this.languageUtils.getLanguagePartFromCode(n);f=this.getRule(g,a)}return this.pluralRulesCache[d]=f,f}needsPlural(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=this.getRule(n,a);return u||(u=this.getRule("dev",a)),u?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(n,u).map(c=>`${a}${c}`)}getSuffixes(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=this.getRule(n,a);return u||(u=this.getRule("dev",a)),u?u.resolvedOptions().pluralCategories.sort((c,d)=>kg[c]-kg[d]).map(c=>`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${c}`):[]}getSuffix(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const c=this.getRule(n,u);return c?`${this.options.prepend}${u.ordinal?`ordinal${this.options.prepend}`:""}${c.select(a)}`:(this.logger.warn(`no plural rule found for: ${n}`),this.getSuffix("dev",a,u))}}const Lg=function(i,n,a){let u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,d=p1(i,n,a);return!d&&c&&bt(a)&&(d=hd(i,a,u),d===void 0&&(d=hd(n,a,u))),d},md=i=>i.replace(/\$/g,"$$$$");class _1{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=On.create("interpolator"),this.options=n,this.format=n?.interpolation?.format||(a=>a),this.init(n)}init(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n.interpolation||(n.interpolation={escapeValue:!0});const{escape:a,escapeValue:u,useRawValueToEscape:c,prefix:d,prefixEscaped:f,suffix:h,suffixEscaped:g,formatSeparator:m,unescapeSuffix:b,unescapePrefix:v,nestingPrefix:S,nestingPrefixEscaped:A,nestingSuffix:M,nestingSuffixEscaped:j,nestingOptionsSeparator:N,maxReplaces:W,alwaysFormat:F}=n.interpolation;this.escape=a!==void 0?a:b1,this.escapeValue=u!==void 0?u:!0,this.useRawValueToEscape=c!==void 0?c:!1,this.prefix=d?Xa(d):f||"{{",this.suffix=h?Xa(h):g||"}}",this.formatSeparator=m||",",this.unescapePrefix=b?"":v||"-",this.unescapeSuffix=this.unescapePrefix?"":b||"",this.nestingPrefix=S?Xa(S):A||Xa("$t("),this.nestingSuffix=M?Xa(M):j||Xa(")"),this.nestingOptionsSeparator=N||",",this.maxReplaces=W||1e3,this.alwaysFormat=F!==void 0?F:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const n=(a,u)=>a?.source===u?(a.lastIndex=0,a):new RegExp(u,"g");this.regexp=n(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=n(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=n(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(n,a,u,c){let d,f,h;const g=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},m=A=>{if(A.indexOf(this.formatSeparator)<0){const W=Lg(a,g,A,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(W,void 0,u,{...c,...a,interpolationkey:A}):W}const M=A.split(this.formatSeparator),j=M.shift().trim(),N=M.join(this.formatSeparator).trim();return this.format(Lg(a,g,j,this.options.keySeparator,this.options.ignoreJSONStructure),N,u,{...c,...a,interpolationkey:j})};this.resetRegExp();const b=c?.missingInterpolationHandler||this.options.missingInterpolationHandler,v=c?.interpolation?.skipOnVariables!==void 0?c.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:A=>md(A)},{regex:this.regexp,safeValue:A=>this.escapeValue?md(this.escape(A)):md(A)}].forEach(A=>{for(h=0;d=A.regex.exec(n);){const M=d[1].trim();if(f=m(M),f===void 0)if(typeof b=="function"){const N=b(n,d,c);f=bt(N)?N:""}else if(c&&Object.prototype.hasOwnProperty.call(c,M))f="";else if(v){f=d[0];continue}else this.logger.warn(`missed to pass in variable ${M} for interpolating ${n}`),f="";else!bt(f)&&!this.useRawValueToEscape&&(f=Sg(f));const j=A.safeValue(f);if(n=n.replace(d[0],j),v?(A.regex.lastIndex+=f.length,A.regex.lastIndex-=d[0].length):A.regex.lastIndex=0,h++,h>=this.maxReplaces)break}}),n}nest(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c,d,f;const h=(g,m)=>{const b=this.nestingOptionsSeparator;if(g.indexOf(b)<0)return g;const v=g.split(new RegExp(`${b}[ ]*{`));let S=`{${v[1]}`;g=v[0],S=this.interpolate(S,f);const A=S.match(/'/g),M=S.match(/"/g);((A?.length??0)%2===0&&!M||M.length%2!==0)&&(S=S.replace(/'/g,'"'));try{f=JSON.parse(S),m&&(f={...m,...f})}catch(j){return this.logger.warn(`failed parsing options string in nesting for key ${g}`,j),`${g}${b}${S}`}return f.defaultValue&&f.defaultValue.indexOf(this.prefix)>-1&&delete f.defaultValue,g};for(;c=this.nestingRegexp.exec(n);){let g=[];f={...u},f=f.replace&&!bt(f.replace)?f.replace:f,f.applyPostProcessor=!1,delete f.defaultValue;let m=!1;if(c[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(c[1])){const b=c[1].split(this.formatSeparator).map(v=>v.trim());c[1]=b.shift(),g=b,m=!0}if(d=a(h.call(this,c[1].trim(),f),f),d&&c[0]===n&&!bt(d))return d;bt(d)||(d=Sg(d)),d||(this.logger.warn(`missed to resolve ${c[1]} for nesting ${n}`),d=""),m&&(d=g.reduce((b,v)=>this.format(b,v,u.lng,{...u,interpolationkey:c[1].trim()}),d.trim())),n=n.replace(c[0],d),this.regexp.lastIndex=0}return n}}const C1=i=>{let n=i.toLowerCase().trim();const a={};if(i.indexOf("(")>-1){const u=i.split("(");n=u[0].toLowerCase().trim();const c=u[1].substring(0,u[1].length-1);n==="currency"&&c.indexOf(":")<0?a.currency||(a.currency=c.trim()):n==="relativetime"&&c.indexOf(":")<0?a.range||(a.range=c.trim()):c.split(";").forEach(f=>{if(f){const[h,...g]=f.split(":"),m=g.join(":").trim().replace(/^'+|'+$/g,""),b=h.trim();a[b]||(a[b]=m),m==="false"&&(a[b]=!1),m==="true"&&(a[b]=!0),isNaN(m)||(a[b]=parseInt(m,10))}})}return{formatName:n,formatOptions:a}},Qa=i=>{const n={};return(a,u,c)=>{let d=c;c&&c.interpolationkey&&c.formatParams&&c.formatParams[c.interpolationkey]&&c[c.interpolationkey]&&(d={...d,[c.interpolationkey]:void 0});const f=u+JSON.stringify(d);let h=n[f];return h||(h=i(co(u),c),n[f]=h),h(a)}};class A1{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=On.create("formatter"),this.options=n,this.formats={number:Qa((a,u)=>{const c=new Intl.NumberFormat(a,{...u});return d=>c.format(d)}),currency:Qa((a,u)=>{const c=new Intl.NumberFormat(a,{...u,style:"currency"});return d=>c.format(d)}),datetime:Qa((a,u)=>{const c=new Intl.DateTimeFormat(a,{...u});return d=>c.format(d)}),relativetime:Qa((a,u)=>{const c=new Intl.RelativeTimeFormat(a,{...u});return d=>c.format(d,u.range||"day")}),list:Qa((a,u)=>{const c=new Intl.ListFormat(a,{...u});return d=>c.format(d)})},this.init(n)}init(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=a.interpolation.formatSeparator||","}add(n,a){this.formats[n.toLowerCase().trim()]=a}addCached(n,a){this.formats[n.toLowerCase().trim()]=Qa(a)}format(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const d=a.split(this.formatSeparator);if(d.length>1&&d[0].indexOf("(")>1&&d[0].indexOf(")")<0&&d.find(h=>h.indexOf(")")>-1)){const h=d.findIndex(g=>g.indexOf(")")>-1);d[0]=[d[0],...d.splice(1,h)].join(this.formatSeparator)}return d.reduce((h,g)=>{const{formatName:m,formatOptions:b}=C1(g);if(this.formats[m]){let v=h;try{const S=c?.formatParams?.[c.interpolationkey]||{},A=S.locale||S.lng||c.locale||c.lng||u;v=this.formats[m](h,A,{...b,...c,...S})}catch(S){this.logger.warn(S)}return v}else this.logger.warn(`there was no format function for ${m}`);return h},n)}}const O1=(i,n)=>{i.pending[n]!==void 0&&(delete i.pending[n],i.pendingCount--)};class w1 extends fo{constructor(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=n,this.store=a,this.services=u,this.languageUtils=u.languageUtils,this.options=c,this.logger=On.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=c.maxParallelReads||10,this.readingCalls=0,this.maxRetries=c.maxRetries>=0?c.maxRetries:5,this.retryTimeout=c.retryTimeout>=1?c.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(u,c.backend,c)}queueLoad(n,a,u,c){const d={},f={},h={},g={};return n.forEach(m=>{let b=!0;a.forEach(v=>{const S=`${m}|${v}`;!u.reload&&this.store.hasResourceBundle(m,v)?this.state[S]=2:this.state[S]<0||(this.state[S]===1?f[S]===void 0&&(f[S]=!0):(this.state[S]=1,b=!1,f[S]===void 0&&(f[S]=!0),d[S]===void 0&&(d[S]=!0),g[v]===void 0&&(g[v]=!0)))}),b||(h[m]=!0)}),(Object.keys(d).length||Object.keys(f).length)&&this.queue.push({pending:f,pendingCount:Object.keys(f).length,loaded:{},errors:[],callback:c}),{toLoad:Object.keys(d),pending:Object.keys(f),toLoadLanguages:Object.keys(h),toLoadNamespaces:Object.keys(g)}}loaded(n,a,u){const c=n.split("|"),d=c[0],f=c[1];a&&this.emit("failedLoading",d,f,a),!a&&u&&this.store.addResourceBundle(d,f,u,void 0,void 0,{skipCopy:!0}),this.state[n]=a?-1:2,a&&u&&(this.state[n]=0);const h={};this.queue.forEach(g=>{m1(g.loaded,[d],f),O1(g,n),a&&g.errors.push(a),g.pendingCount===0&&!g.done&&(Object.keys(g.loaded).forEach(m=>{h[m]||(h[m]={});const b=g.loaded[m];b.length&&b.forEach(v=>{h[m][v]===void 0&&(h[m][v]=!0)})}),g.done=!0,g.errors.length?g.callback(g.errors):g.callback())}),this.emit("loaded",h),this.queue=this.queue.filter(g=>!g.done)}read(n,a,u){let c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,f=arguments.length>5?arguments[5]:void 0;if(!n.length)return f(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:n,ns:a,fcName:u,tried:c,wait:d,callback:f});return}this.readingCalls++;const h=(m,b)=>{if(this.readingCalls--,this.waitingReads.length>0){const v=this.waitingReads.shift();this.read(v.lng,v.ns,v.fcName,v.tried,v.wait,v.callback)}if(m&&b&&c<this.maxRetries){setTimeout(()=>{this.read.call(this,n,a,u,c+1,d*2,f)},d);return}f(m,b)},g=this.backend[u].bind(this.backend);if(g.length===2){try{const m=g(n,a);m&&typeof m.then=="function"?m.then(b=>h(null,b)).catch(h):h(null,m)}catch(m){h(m)}return}return g(n,a,h)}prepareLoading(n,a){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),c&&c();bt(n)&&(n=this.languageUtils.toResolveHierarchy(n)),bt(a)&&(a=[a]);const d=this.queueLoad(n,a,u,c);if(!d.toLoad.length)return d.pending.length||c(),null;d.toLoad.forEach(f=>{this.loadOne(f)})}load(n,a,u){this.prepareLoading(n,a,{},u)}reload(n,a,u){this.prepareLoading(n,a,{reload:!0},u)}loadOne(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const u=n.split("|"),c=u[0],d=u[1];this.read(c,d,"read",void 0,void 0,(f,h)=>{f&&this.logger.warn(`${a}loading namespace ${d} for language ${c} failed`,f),!f&&h&&this.logger.log(`${a}loaded namespace ${d} for language ${c}`,h),this.loaded(n,f,h)})}saveMissing(n,a,u,c,d){let f=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},h=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(a)){this.logger.warn(`did not save key "${u}" as the namespace "${a}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(u==null||u==="")){if(this.backend?.create){const g={...f,isUpdate:d},m=this.backend.create.bind(this.backend);if(m.length<6)try{let b;m.length===5?b=m(n,a,u,c,g):b=m(n,a,u,c),b&&typeof b.then=="function"?b.then(v=>h(null,v)).catch(h):h(null,b)}catch(b){h(b)}else m(n,a,u,c,h,g)}!n||!n[0]||this.store.addResource(n[0],a,u,c)}}}const Ng=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:i=>{let n={};if(typeof i[1]=="object"&&(n=i[1]),bt(i[1])&&(n.defaultValue=i[1]),bt(i[2])&&(n.tDescription=i[2]),typeof i[2]=="object"||typeof i[3]=="object"){const a=i[3]||i[2];Object.keys(a).forEach(u=>{n[u]=a[u]})}return n},interpolation:{escapeValue:!0,format:i=>i,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Mg=i=>(bt(i.ns)&&(i.ns=[i.ns]),bt(i.fallbackLng)&&(i.fallbackLng=[i.fallbackLng]),bt(i.fallbackNS)&&(i.fallbackNS=[i.fallbackNS]),i.supportedLngs?.indexOf?.("cimode")<0&&(i.supportedLngs=i.supportedLngs.concat(["cimode"])),typeof i.initImmediate=="boolean"&&(i.initAsync=i.initImmediate),i),ho=()=>{},k1=i=>{Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach(a=>{typeof i[a]=="function"&&(i[a]=i[a].bind(i))})};class Ii extends fo{constructor(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Mg(n),this.services={},this.logger=On,this.modules={external:[]},k1(this),a&&!this.isInitialized&&!n.isClone){if(!this.options.initAsync)return this.init(n,a),this;setTimeout(()=>{this.init(n,a)},0)}}init(){var n=this;let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof a=="function"&&(u=a,a={}),a.defaultNS==null&&a.ns&&(bt(a.ns)?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));const c=Ng();this.options={...c,...this.options,...Mg(a)},this.options.interpolation={...c.interpolation,...this.options.interpolation},a.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=a.keySeparator),a.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=a.nsSeparator);const d=b=>b?typeof b=="function"?new b:b:null;if(!this.options.isClone){this.modules.logger?On.init(d(this.modules.logger),this.options):On.init(null,this.options);let b;this.modules.formatter?b=this.modules.formatter:b=A1;const v=new wg(this.options);this.store=new _g(this.options.resources,this.options);const S=this.services;S.logger=On,S.resourceStore=this.store,S.languageUtils=v,S.pluralResolver=new x1(v,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),b&&(!this.options.interpolation.format||this.options.interpolation.format===c.interpolation.format)&&(S.formatter=d(b),S.formatter.init(S,this.options),this.options.interpolation.format=S.formatter.format.bind(S.formatter)),S.interpolator=new _1(this.options),S.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},S.backendConnector=new w1(d(this.modules.backend),S.resourceStore,S,this.options),S.backendConnector.on("*",function(A){for(var M=arguments.length,j=new Array(M>1?M-1:0),N=1;N<M;N++)j[N-1]=arguments[N];n.emit(A,...j)}),this.modules.languageDetector&&(S.languageDetector=d(this.modules.languageDetector),S.languageDetector.init&&S.languageDetector.init(S,this.options.detection,this.options)),this.modules.i18nFormat&&(S.i18nFormat=d(this.modules.i18nFormat),S.i18nFormat.init&&S.i18nFormat.init(this)),this.translator=new No(this.services,this.options),this.translator.on("*",function(A){for(var M=arguments.length,j=new Array(M>1?M-1:0),N=1;N<M;N++)j[N-1]=arguments[N];n.emit(A,...j)}),this.modules.external.forEach(A=>{A.init&&A.init(this)})}if(this.format=this.options.interpolation.format,u||(u=ho),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const b=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);b.length>0&&b[0]!=="dev"&&(this.options.lng=b[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(b=>{this[b]=function(){return n.store[b](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(b=>{this[b]=function(){return n.store[b](...arguments),n}});const g=mi(),m=()=>{const b=(v,S)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),g.resolve(S),u(v,S)};if(this.languages&&!this.isInitialized)return b(null,this.t.bind(this));this.changeLanguage(this.options.lng,b)};return this.options.resources||!this.options.initAsync?m():setTimeout(m,0),g}loadResources(n){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ho;const c=bt(n)?n:this.language;if(typeof n=="function"&&(u=n),!this.options.resources||this.options.partialBundledLanguages){if(c?.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return u();const d=[],f=h=>{if(!h||h==="cimode")return;this.services.languageUtils.toResolveHierarchy(h).forEach(m=>{m!=="cimode"&&d.indexOf(m)<0&&d.push(m)})};c?f(c):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(g=>f(g)),this.options.preload?.forEach?.(h=>f(h)),this.services.backendConnector.load(d,this.options.ns,h=>{!h&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),u(h)})}else u(null)}reloadResources(n,a,u){const c=mi();return typeof n=="function"&&(u=n,n=void 0),typeof a=="function"&&(u=a,a=void 0),n||(n=this.languages),a||(a=this.options.ns),u||(u=ho),this.services.backendConnector.reload(n,a,d=>{c.resolve(),u(d)}),c}use(n){if(!n)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!n.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return n.type==="backend"&&(this.modules.backend=n),(n.type==="logger"||n.log&&n.warn&&n.error)&&(this.modules.logger=n),n.type==="languageDetector"&&(this.modules.languageDetector=n),n.type==="i18nFormat"&&(this.modules.i18nFormat=n),n.type==="postProcessor"&&Cg.addPostProcessor(n),n.type==="formatter"&&(this.modules.formatter=n),n.type==="3rdParty"&&this.modules.external.push(n),this}setResolvedLanguage(n){if(!(!n||!this.languages)&&!(["cimode","dev"].indexOf(n)>-1))for(let a=0;a<this.languages.length;a++){const u=this.languages[a];if(!(["cimode","dev"].indexOf(u)>-1)&&this.store.hasLanguageSomeTranslations(u)){this.resolvedLanguage=u;break}}}changeLanguage(n,a){var u=this;this.isLanguageChangingTo=n;const c=mi();this.emit("languageChanging",n);const d=g=>{this.language=g,this.languages=this.services.languageUtils.toResolveHierarchy(g),this.resolvedLanguage=void 0,this.setResolvedLanguage(g)},f=(g,m)=>{m?(d(m),this.translator.changeLanguage(m),this.isLanguageChangingTo=void 0,this.emit("languageChanged",m),this.logger.log("languageChanged",m)):this.isLanguageChangingTo=void 0,c.resolve(function(){return u.t(...arguments)}),a&&a(g,function(){return u.t(...arguments)})},h=g=>{!n&&!g&&this.services.languageDetector&&(g=[]);const m=bt(g)?g:this.services.languageUtils.getBestMatchFromCodes(g);m&&(this.language||d(m),this.translator.language||this.translator.changeLanguage(m),this.services.languageDetector?.cacheUserLanguage?.(m)),this.loadResources(m,b=>{f(b,m)})};return!n&&this.services.languageDetector&&!this.services.languageDetector.async?h(this.services.languageDetector.detect()):!n&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(h):this.services.languageDetector.detect(h):h(n),c}getFixedT(n,a,u){var c=this;const d=function(f,h){let g;if(typeof h!="object"){for(var m=arguments.length,b=new Array(m>2?m-2:0),v=2;v<m;v++)b[v-2]=arguments[v];g=c.options.overloadTranslationOptionHandler([f,h].concat(b))}else g={...h};g.lng=g.lng||d.lng,g.lngs=g.lngs||d.lngs,g.ns=g.ns||d.ns,g.keyPrefix!==""&&(g.keyPrefix=g.keyPrefix||u||d.keyPrefix);const S=c.options.keySeparator||".";let A;return g.keyPrefix&&Array.isArray(f)?A=f.map(M=>`${g.keyPrefix}${S}${M}`):A=g.keyPrefix?`${g.keyPrefix}${S}${f}`:f,c.t(A,g)};return bt(n)?d.lng=n:d.lngs=n,d.ns=a,d.keyPrefix=u,d}t(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.translator?.translate(...a)}exists(){for(var n=arguments.length,a=new Array(n),u=0;u<n;u++)a[u]=arguments[u];return this.translator?.exists(...a)}setDefaultNamespace(n){this.options.defaultNS=n}hasLoadedNamespace(n){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const u=a.lng||this.resolvedLanguage||this.languages[0],c=this.options?this.options.fallbackLng:!1,d=this.languages[this.languages.length-1];if(u.toLowerCase()==="cimode")return!0;const f=(h,g)=>{const m=this.services.backendConnector.state[`${h}|${g}`];return m===-1||m===0||m===2};if(a.precheck){const h=a.precheck(this,f);if(h!==void 0)return h}return!!(this.hasResourceBundle(u,n)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||f(u,n)&&(!c||f(d,n)))}loadNamespaces(n,a){const u=mi();return this.options.ns?(bt(n)&&(n=[n]),n.forEach(c=>{this.options.ns.indexOf(c)<0&&this.options.ns.push(c)}),this.loadResources(c=>{u.resolve(),a&&a(c)}),u):(a&&a(),Promise.resolve())}loadLanguages(n,a){const u=mi();bt(n)&&(n=[n]);const c=this.options.preload||[],d=n.filter(f=>c.indexOf(f)<0&&this.services.languageUtils.isSupportedCode(f));return d.length?(this.options.preload=c.concat(d),this.loadResources(f=>{u.resolve(),a&&a(f)}),u):(a&&a(),Promise.resolve())}dir(n){if(n||(n=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!n)return"rtl";const a=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],u=this.services?.languageUtils||new wg(Ng());return a.indexOf(u.getLanguagePartFromCode(n))>-1||n.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1?arguments[1]:void 0;return new Ii(n,a)}cloneInstance(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ho;const u=n.forkResourceStore;u&&delete n.forkResourceStore;const c={...this.options,...n,isClone:!0},d=new Ii(c);if((n.debug!==void 0||n.prefix!==void 0)&&(d.logger=d.logger.clone(n)),["store","services","language"].forEach(h=>{d[h]=this[h]}),d.services={...this.services},d.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},u){const h=Object.keys(this.store.data).reduce((g,m)=>(g[m]={...this.store.data[m]},Object.keys(g[m]).reduce((b,v)=>(b[v]={...g[m][v]},b),{})),{});d.store=new _g(h,c),d.services.resourceStore=d.store}return d.translator=new No(d.services,c),d.translator.on("*",function(h){for(var g=arguments.length,m=new Array(g>1?g-1:0),b=1;b<g;b++)m[b-1]=arguments[b];d.emit(h,...m)}),d.init(c,a),d.translator.options=c,d.translator.backendConnector.services.utils={hasLoadedNamespace:d.hasLoadedNamespace.bind(d)},d}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Ft=Ii.createInstance();Ft.createInstance=Ii.createInstance,Ft.createInstance,Ft.dir,Ft.init,Ft.loadResources,Ft.reloadResources,Ft.use,Ft.changeLanguage,Ft.getFixedT,Ft.t,Ft.exists,Ft.setDefaultNamespace,Ft.hasLoadedNamespace,Ft.loadNamespaces,Ft.loadLanguages;const ea={checkConstraints:!0,cameraFacingMode:"user",cameraAutoStart:!1,measurementAutoStart:!1,cancelWhenLowSNR:!0},mo=i=>typeof i=="boolean",D1=i=>i==="user"||i==="environment",L1=i=>{if(!i||typeof i!="object"||i===null)return ea;const n=i;return{checkConstraints:mo(n.checkConstraints)?n.checkConstraints:ea.checkConstraints,cameraFacingMode:D1(n.cameraFacingMode)?n.cameraFacingMode:ea.cameraFacingMode,cameraAutoStart:mo(n.cameraAutoStart)?n.cameraAutoStart:ea.cameraAutoStart,measurementAutoStart:mo(n.measurementAutoStart)?n.measurementAutoStart:ea.measurementAutoStart,cancelWhenLowSNR:mo(n.cancelWhenLowSNR)?n.cancelWhenLowSNR:ea.cancelWhenLowSNR}},na=ta({config:ea,setConfig:i=>{na.config=i}});var N1=(i=>(i.UNKNOWN_ERROR="UNKNOWN_ERROR",i.NETWORK_ERROR="NETWORK_ERROR",i.UNSUPPORTED_BROWSER="UNSUPPORTED_BROWSER",i.TOKEN_RENEWAL_FAILED="TOKEN_RENEWAL_FAILED",i))(N1||{}),M1=(i=>(i.INFO="INFO",i.WARN="WARN",i.ERROR="ERROR",i))(M1||{});const Sn={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},mn={CAMERA_STARTED:{event:Sn.CAMERA_STARTED,level:"INFO"},APP_LOADED:{event:Sn.APP_LOADED,level:"INFO"},MEASUREMENT_PREPARED:{event:Sn.MEASUREMENT_PREPARED,level:"INFO"},ASSETS_DOWNLOADED:{event:Sn.ASSETS_DOWNLOADED,level:"INFO"},MEASUREMENT_STARTED:{event:Sn.MEASUREMENT_STARTED,level:"INFO"},MEASUREMENT_COMPLETED:{event:Sn.MEASUREMENT_COMPLETED,level:"INFO"},CAMERA_PERMISSION_GRANTED:{event:Sn.CAMERA_PERMISSION_GRANTED,level:"INFO"},INTERMEDIATE_RESULTS:{event:Sn.INTERMEDIATE_RESULTS,level:"INFO"},RESULTS_RECEIVED:{event:Sn.RESULTS_RECEIVED,level:"INFO"},PAGE_UNLOADED:{event:Sn.PAGE_UNLOADED,level:"INFO"},PAGE_VISIBILITY_CHANGE:{event:Sn.PAGE_VISIBILITY_CHANGE,level:"INFO"}};var Ke=(i=>(i.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",i.WORKER_ERROR="WORKER_ERROR",i.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",i.NO_DEVICES_FOUND="NO_DEVICES_FOUND",i.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",i.CAMERA_START_FAILED="CAMERA_START_FAILED",i.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",i.COLLECTOR="COLLECTOR",i.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",i.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",i))(Ke||{});const z1=process.env.IS_DEVELOPMENT,B1=()=>{const i=new Date,n=(i.getMonth()+1).toString().padStart(2,"0"),a=i.getDate().toString().padStart(2,"0"),u=i.getFullYear();let c=i.getHours();const d=i.getMinutes().toString().padStart(2,"0"),f=i.getSeconds().toString().padStart(2,"0"),h=i.getMilliseconds().toString().padStart(3,"0"),g=c>=12?"PM":"AM";return c=c%12||12,`[${n}/${a}/${u}, ${c}:${d}:${f}.${h} ${g}]`},Jt=ta({logs:[],addLog:(i,n,a)=>{if(z1)console.log(i);else{const u=B1(),c={message:i,category:n,timestamp:u,meta:a};Jt.logs.push(c)}},getLogs:()=>Jt.logs,clearLogs:()=>{Jt.logs=[]}}),fe={ANALYSIS_ERROR:"Analysis error occurred",LIVENESS_ERROR:"Liveness error occurred",CHUNK_SENT:"Chunk sent",COLLECTOR_ERROR:"Collector Error",MEDIA_ELEMENT_RESIZED:"Media element resized",CAMERA_START_FAILED:"Camera failed to start",CAMERA_PERMISSION_DENIED:"Camera permission denied",CAMERA_PERMISSION_GRANTED:"Camera permission granted",PAGE_NOT_VISIBLE:"Page not visible during measurement",MEASUREMENT_LOW_SNR:"Measurement canceled due to low SNR",MEASUREMENT_PREPARE_FAILED:"Measurement preparation failed",WORKER_ERROR:"Worker error occurred",PROFILE_BYPASS_ENABLED:"Profile bypass enabled",PROFILE_INVALID:"Profile invalid",PROFILE_SET:"Profile set",CAMERA_STOP_RESET_FAILED:"Camera stop/reset failed",CAMERA_STOPPED_AT_ANALYZING_START:"Camera stopped at analyzing start"};var ae=(i=>(i.measurement="Measurement",i.collector="Collector",i.camera="Camera",i.app="App",i))(ae||{});const xl={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"},gi={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};let pd=null;const j1=i=>{pd=i},_l=i=>{pd?pd.dispatchEvent(i):console.warn("Event dispatch failed: mountElement not set")},Cl=i=>{const n=new CustomEvent(xl.ERROR,{detail:i});_l(n)},Xe=(i,n={})=>{const{event:a,level:u}=i,c=new CustomEvent(xl.APPEVENT,{detail:{event:a,level:u,timestamp:new Date().toISOString(),...n}});_l(c)},{CameraController:U1}=d1,{CAMERA_STATUS:I1,SELECTED_DEVICE_CHANGED:$1,MEDIA_DEVICE_LIST_CHANGED:H1}=hi,xe=ta({deviceId:"",isPermissionGranted:!1,enumerationPhase:Rl.Idle,isOpen:!1,capabilities:null,mediaDevices:[],cameraStream:null,trackinfo:{cameraWidth:0,cameraHeight:0,cameraFrameRate:0},start:async(i,n)=>{const{cameraFacingMode:a}=na.config,u=await Qe.start(i,n,a);if(!u)return Jt.addLog(fe.CAMERA_START_FAILED,ae.camera),Cl({code:Ke.CAMERA_START_FAILED,message:""}),u;const{cameraWidth:c,cameraHeight:d,cameraFrameRate:f}=Qe;return xe.trackinfo={cameraWidth:c,cameraHeight:d,cameraFrameRate:f},u},stop:()=>{xe.isOpen&&Qe.stop(),xe.trackinfo={cameraWidth:0,cameraHeight:0,cameraFrameRate:0}},requestPermission:async()=>{const i=await Qe.requestPermission();xe.isPermissionGranted=i.success,xe.isPermissionGranted?(Xe(mn.CAMERA_PERMISSION_GRANTED),Jt.addLog(fe.CAMERA_PERMISSION_GRANTED,ae.camera,{})):(Jt.addLog(fe.CAMERA_PERMISSION_DENIED,ae.camera,{}),Cl({code:Ke.CAMERA_PERMISSION_DENIED,message:Ft.t("ERR_CAMERA_PERMISSION_DENIED")}))},listCameras:async()=>{xe.enumerationPhase=Rl.Enumerating,await Qe.list();const i=Qe.mediaDevices.map(a=>({device:{...a.device},capabilities:{...a.capabilities}}));xe.mediaDevices=[...i];const{cameraFacingMode:n}=na.config;if(n&&i.length>0){const a=G1(i,n);a&&(Qe.setDeviceId(a.device.deviceId),Jt.addLog(`Auto-selected ${n} camera: ${a.device.label}`,ae.camera))}xe.enumerationPhase=Rl.Done},updateDeviceId:i=>{Qe.setDeviceId(i)}}),G1=(i,n)=>i.find(a=>{const u=a.capabilities;return u&&"facingMode"in u&&u.facingMode?(Array.isArray(u.facingMode)?u.facingMode:[u.facingMode]).includes(n):!1})||null,Qe=U1.init(),F1=async i=>{const{deviceId:n}=i.detail;xe.deviceId=n},W1=async i=>{const{isOpen:n}=i.detail;if(n){const{capabilities:a}=i.detail;xe.capabilities=a,xe.cameraStream=Qe.cameraStream?a1(Qe.cameraStream):null}else xe.capabilities=null,xe.cameraStream=null;xe.isOpen=n},q1=async i=>{const{mediaDevices:n}=i.detail;xe.mediaDevices=n,xe.enumerationPhase=Rl.Done};Qe.addEventListener($1,F1),Qe.addEventListener(H1,q1),Qe.addEventListener(I1,W1);var zg="0.1.0-beta.2",Za=(i=>(i.DELETE="DELETE",i.GET="GET",i.PATCH="PATCH",i.POST="POST",i.PUT="PUT",i.CONNECT="CONNECT",i))(Za||{}),la=(i=>(i.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",i))(la||{});const Bg=typeof DedicatedWorkerGlobalScope<"u",po=async({baseUrl:i,urlFragment:n,method:a,headers:u,data:c},d)=>{const f=`${i}/${n}`;let h={Code:"",Message:""};try{const g=await fetch(f,{method:a,cache:"no-store",credentials:"include",headers:u,...c!=null&&{body:JSON.stringify(c)}}),m=g.headers.get("content-type"),b=g.status.toString();h={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},b==="503"&&(h={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),b==="429"&&(h={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),m!=null&&(m.startsWith("application/json;")&&(h=await g.json()),m.startsWith("text/plain;")&&(h={data:await g.text()}));let v=g.headers;if(Bg){const S={};g.headers.forEach((A,M)=>{S[M]=A}),v=S}try{d(b,b==="200"?void 0:h)}catch(S){console.error("Error running onAfterRESTCall callback",S)}return{status:b,headers:v,body:h}}catch(g){return g instanceof SyntaxError?h={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:h={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:Bg?{}:new Headers,body:h}}},go=()=>new Headers({"Content-Type":"application/json"});var Y1=Object.defineProperty,V1=(i,n,a)=>n in i?Y1(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,P1=(i,n,a)=>V1(i,n+"",a);class gd{constructor(n){P1(this,"parent"),this.parent=n}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:la.ON_BEFORE_REST_CALL_ERROR,Message:la.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(n){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:Za[n],headers:go()}}getHeaderWithDeviceToken(){const n=go();return n.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),n}getHeaderWithUserToken(){const n=go();return n.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),n}getHeaderWithSessionEnabled(){const n=go();return n.set("x-nura-session","true"),n}}class K1 extends gd{async create(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:n},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:f.ID}),{status:d,body:f,headers:h}}}class X1 extends gd{async retrieveSdkConfigData(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:n},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:f.ConfigFile,studyCfgHash:f.MD5Hash}),{status:d,body:f,headers:h}}}class Q1 extends gd{async renew(n,a){const{Code:u,Message:c}=await this.onBeforeRESTCall();if(u===la.ON_BEFORE_REST_CALL_ERROR)return{status:u,body:{Code:u,Message:c},headers:new Headers};const{status:d,body:f,headers:h}=await po({...this.getDefaults(Za.POST),headers:a==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:n},this.parent.onAfterRESTCall);if(d==="200"){const g=f.Token,m=f.RefreshToken,b={...a==="user"&&{userToken:g,userRefreshToken:m},...a==="device"&&{deviceToken:g,deviceRefreshToken:m}};this.parent.setSession(b)}return{status:d,body:f,headers:h}}async validate(n){const{Code:a,Message:u}=await this.onBeforeRESTCall();return a===la.ON_BEFORE_REST_CALL_ERROR?{status:a,body:{Code:a,Message:u},headers:new Headers}:await po({...this.getDefaults(Za.GET),headers:n==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Z1=Object.defineProperty,jg=i=>{throw TypeError(i)},J1=(i,n,a)=>n in i?Z1(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,bd=(i,n,a)=>J1(i,typeof n!="symbol"?n+"":n,a),Ug=(i,n,a)=>n.has(i)||jg("Cannot "+a),yd=(i,n,a)=>(Ug(i,n,"read from private field"),a?a.call(i):n.get(i)),Ig=(i,n,a)=>n.has(i)?jg("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,a),bo=(i,n,a,u)=>(Ug(i,n,"write to private field"),n.set(i,a),a),bi,Ja;class tE{constructor(n){Ig(this,bi,{http:new URL("https://api.deepaffex.ai")}),Ig(this,Ja),bd(this,"onBeforeRESTCall"),bd(this,"onAfterRESTCall"),bd(this,"http"),bo(this,Ja,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new K1(this),studies:new X1(this),auths:new Q1(this)},this.onBeforeRESTCall=n?.onBeforeRESTCall?n.onBeforeRESTCall:()=>{},this.onAfterRESTCall=n?.onAfterRESTCall?n.onAfterRESTCall:()=>{},n?.url!=null&&bo(this,bi,n.url)}static new(n){return new this(n??void 0)}getUrl(){return JSON.stringify(yd(this,bi))}setUrl(n){bo(this,bi,{http:new URL(n)})}getSession(){return yd(this,Ja)}setSession(n){const a=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(n).every(d=>a.includes(d)&&typeof n[d]=="string")&&bo(this,Ja,{...yd(this,Ja),...n})}}bi=new WeakMap,Ja=new WeakMap;const eE=i=>tE.new(i);var nE=Object.defineProperty,$g=i=>{throw TypeError(i)},lE=(i,n,a)=>n in i?nE(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,aE=(i,n,a)=>lE(i,n+"",a),rE=(i,n,a)=>n.has(i)||$g("Cannot "+a),iE=(i,n,a)=>n.has(i)?$g("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,a),vd=(i,n,a)=>(rE(i,n,"access private method"),a),yi,Sd,Hg;let Gg=i=>new Int8Array(i);class uE extends EventTarget{constructor(){super(...arguments),iE(this,yi),aE(this,"canDecompress",!1)}static init(){return new this}dispatch(n,a){this.dispatchEvent(new CustomEvent(n,{detail:a}))}getBytesDownloadedEvent(n,a,u,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:n,uncompressedSize:a,url:u,done:c}})}getBytesDownloadErrorEvent(n,a){return new CustomEvent("downloadedError",{detail:{url:n,error:a}})}decompressBrotli(n){const a=atob(n),u=new Uint8Array(a.length);for(let f=0;f<a.length;f++)u[f]=a.charCodeAt(f);const c=new Int8Array(u.length);for(let f=0;f<u.length;f++)c[f]=u[f]>=128?u[f]-256:u[f];return Gg(c).buffer}async fetchAsset(n,a,u,c,d){const f=a+u,h=n.find(m=>m.file===u).uncompressedSize,g=(m,b,v,S)=>vd(this,yi,Sd).call(this,this.getBytesDownloadedEvent(m,b,v,S));try{const b=(await fetch(f)).body?.getReader();if(!b)throw new Error("Failed to get reader from response body.");let v=0;const S=new ReadableStream({async start(M){await j();async function j(){const{done:N,value:W}=await b.read();if(N){M.close(),g(v,h,f,!0);return}W&&(M.enqueue(W),v+=W.length,g(v,h,f,!1)),await j()}}}),A=new Response(S);if(c){const M=await A.json(),{base64EncodedValue:j}=M;if(d==="gzip"){await vd(this,yi,Hg).call(this,j);return}return this.decompressBrotli(j)}else return await A.arrayBuffer()}catch(m){vd(this,yi,Sd).call(this,this.getBytesDownloadErrorEvent(f,m))}}}yi=new WeakSet,Sd=function(i){this.dispatchEvent(i)},Hg=async function(i){const n=Uint8Array.from(atob(i),m=>m.charCodeAt(0)),u=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(u).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),f=new Blob([d],{type:"application/javascript"}),h=URL.createObjectURL(f);Gg=(await import(h)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(h)};var oE=Object.defineProperty,sE=(i,n,a)=>n in i?oE(i,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[n]=a,Fg=(i,n,a)=>sE(i,typeof n!="symbol"?n+"":n,a);class cE{constructor(){Fg(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),Fg(this,"debugLogs",[])}appendLog(n){this.debugLogs.push(n)}transferLogs(){}generateHTMLTable(){return`
13
13
  <html lang="en">
14
14
  <head>
15
15
  <meta charset="UTF-8">
package/lib/index.d.ts CHANGED
@@ -955,8 +955,6 @@ interface MeasurementEmbeddedAppOptions {
955
955
  config?: Config;
956
956
  /** API URL for region-specific data processing */
957
957
  apiUrl?: string;
958
- /** Callback function to handle load errors */
959
- loadError?: (error: string) => void;
960
958
  }
961
959
  declare enum logCategory {
962
960
  measurement = "Measurement",
@@ -971,7 +969,7 @@ interface Log {
971
969
  meta?: any;
972
970
  }
973
971
  interface MeasurementEmbedded {
974
- init(options: MeasurementEmbeddedAppOptions): void;
972
+ init(options: MeasurementEmbeddedAppOptions): Promise<void>;
975
973
  destroy(): Promise<void>;
976
974
  /**
977
975
  * Cancel the measurement
@@ -1142,7 +1140,7 @@ declare class MeasurementEmbeddedApp implements MeasurementEmbedded {
1142
1140
  };
1143
1141
  /** @hideconstructor */
1144
1142
  constructor();
1145
- init(options: MeasurementEmbeddedAppOptions): void;
1143
+ init(options: MeasurementEmbeddedAppOptions): Promise<void>;
1146
1144
  destroy(): Promise<void>;
1147
1145
  setTheme(theme: 'light' | 'dark'): void;
1148
1146
  setLanguage(language: SupportedLanguage): void;
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var Nt="0.1.0-beta.3";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"};var je=(t=>(t.measurement="Measurement",t.collector="Collector",t.camera="Camera",t.app="App",t))(je||{});const O={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},N={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",MEASUREMENT_CANCELED:"MEASUREMENT_CANCELED",CONSTRAINT_VIOLATION:"CONSTRAINT_VIOLATION",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},Lt={CAMERA_STARTED:{event:N.CAMERA_STARTED,level:O.INFO},APP_LOADED:{event:N.APP_LOADED,level:O.INFO},MEASUREMENT_PREPARED:{event:N.MEASUREMENT_PREPARED,level:O.INFO},ASSETS_DOWNLOADED:{event:N.ASSETS_DOWNLOADED,level:O.INFO},MEASUREMENT_STARTED:{event:N.MEASUREMENT_STARTED,level:O.INFO},MEASUREMENT_COMPLETED:{event:N.MEASUREMENT_COMPLETED,level:O.INFO},CAMERA_PERMISSION_GRANTED:{event:N.CAMERA_PERMISSION_GRANTED,level:O.INFO},INTERMEDIATE_RESULTS:{event:N.INTERMEDIATE_RESULTS,level:O.INFO},RESULTS_RECEIVED:{event:N.RESULTS_RECEIVED,level:O.INFO},MEASUREMENT_CANCELED:{event:N.MEASUREMENT_CANCELED,level:O.WARN},CONSTRAINT_VIOLATION:{event:N.CONSTRAINT_VIOLATION,level:O.ERROR},PAGE_UNLOADED:{event:N.PAGE_UNLOADED,level:O.INFO},PAGE_VISIBILITY_CHANGE:{event:N.PAGE_VISIBILITY_CHANGE,level:O.INFO}},re={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};var Ye=(t=>(t.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",t.WORKER_ERROR="WORKER_ERROR",t.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",t.NO_DEVICES_FOUND="NO_DEVICES_FOUND",t.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",t.CAMERA_START_FAILED="CAMERA_START_FAILED",t.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",t.COLLECTOR="COLLECTOR",t.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",t.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",t))(Ye||{}),Je="0.1.0-beta.2",J=(t=>(t.DELETE="DELETE",t.GET="GET",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.CONNECT="CONNECT",t))(J||{}),V=(t=>(t.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",t))(V||{});const Xe=typeof DedicatedWorkerGlobalScope<"u",be=async({baseUrl:t,urlFragment:e,method:i,headers:r,data:c},d)=>{const n=`${t}/${e}`;let a={Code:"",Message:""};try{const u=await fetch(n,{method:i,cache:"no-store",credentials:"include",headers:r,...c!=null&&{body:JSON.stringify(c)}}),h=u.headers.get("content-type"),E=u.status.toString();a={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},E==="503"&&(a={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),E==="429"&&(a={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),h!=null&&(h.startsWith("application/json;")&&(a=await u.json()),h.startsWith("text/plain;")&&(a={data:await u.text()}));let _=u.headers;if(Xe){const C={};u.headers.forEach((k,I)=>{C[I]=k}),_=C}try{d(E,E==="200"?void 0:a)}catch(C){console.error("Error running onAfterRESTCall callback",C)}return{status:E,headers:_,body:a}}catch(u){return u instanceof SyntaxError?a={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:a={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:Xe?{}:new Headers,body:a}}},_e=()=>new Headers({"Content-Type":"application/json"});var Dt=Object.defineProperty,It=(t,e,i)=>e in t?Dt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,xt=(t,e,i)=>It(t,e+"",i);class Fe{constructor(e){xt(this,"parent"),this.parent=e}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:V.ON_BEFORE_REST_CALL_ERROR,Message:V.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(e){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:J[e],headers:_e()}}getHeaderWithDeviceToken(){const e=_e();return e.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),e}getHeaderWithUserToken(){const e=_e();return e.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),e}getHeaderWithSessionEnabled(){const e=_e();return e.set("x-nura-session","true"),e}}class Ft extends Fe{async create(e,i){const{Code:r,Message:c}=await this.onBeforeRESTCall();if(r===V.ON_BEFORE_REST_CALL_ERROR)return{status:r,body:{Code:r,Message:c},headers:new Headers};const{status:d,body:n,headers:a}=await be({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:n.ID}),{status:d,body:n,headers:a}}}class Mt extends Fe{async retrieveSdkConfigData(e,i){const{Code:r,Message:c}=await this.onBeforeRESTCall();if(r===V.ON_BEFORE_REST_CALL_ERROR)return{status:r,body:{Code:r,Message:c},headers:new Headers};const{status:d,body:n,headers:a}=await be({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:n.ConfigFile,studyCfgHash:n.MD5Hash}),{status:d,body:n,headers:a}}}class Pt extends Fe{async renew(e,i){const{Code:r,Message:c}=await this.onBeforeRESTCall();if(r===V.ON_BEFORE_REST_CALL_ERROR)return{status:r,body:{Code:r,Message:c},headers:new Headers};const{status:d,body:n,headers:a}=await be({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:e},this.parent.onAfterRESTCall);if(d==="200"){const u=n.Token,h=n.RefreshToken,E={...i==="user"&&{userToken:u,userRefreshToken:h},...i==="device"&&{deviceToken:u,deviceRefreshToken:h}};this.parent.setSession(E)}return{status:d,body:n,headers:a}}async validate(e){const{Code:i,Message:r}=await this.onBeforeRESTCall();return i===V.ON_BEFORE_REST_CALL_ERROR?{status:i,body:{Code:i,Message:r},headers:new Headers}:await be({...this.getDefaults(J.GET),headers:e==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Wt=Object.defineProperty,ze=t=>{throw TypeError(t)},Ut=(t,e,i)=>e in t?Wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Me=(t,e,i)=>Ut(t,typeof e!="symbol"?e+"":e,i),qe=(t,e,i)=>e.has(t)||ze("Cannot "+i),Pe=(t,e,i)=>(qe(t,e,"read from private field"),i?i.call(t):e.get(t)),Ze=(t,e,i)=>e.has(t)?ze("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),ge=(t,e,i,r)=>(qe(t,e,"write to private field"),e.set(t,i),i),ne,X;class $t{constructor(e){Ze(this,ne,{http:new URL("https://api.deepaffex.ai")}),Ze(this,X),Me(this,"onBeforeRESTCall"),Me(this,"onAfterRESTCall"),Me(this,"http"),ge(this,X,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new Ft(this),studies:new Mt(this),auths:new Pt(this)},this.onBeforeRESTCall=e?.onBeforeRESTCall?e.onBeforeRESTCall:()=>{},this.onAfterRESTCall=e?.onAfterRESTCall?e.onAfterRESTCall:()=>{},e?.url!=null&&ge(this,ne,e.url)}static new(e){return new this(e??void 0)}getUrl(){return JSON.stringify(Pe(this,ne))}setUrl(e){ge(this,ne,{http:new URL(e)})}getSession(){return Pe(this,X)}setSession(e){const i=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(e).every(d=>i.includes(d)&&typeof e[d]=="string")&&ge(this,X,{...Pe(this,X),...e})}}ne=new WeakMap,X=new WeakMap;const Bt=t=>$t.new(t);var Gt=Object.defineProperty,Qe=t=>{throw TypeError(t)},Ht=(t,e,i)=>e in t?Gt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Vt=(t,e,i)=>Ht(t,e+"",i),Kt=(t,e,i)=>e.has(t)||Qe("Cannot "+i),jt=(t,e,i)=>e.has(t)?Qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),We=(t,e,i)=>(Kt(t,e,"access private method"),i),oe,Ue,et;let tt=t=>new Int8Array(t);class Yt extends EventTarget{constructor(){super(...arguments),jt(this,oe),Vt(this,"canDecompress",!1)}static init(){return new this}dispatch(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i}))}getBytesDownloadedEvent(e,i,r,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:e,uncompressedSize:i,url:r,done:c}})}getBytesDownloadErrorEvent(e,i){return new CustomEvent("downloadedError",{detail:{url:e,error:i}})}decompressBrotli(e){const i=atob(e),r=new Uint8Array(i.length);for(let n=0;n<i.length;n++)r[n]=i.charCodeAt(n);const c=new Int8Array(r.length);for(let n=0;n<r.length;n++)c[n]=r[n]>=128?r[n]-256:r[n];return tt(c).buffer}async fetchAsset(e,i,r,c,d){const n=i+r,a=e.find(h=>h.file===r).uncompressedSize,u=(h,E,_,C)=>We(this,oe,Ue).call(this,this.getBytesDownloadedEvent(h,E,_,C));try{const E=(await fetch(n)).body?.getReader();if(!E)throw new Error("Failed to get reader from response body.");let _=0;const C=new ReadableStream({async start(I){await W();async function W(){const{done:G,value:M}=await E.read();if(G){I.close(),u(_,a,n,!0);return}M&&(I.enqueue(M),_+=M.length,u(_,a,n,!1)),await W()}}}),k=new Response(C);if(c){const I=await k.json(),{base64EncodedValue:W}=I;if(d==="gzip"){await We(this,oe,et).call(this,W);return}return this.decompressBrotli(W)}else return await k.arrayBuffer()}catch(h){We(this,oe,Ue).call(this,this.getBytesDownloadErrorEvent(n,h))}}}oe=new WeakSet,Ue=function(t){this.dispatchEvent(t)},et=async function(t){const e=Uint8Array.from(atob(t),h=>h.charCodeAt(0)),r=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(r).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),n=new Blob([d],{type:"application/javascript"}),a=URL.createObjectURL(n);tt=(await import(a)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(a)};var Jt=Object.defineProperty,Xt=(t,e,i)=>e in t?Jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,it=(t,e,i)=>Xt(t,typeof e!="symbol"?e+"":e,i);class zt{constructor(){it(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),it(this,"debugLogs",[])}appendLog(e){this.debugLogs.push(e)}transferLogs(){}generateHTMLTable(){return`
1
+ var Lt="0.1.0-beta.4";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEvent",CANCELLED:"cancelled",DESTROYED:"destroyed",LOGS:"logs"};var Ye=(t=>(t.measurement="Measurement",t.collector="Collector",t.camera="Camera",t.app="App",t))(Ye||{});const N={INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},L={CAMERA_STARTED:"CAMERA_STARTED",APP_LOADED:"APP_LOADED",MEASUREMENT_PREPARED:"MEASUREMENT_PREPARED",ASSETS_DOWNLOADED:"ASSETS_DOWNLOADED",MEASUREMENT_STARTED:"MEASUREMENT_STARTED",MEASUREMENT_COMPLETED:"MEASUREMENT_COMPLETED",CAMERA_PERMISSION_GRANTED:"CAMERA_PERMISSION_GRANTED",INTERMEDIATE_RESULTS:"INTERMEDIATE_RESULTS",RESULTS_RECEIVED:"RESULTS_RECEIVED",MEASUREMENT_CANCELED:"MEASUREMENT_CANCELED",CONSTRAINT_VIOLATION:"CONSTRAINT_VIOLATION",PAGE_UNLOADED:"PAGE_UNLOADED",PAGE_VISIBILITY_CHANGE:"PAGE_VISIBILITY_CHANGE"},Dt={CAMERA_STARTED:{event:L.CAMERA_STARTED,level:N.INFO},APP_LOADED:{event:L.APP_LOADED,level:N.INFO},MEASUREMENT_PREPARED:{event:L.MEASUREMENT_PREPARED,level:N.INFO},ASSETS_DOWNLOADED:{event:L.ASSETS_DOWNLOADED,level:N.INFO},MEASUREMENT_STARTED:{event:L.MEASUREMENT_STARTED,level:N.INFO},MEASUREMENT_COMPLETED:{event:L.MEASUREMENT_COMPLETED,level:N.INFO},CAMERA_PERMISSION_GRANTED:{event:L.CAMERA_PERMISSION_GRANTED,level:N.INFO},INTERMEDIATE_RESULTS:{event:L.INTERMEDIATE_RESULTS,level:N.INFO},RESULTS_RECEIVED:{event:L.RESULTS_RECEIVED,level:N.INFO},MEASUREMENT_CANCELED:{event:L.MEASUREMENT_CANCELED,level:N.WARN},CONSTRAINT_VIOLATION:{event:L.CONSTRAINT_VIOLATION,level:N.ERROR},PAGE_UNLOADED:{event:L.PAGE_UNLOADED,level:N.INFO},PAGE_VISIBILITY_CHANGE:{event:L.PAGE_VISIBILITY_CHANGE,level:N.INFO}},ne={DESTROY:"destroy",CANCEL:"cancel",SET_THEME:"setTheme",SET_LANGUAGE:"setLanguage",GET_LOGS:"getLogs"};var Je=(t=>(t.CAMERA_PERMISSION_DENIED="CAMERA_PERMISSION_DENIED",t.WORKER_ERROR="WORKER_ERROR",t.PROFILE_INFO_NOT_SET="PROFILE_INFO_NOT_SET",t.NO_DEVICES_FOUND="NO_DEVICES_FOUND",t.PAGE_NOT_VISIBLE="PAGE_NOT_VISIBLE",t.CAMERA_START_FAILED="CAMERA_START_FAILED",t.MEASUREMENT_LOW_SNR="MEASUREMENT_LOW_SNR",t.COLLECTOR="COLLECTOR",t.WEBSOCKET_DISCONNECTED="WEBSOCKET_DISCONNECTED",t.MEASUREMENT_PREPARE_FAILED="MEASUREMENT_PREPARE_FAILED",t))(Je||{}),Xe="0.1.0-beta.2",J=(t=>(t.DELETE="DELETE",t.GET="GET",t.PATCH="PATCH",t.POST="POST",t.PUT="PUT",t.CONNECT="CONNECT",t))(J||{}),H=(t=>(t.ON_BEFORE_REST_CALL_ERROR="ON_BEFORE_REST_CALL_ERROR",t))(H||{});const ze=typeof DedicatedWorkerGlobalScope<"u",_e=async({baseUrl:t,urlFragment:e,method:i,headers:a,data:c},d)=>{const n=`${t}/${e}`;let r={Code:"",Message:""};try{const u=await fetch(n,{method:i,cache:"no-store",credentials:"include",headers:a,...c!=null&&{body:JSON.stringify(c)}}),h=u.headers.get("content-type"),p=u.status.toString();r={Code:"UNSUPPORTED_RESPONSE_CONTENT_TYPE",Message:"UNSUPPORTED_RESPONSE_CONTENT_TYPE"},p==="503"&&(r={Code:"SERVICE_UNAVAILABLE",Message:"Service unavailable"}),p==="429"&&(r={Code:"TOO_MANY_REQUESTS",Message:"Too many requests"}),h!=null&&(h.startsWith("application/json;")&&(r=await u.json()),h.startsWith("text/plain;")&&(r={data:await u.text()}));let S=u.headers;if(ze){const C={};u.headers.forEach((k,O)=>{C[O]=k}),S=C}try{d(p,p==="200"?void 0:r)}catch(C){console.error("Error running onAfterRESTCall callback",C)}return{status:p,headers:S,body:r}}catch(u){return u instanceof SyntaxError?r={Code:"SYNTAX_ERROR",Message:"SYNTAX_ERROR"}:r={Code:"UNEXPECTED_ERROR",Message:"UNEXPECTED_ERROR"},{status:"UNKNOWN",headers:ze?{}:new Headers,body:r}}},ge=()=>new Headers({"Content-Type":"application/json"});var It=Object.defineProperty,xt=(t,e,i)=>e in t?It(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Ft=(t,e,i)=>xt(t,e+"",i);class Me{constructor(e){Ft(this,"parent"),this.parent=e}async onBeforeRESTCall(){try{return this.parent.onBeforeRESTCall(),{Code:"SUCCESS",Message:"SUCCESS"}}catch{return{Code:H.ON_BEFORE_REST_CALL_ERROR,Message:H.ON_BEFORE_REST_CALL_ERROR}}}getDefaults(e){return{baseUrl:JSON.parse(this.parent.getUrl()).http.slice(0,-1),method:J[e],headers:ge()}}getHeaderWithDeviceToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().deviceToken}`),e}getHeaderWithUserToken(){const e=ge();return e.set("Authorization",`Bearer ${this.parent.getSession().userToken}`),e}getHeaderWithSessionEnabled(){const e=ge();return e.set("x-nura-session","true"),e}}class Mt extends Me{async create(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"measurements",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({lastMeasurementId:n.ID}),{status:d,body:n,headers:r}}}class Pt extends Me{async retrieveSdkConfigData(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"studies/sdkconfig",data:e},this.parent.onAfterRESTCall);return d==="200"&&this.parent.setSession({studyCfgData:n.ConfigFile,studyCfgHash:n.MD5Hash}),{status:d,body:n,headers:r}}}class Wt extends Me{async renew(e,i){const{Code:a,Message:c}=await this.onBeforeRESTCall();if(a===H.ON_BEFORE_REST_CALL_ERROR)return{status:a,body:{Code:a,Message:c},headers:new Headers};const{status:d,body:n,headers:r}=await _e({...this.getDefaults(J.POST),headers:i==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auths/renew",data:e},this.parent.onAfterRESTCall);if(d==="200"){const u=n.Token,h=n.RefreshToken,p={...i==="user"&&{userToken:u,userRefreshToken:h},...i==="device"&&{deviceToken:u,deviceRefreshToken:h}};this.parent.setSession(p)}return{status:d,body:n,headers:r}}async validate(e){const{Code:i,Message:a}=await this.onBeforeRESTCall();return i===H.ON_BEFORE_REST_CALL_ERROR?{status:i,body:{Code:i,Message:a},headers:new Headers}:await _e({...this.getDefaults(J.GET),headers:e==="device"?this.getHeaderWithDeviceToken():this.getHeaderWithUserToken(),urlFragment:"auth/v1/validate"},this.parent.onAfterRESTCall)}}var Ut=Object.defineProperty,qe=t=>{throw TypeError(t)},$t=(t,e,i)=>e in t?Ut(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pe=(t,e,i)=>$t(t,typeof e!="symbol"?e+"":e,i),Ze=(t,e,i)=>e.has(t)||qe("Cannot "+i),We=(t,e,i)=>(Ze(t,e,"read from private field"),i?i.call(t):e.get(t)),Qe=(t,e,i)=>e.has(t)?qe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),we=(t,e,i,a)=>(Ze(t,e,"write to private field"),e.set(t,i),i),oe,X;class Bt{constructor(e){Qe(this,oe,{http:new URL("https://api.deepaffex.ai")}),Qe(this,X),Pe(this,"onBeforeRESTCall"),Pe(this,"onAfterRESTCall"),Pe(this,"http"),we(this,X,{deviceToken:"",deviceRefreshToken:"",userToken:"",userRefreshToken:"",deviceId:"",roleId:"",userId:"",selectedStudy:"",lastMeasurementId:"",studyCfgHash:"",studyCfgData:""}),this.http={measurements:new Mt(this),studies:new Pt(this),auths:new Wt(this)},this.onBeforeRESTCall=e?.onBeforeRESTCall?e.onBeforeRESTCall:()=>{},this.onAfterRESTCall=e?.onAfterRESTCall?e.onAfterRESTCall:()=>{},e?.url!=null&&we(this,oe,e.url)}static new(e){return new this(e??void 0)}getUrl(){return JSON.stringify(We(this,oe))}setUrl(e){we(this,oe,{http:new URL(e)})}getSession(){return We(this,X)}setSession(e){const i=["deviceToken","deviceRefreshToken","userToken","userRefreshToken","deviceId","userId","roleId","selectedStudy","lastMeasurementId","studyCfgHash","studyCfgData"];Object.keys(e).every(d=>i.includes(d)&&typeof e[d]=="string")&&we(this,X,{...We(this,X),...e})}}oe=new WeakMap,X=new WeakMap;const Gt=t=>Bt.new(t);var Ht=Object.defineProperty,et=t=>{throw TypeError(t)},Vt=(t,e,i)=>e in t?Ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kt=(t,e,i)=>Vt(t,e+"",i),jt=(t,e,i)=>e.has(t)||et("Cannot "+i),Yt=(t,e,i)=>e.has(t)?et("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),Ue=(t,e,i)=>(jt(t,e,"access private method"),i),le,$e,tt;let it=t=>new Int8Array(t);class Jt extends EventTarget{constructor(){super(...arguments),Yt(this,le),Kt(this,"canDecompress",!1)}static init(){return new this}dispatch(e,i){this.dispatchEvent(new CustomEvent(e,{detail:i}))}getBytesDownloadedEvent(e,i,a,c){return new CustomEvent("bytesDownloaded",{detail:{bytes:e,uncompressedSize:i,url:a,done:c}})}getBytesDownloadErrorEvent(e,i){return new CustomEvent("downloadedError",{detail:{url:e,error:i}})}decompressBrotli(e){const i=atob(e),a=new Uint8Array(i.length);for(let n=0;n<i.length;n++)a[n]=i.charCodeAt(n);const c=new Int8Array(a.length);for(let n=0;n<a.length;n++)c[n]=a[n]>=128?a[n]-256:a[n];return it(c).buffer}async fetchAsset(e,i,a,c,d){const n=i+a,r=e.find(h=>h.file===a).uncompressedSize,u=(h,p,S,C)=>Ue(this,le,$e).call(this,this.getBytesDownloadedEvent(h,p,S,C));try{const p=(await fetch(n)).body?.getReader();if(!p)throw new Error("Failed to get reader from response body.");let S=0;const C=new ReadableStream({async start(O){await P();async function P(){const{done:G,value:re}=await p.read();if(G){O.close(),u(S,r,n,!0);return}re&&(O.enqueue(re),S+=re.length,u(S,r,n,!1)),await P()}}}),k=new Response(C);if(c){const O=await k.json(),{base64EncodedValue:P}=O;if(d==="gzip"){await Ue(this,le,tt).call(this,P);return}return this.decompressBrotli(P)}else return await k.arrayBuffer()}catch(h){Ue(this,le,$e).call(this,this.getBytesDownloadErrorEvent(n,h))}}}le=new WeakSet,$e=function(t){this.dispatchEvent(t)},tt=async function(t){const e=Uint8Array.from(atob(t),h=>h.charCodeAt(0)),a=new Blob([e]).stream().pipeThrough(new DecompressionStream("gzip")),c=await new Response(a).arrayBuffer(),d=new TextDecoder().decode(new Uint8Array(c)),n=new Blob([d],{type:"application/javascript"}),r=URL.createObjectURL(n);it=(await import(r)).BrotliDecode,this.canDecompress=!0,URL.revokeObjectURL(r)};var Xt=Object.defineProperty,zt=(t,e,i)=>e in t?Xt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,st=(t,e,i)=>zt(t,typeof e!="symbol"?e+"":e,i);class qt{constructor(){st(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""}),st(this,"debugLogs",[])}appendLog(e){this.debugLogs.push(e)}transferLogs(){}generateHTMLTable(){return`
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8">
@@ -128,7 +128,7 @@ var Nt="0.1.0-beta.3";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEven
128
128
  <label for="thread-filter">Filter by Thread:</label>
129
129
  <select id="thread-filter">
130
130
  <option value="none">None</option>
131
- ${[...new Set(this.debugLogs.map(r=>r.thread))].map(r=>`<option value="${r}">${r}</option>`).join("")}
131
+ ${[...new Set(this.debugLogs.map(a=>a.thread))].map(a=>`<option value="${a}">${a}</option>`).join("")}
132
132
  </select>
133
133
  <br>
134
134
  <br>
@@ -736,4 +736,4 @@ var Nt="0.1.0-beta.3";const U={RESULTS:"results",ERROR:"error",APPEVENT:"appEven
736
736
  <\/script>
737
737
  </body>
738
738
  </html>
739
- `}openLogInNewWindow(){const e=this.generateHTMLTable(),i=new Blob([e],{type:"text/html"}),r=URL.createObjectURL(i);window.open(r,"_blank")}}var qt=Object.defineProperty,Zt=(t,e,i)=>e in t?qt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,we=(t,e,i)=>Zt(t,typeof e!="symbol"?e+"":e,i);class xe{constructor(e,i){we(this,"workerUrl"),we(this,"worker"),this.worker=e,this.workerUrl=i}static init(e,i,r){const c=new Blob([e],{type:"application/javascript"}),d=URL.createObjectURL(c),n=r||`WORKER${String(new Date().getTime())}`,a=new Worker(new URL(d,import.meta.url),{name:n,type:i});return new xe(a,d)}destroy(){this.worker&&(this.worker.terminate(),URL.revokeObjectURL(this.worker))}}const Qt=(t,e,i,r)=>{const c=t/e,d=i/r;let n=0,a=0;c>d?(n=t,a=t/d):(a=e,n=e*d);const u=(t-n)/2,h=(e-a)/2;return{width:n||0,height:a||0,offsetX:u||0,offsetY:h||0}},ei=(t,e,i,r)=>{const c=(t-i)/2,d=(e-r)/2;return{width:i||0,height:r||0,offsetX:c||0,offsetY:d||0}},ti=(t,e,i,r)=>{const c=t/e,d=i/r;let n=0,a=0;c>d?(a=e,n=e*d):(n=t,a=t/d);const u=(t-n)/2,h=(e-a)/2;return{width:n||0,height:a||0,offsetX:u||0,offsetY:h||0}},ii=(t,e)=>{switch(t){case"none":return ei(...e);case"cover":return Qt(...e);case"contain":default:return ti(...e)}},st=t=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(t),si=t=>t===void 0?!0:!(typeof t.mediaPipe<"u"&&typeof t.mediaPipe!="boolean"||typeof t.beforeRESTCall<"u"&&typeof t.beforeRESTCall!="boolean"||typeof t.afterRESTCall<"u"&&typeof t.afterRESTCall!="boolean"||typeof t.extractionLibWasm<"u"&&typeof t.extractionLibWasm!="boolean"||typeof t.apiClient<"u"&&typeof t.apiClient!="boolean"||typeof t.extractionWorker<"u"&&typeof t.extractionWorker!="boolean"||typeof t.faceTrackerWorkers<"u"&&typeof t.faceTrackerWorkers!="boolean"||typeof t.sdk<"u"&&typeof t.sdk!="boolean"),ai=(t,e)=>{const i={...t};if(e.logger)if(si(e.logger))i.logger={...i.logger,...e.logger};else return{results:"invalid"};if(e.apiUrl!==void 0)if(typeof e.apiUrl=="string")i.apiUrl=e.apiUrl;else return{results:"invalid"};if(e.metrics!==void 0)if(typeof e.metrics=="boolean")i.metrics=e.metrics;else return{results:"invalid"};if(e.mirrorVideo!==void 0)if(typeof e.mirrorVideo=="boolean")i.mirrorVideo=e.mirrorVideo;else return{results:"invalid"};if(e.displayMediaStream!==void 0)if(typeof e.displayMediaStream=="boolean")i.displayMediaStream=e.displayMediaStream;else return{results:"invalid"};if(e.assetFolder!==void 0)if(typeof e.assetFolder=="string")i.assetFolder=e.assetFolder;else return{results:"invalid"};if(e.mediaElement!==void 0)if(e.mediaElement instanceof HTMLDivElement)i.mediaElement=e.mediaElement;else return{results:"invalid"};if(e.constraintOverrides!==void 0){let r=function(n,a){if(!(n in d))return!1;const u=d[n];return typeof a===u};const d=Object.fromEntries(Object.entries({backLightMaxPixels_pct:30,backLightSearchMult:1.5,backLightThresh:240,boxCenterX_pct:50,boxCenterY_pct:50,boxHeight_pct:99,boxWidth_pct:50,cameraRot_chunkThresh:.7853981633974483,cameraRot_windowThresh:.2617993877991494,checkBackLight:!1,checkCameraMovement:!1,checkCentered:!1,checkDistance:!1,checkEyebrowMovement:!1,checkFaceDirection:!1,checkLighting:!1,checkMaxDistance:!1,checkMinFps:!1,checkMovement:!1,chunkMovementThresh_pct:60,enableDebugLog:!1,enableFigures:!1,faceRotLR_thresh:.33,faceRotUD_lowerthresh:.25,faceRotUD_upperThresh:5,hy_faceRotLR_thresh:.05,hy_maxFaceRotLR_deg:2,hy_maxFaceRotUD_deg:2,hy_minInterPupilDist_px:5,hy_minimumFps:1,maxEyebrowMovement_mm:3,maxFaceRotLR_deg:12.5,maxFaceRotUD_deg:25,maxMovement_mm:10,minInterPupilDist_px:100,minimumFps:26,movementWindow_ms:2e3,threshBright:225,threshDark:48}).map(([n,a])=>[n,typeof a]));for(const n in e.constraintOverrides){const a=e.constraintOverrides[n];if(!r(n,a))return{results:"invalid"}}i.constraintOverrides=e.constraintOverrides}return{results:"valid",settings:i}},ri=t=>typeof t.age!="number"||t.age<13||t.age>120?(console.error("Invalid age. It should be a number between 13 and 120."),!1):typeof t.height!="number"||t.height<120||t.height>220?(console.error("Invalid height. It should be a number between 120 and 220."),!1):typeof t.weight!="number"||t.weight<30||t.weight>300?(console.error("Invalid weight. It should be a number between 30 and 300."),!1):typeof t.sex!="number"||t.sex<1||t.sex>3?(console.error("Invalid sex. It should be a number between 1 and 3."),!1):typeof t.diabetes!="number"||t.diabetes<4||t.diabetes>6?(console.error("Invalid diabetes. It should be a number between 4 and 6."),!1):typeof t.bloodPressureMedication!="number"||t.bloodPressureMedication!==0&&t.bloodPressureMedication!==1?(console.error("Invalid bloodPressureMedication. It should be either 0 or 1."),!1):typeof t.smoking!="number"||t.smoking!==0&&t.smoking!==1?(console.error("Invalid smoking. It should be either 0 or 1."),!1):!0;var m=(t=>(t.beforeRESTCall="Before REST call event",t.afterRESTCall="After REST call event",t.mediaPipe="MediaPipe",t.extractionLibWasm="DFX Extraction lib WASM",t.apiClient="DFX API client",t.webSocket="WebSocket",t.sdk="SDK",t.dfxWorker="DFX Worker",t))(m||{});const ni=t=>{switch(t){case"Before REST call event":return"red";case"After REST call event":return"orange";case"MediaPipe":return"green";case"DFX Extraction lib WASM":return"violet";case"DFX API client":return"#d34110";case"WebSocket":return"#d34110";case"SDK":return"#d34110";case"DFX Worker":return"#ad4393";default:return"black"}};class at{constructor(e=1e3){we(this,"timestamps",[]),we(this,"windowMs"),this.windowMs=e}tick(e=performance.now()){for(this.timestamps.push(e);this.timestamps.length>0&&e-this.timestamps[0]>this.windowMs;)this.timestamps.shift()}get fps(){const e=this.timestamps.length,i=this.timestamps.at(-1)-this.timestamps[0]||1;return e/i*1e3}get frameCount(){return this.timestamps.length}reset(){this.timestamps=[]}}var oi=Object.defineProperty,li=(t,e,i)=>e in t?oi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,rt=(t,e,i)=>li(t,typeof e!="symbol"?e+"":e,i);const ci=()=>{const t=new Date,e=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),r=t.getFullYear();let c=t.getHours();const d=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0"),a=t.getMilliseconds().toString().padStart(3,"0"),u=c>=12?"PM":"AM";return c=c%12||12,`[${e}/${i}/${r}, ${c}:${d}:${n}.${a} ${u}]`};class nt{constructor(){rt(this,"mertics",new zt),rt(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""})}retrieveLogs(){this.mertics.transferLogs(),this.mertics.openLogInNewWindow(),this.mertics.debugLogs=[]}setVersion(e){this.version=e,this.mertics.version=e}log(e,i,r,c=!1,d={}){const n=ci();if(c)this.mertics.appendLog({thread:"Main",timestamp:n,category:i,message:e,meta:d});else{const a=`[${i}]`,u=" ",h=e,E=`color:${r}; font-weight:800;`,_=`color:${ni(i)}; font-weight:700;`;console.log("%c%s%c%s%c%s%c%s",E,n,_,a,"background:inherit;",u,"font-style: italic;",h)}}info(e,i){this.log(e,i,"blue")}warn(e,i){this.log(e,i,"orange")}error(e,i){this.log(e,i,"red")}debug(e,i){this.log(e,i,"green")}start(){console.log("%c%s","color: #5e5e5e; background-color: #2d2d2d; letter-spacing: 0.1em; text-shadow: -1px -1px 1px #111, 2px 2px 1px #363636; font-size: 36px; padding: 20px 40px; text-align: center; text-transform: uppercase; text-rendering: optimizeLegibility;","Anura Web Core SDK"),console.log(`Version: ${this.version.webSDK}`),console.log("https://www.deepaffex.ai")}}const di={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},K={SEX_ASSIGNED_AT_BIRTH:1,AGE_YEARS:2,HEIGHT_CM:3,WEIGHT_KG:4,SMOKER:5,BLOOD_PRESSURE_MEDICATION:7,DIABETES:8};var ot=(t=>(t[t.BGR=1]="BGR",t[t.RGB=2]="RGB",t[t.BGRA=3]="BGRA",t[t.RGBA=4]="RGBA",t[t.Infrared=5]="Infrared",t[t.Infrared888=6]="Infrared888",t[t.BGR_Infrared=7]="BGR_Infrared",t[t.RGB_Infrared=8]="RGB_Infrared",t[t.Gray=9]="Gray",t))(ot||{});const j={ASSETS_NOT_DOWNLOADED:"ASSETS_NOT_DOWNLOADED",NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED",READY:"READY"},Re={COLLECTOR:"COLLECTOR",ASSET_DOWNLOAD:"ASSET_DOWNLOAD",WEB_SOCKET:"WEB_SOCKET"},Ce={CONTAIN:"contain",COVER:"cover",NONE:"none"};var $=(t=>(t.INIT="INIT",t.READY="READY",t.INIT_TFJS="INIT_TFJS",t.SET_PORT="SET_PORT",t.TRACK="TRACK",t.RESULTS_READY="RESULTS_READY",t.WARM_UP="WARM_UP",t.DESTROY="DESTROY",t.LANDMARKS="LANDMARKS",t.VIDEO_FRAME="VIDEO_FRAME",t.SCALE_FACTOR_CHANGED="SCALE_FACTOR_CHANGED",t))($||{}),hi=Object.defineProperty,lt=t=>{throw TypeError(t)},mi=(t,e,i)=>e in t?hi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,w=(t,e,i)=>mi(t,typeof e!="symbol"?e+"":e,i),$e=(t,e,i)=>e.has(t)||lt("Cannot "+i),ct=(t,e,i)=>($e(t,e,"read from private field"),i?i.call(t):e.get(t)),dt=(t,e,i)=>e.has(t)?lt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),ui=(t,e,i,r)=>($e(t,e,"write to private field"),e.set(t,i),i),fi=(t,e,i)=>($e(t,e,"access private method"),i),le,Be,ht;const Ei=class yt{constructor(e,i,r){dt(this,Be),dt(this,le),w(this,"mediaElement"),w(this,"numOfFramesPresented",0),w(this,"workers",[]),w(this,"numOftrackedVideoFrames",0),w(this,"warmupFrameNumber",0),w(this,"videoCallbackId",0),w(this,"numOfWorkers",4),w(this,"isLoggingFaceTrackerWorkers",!1),w(this,"isLoggingSdk",!1),w(this,"workerIndex",0),w(this,"metrics",!1),w(this,"videoFpsTracker",new at(1e3)),w(this,"faceTrackerFpsTracker",new at(1e3)),w(this,"videoElementSize",{width:0,height:0,offsetX:0,offsetY:0}),w(this,"videoElement",document.createElement("video")),w(this,"frameWidth",0),w(this,"frameHeight",0),w(this,"mirrorVideo",!0),w(this,"settings",{faceTrackerWidth:0,faceTrackerHeight:0,displayMediaStream:!0,objectFit:Ce.COVER}),w(this,"isExtracting",!1),w(this,"starRating",0),w(this,"scaleFactor",1),w(this,"warmupIndex",0),w(this,"warmingUp",!0),w(this,"ftWorkerIndex",0),w(this,"lastFrameNumber",-1),w(this,"on",{faceTrackersReady:null,frameAvailable:null,landmarksAvailable:null,scaleFactorChanged:null});const{mediaElement:c,mirrorVideo:d,numOfWorkers:n,isLoggingFaceTrackerWorkers:a,isLoggingSdk:u,metrics:h,displayMediaStream:E}=i;this.numOfWorkers=n,this.isLoggingFaceTrackerWorkers=a,this.isLoggingSdk=u,this.metrics=h,ui(this,le,r),this.settings.displayMediaStream=E,this.mirrorVideo=d,this.mediaElement=c,this.videoFrameCallback=this.videoFrameCallback.bind(this),this.workers=e,this.scaleFactor=i.scaleFactor,this.initWorkerOnMessage(i.models),this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.preload="auto"}static async init(e,i){const{numOfWorkers:r,faceTrackerCode:c}=e,d=[],n=new TextDecoder().decode(new Uint8Array(c));if(r>0)for(let a=1;a<=r;a+=1){const u=xe.init(n,"module",`FACE_TRACKER_WORKER_${a-1}`);d.push({ft:u,channel:new MessageChannel,isBusy:!1})}return new yt(d,e,i)}initWorkerOnMessage(e){const i=window.matchMedia("(orientation: portrait)").matches,r=i?360:640,c=i?640:360;this.workers.forEach(d=>{d.ft.worker.postMessage({action:$.INIT_TFJS,payload:{width:r,height:c,models:e,scaleFactor:this.scaleFactor}}),d.ft.worker.postMessage({action:$.SET_PORT,payload:{port:d.channel.port2}},[d.channel.port2]),d.ft.worker.onmessage=n=>{const{action:a,payload:u}=n.data;switch(a){case $.INIT_TFJS:break;case $.READY:{const{workerName:h,version:E,workerId:_,backend:C}=u;this.on.faceTrackersReady&&this.on.faceTrackersReady(h,E,_,C);break}case $.LANDMARKS:{this.faceTrackerFpsTracker.tick(),d.isBusy=!1,this.warmingUp&&this.warmupIndex++;const{face:h,annotations:E,frameTimestamp:_}=u;this.on.landmarksAvailable&&this.on.landmarksAvailable(h,E,_);break}case $.DESTROY:{const{workerId:h}=u;this.workers[h].ft.destroy();break}}}})}getMediaElement(){return this.mediaElement}setIsExtracting(e){this.isExtracting=e}destroyWorkers(){setTimeout(async()=>{this.videoCallbackId&&this.videoElement.cancelVideoFrameCallback(this.videoCallbackId),this.workers.forEach(e=>e.ft.worker.postMessage({action:$.DESTROY}))},200)}createMediaElements(){this.videoElement.addEventListener("ended",async()=>{this.destroyWorkers()});const e=document.createElement("div"),i=this.settings.displayMediaStream?this.videoElement:e,r="white";this.mediaElement.appendChild(i),i.style.width="100%",i.style.height="100%",i.style.boxSizing="border-box",this.settings.displayMediaStream&&(i.style.border=`1px solid ${r}`),i.style.objectFit=this.settings.objectFit,i.style.transform=`scale(${this.mirrorVideo?"-1":"1"},1)`,this.settings.displayMediaStream||(i.style.height=`${this.frameHeight}px`,i.style.width=`${this.frameWidth}px`),new ResizeObserver(d=>{const{contentRect:n,target:a}=d[0],{width:u,height:h}=n,{x:E,y:_}=a.getBoundingClientRect(),{faceTrackerWidth:C,faceTrackerHeight:k}=this.settings;this.videoElementSize=ii(this.settings.objectFit,[u,h,this.frameWidth,this.frameHeight]);const{width:I,height:W}=this.videoElementSize;if(!this.settings.displayMediaStream){const G=this.settings.objectFit===Ce.NONE;i.style.height=`${Math.trunc(G?W:h)}px`,i.style.width=`${Math.trunc(G?I:u)}px`}this.mediaElement.dispatchEvent(new CustomEvent("mediaElementSizeChanged",{detail:{mediaElementSize:{width:u,height:h,x:E,y:_},videoElementSize:this.videoElementSize,frameInfo:{mediaStreamWidth:this.frameWidth,mediaStreamHeight:this.frameHeight,faceTrackerWidth:C,faceTrackerHeight:k},isPortrait:h>u,aspectRatio:u/h}}))}).observe(this.mediaElement)}log(e,i,r){this.isLoggingSdk&&ct(this,le).info(e,i),this.metrics&&ct(this,le).log(e,i,"",!0,r)}videoFrameCallback(e,i){const{presentedFrames:r,captureTime:c,expectedDisplayTime:d,mediaTime:n}=i;this.videoFpsTracker.tick();const a=c===void 0?d:c;this.numOfFramesPresented=r;const u=`Number of frames presented: ${this.numOfFramesPresented} - time: ${a}`;let h=0;if(n&&n>0?h=n*1e3:c&&c>0?h=c>1e6?c-performance.timeOrigin:c:h=e,this.log(u,m.sdk,{captureTime:a,presentedFrames:r}),this.warmingUp)if(this.warmupIndex>=this.numOfWorkers)this.warmingUp=!1;else{const E=this.workers[this.warmupIndex];if(!E.isBusy){E.isBusy=!0;const _=new VideoFrame(this.videoElement,{timestamp:h});E.ft.worker.postMessage({action:"TRACK",payload:{frame:_,frameTimestamp:h,frameNumber:this.numOfFramesPresented}},[_])}}if(!this.warmingUp){const E=new VideoFrame(this.videoElement,{timestamp:h});let _=!1;for(let C=0;C<this.numOfWorkers;C++){this.ftWorkerIndex=(this.ftWorkerIndex+1)%this.numOfWorkers;const k=this.workers[this.ftWorkerIndex];if(k&&!k.isBusy){k.isBusy=!0,this.on.frameAvailable(h,this.numOfFramesPresented,this.lastFrameNumber,!0),k.ft.worker.postMessage({action:"TRACK",payload:{frame:E,frameTimestamp:h,frameNumber:this.numOfFramesPresented}},[E]),_=!0;break}}_||this.on.frameAvailable(h,this.numOfFramesPresented,this.lastFrameNumber,!1,E)}this.lastFrameNumber=this.numOfFramesPresented,this.videoCallbackId=this.videoElement.requestVideoFrameCallback(this.videoFrameCallback)}setFaceTrackerMediaStreamResolution(e,i){(e<=360||i<=360)&&(this.scaleFactor=1),this.settings.faceTrackerWidth=e*this.scaleFactor,this.settings.faceTrackerHeight=i*this.scaleFactor,this.workers.forEach(r=>r.ft.worker.postMessage({action:$.SCALE_FACTOR_CHANGED,payload:{scaleFactor:this.scaleFactor}})),this.on.scaleFactorChanged&&this.on.scaleFactorChanged(this.scaleFactor)}async setMediaStream(e){if(e instanceof MediaStream)try{const{settings:i,constraints:r}=await fi(this,Be,ht).call(this,e,this.videoElement);await this.videoElement.play(),this.settings.displayMediaStream||(this.videoElement.style.visibility="none");const{width:c,height:d}=i;return this.setFaceTrackerMediaStreamResolution(c??0,d??0),this.frameWidth=c||1,this.frameHeight=d||1,this.log(`Face tracker resolution: ${c} x ${d} pixels. Video resolution: ${this.frameWidth} x ${this.frameHeight} pixels`,m.sdk,{ftWidth:c,ftHeight:d,frameWidth:this.frameWidth,frameHeight:this.frameHeight}),this.createMediaElements(),this.videoCallbackId=this.videoElement.requestVideoFrameCallback(this.videoFrameCallback),!0}catch(i){return console.log("Error applying face tracker video track constraints",i),!1}return!1}stopTracking(){this.videoCallbackId&&this.videoElement.cancelVideoFrameCallback(this.videoCallbackId),this.videoElement.pause(),this.videoElement.srcObject=null}};le=new WeakMap,Be=new WeakSet,ht=async function(t,e){e.srcObject=t,await new Promise(r=>e.onloadedmetadata=r);const[i]=t.getVideoTracks();return{constraints:i.getConstraints(),settings:i.getSettings()}};let pi=Ei;var T=(t=>(t.INIT="INIT",t.READY="READY",t.SET_MODE="SET_MODE",t.SET_NUMBER_OF_CHUNKS="SET_NUMBER_OF_CHUNKS",t.SET_TARGET_FPS="SET_TARGET_FPS",t.SET_CHUNK_DURATION_SECONDS="SET_CHUNK_DURATION_SECONDS",t.SET_FRAME_ORDER="SET_FRAME_ORDER",t.GET_CONSTRAINTS_CONFIG="GET_CONSTRAINTS_CONFIG",t.SET_CONSTRAINTS_CONFIG="SET_CONSTRAINTS_CONFIG",t.SET_FACE_ATTRIBUTE="SET_FACE_ATTRIBUTE",t.RESET_COLLECTION="RESET_COLLECTION",t.CANCEL_COLLECTION="CANCEL_COLLECTION",t.START_COLLECTION="START_COLLECTION",t.SET_PORTS="SET_PORTS",t.COLLECTOR_ERROR="COLLECTOR_ERROR",t.STAR_RATING="STAR_RATING",t.ALL_FACE_TRACKERS_WARMED_UP="ALL_FACE_TRACKERS_WARMED_UP",t.CONSTRAINTS_UPDATED="CONSTRAINTS_UPDATED",t.SHOULD_END_MEASUREMENT_EARLY="SHOULD_END_MEASUREMENT_EARLY",t.GET_LOGS="GET_LOGS",t.NEW_FRAME="NEW_FRAME",t.TRACKING_STATUS="TRACKING_STATUS",t.SCALE_FACTOR_CHANGED="SCALE_FACTOR_CHANGED",t))(T||{}),y=(t=>(t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.DISCONNECTED="DISCONNECTED",t.LOGIN_WITH_TOKEN_SUCCESS="LOGIN_WITH_TOKEN_SUCCESS",t.SUBSCRIBED_TO_RESULTS="SUBSCRIBED_TO_RESULTS",t.CHUNK_SENT="CHUNK_SENT",t.RESULTS_RECEIVED="RESULTS_RECEIVED",t.CHUNK_ACKNOWLEDGED="CHUNK_ACKNOWLEDGED",t.ERROR="ERROR",t.NETWORK_DELAY="NETWORK_DELAY",t))(y||{}),Ti=Object.defineProperty,mt=t=>{throw TypeError(t)},Si=(t,e,i)=>e in t?Ti(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ut=(t,e,i)=>Si(t,typeof e!="symbol"?e+"":e,i),Ge=(t,e,i)=>e.has(t)||mt("Cannot "+i),s=(t,e,i)=>(Ge(t,e,"read from private field"),i?i.call(t):e.get(t)),S=(t,e,i)=>e.has(t)?mt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),f=(t,e,i,r)=>(Ge(t,e,"write to private field"),e.set(t,i),i),l=(t,e,i)=>(Ge(t,e,"access private method"),i),bi=(t,e,i,r)=>({set _(c){f(t,e,c)},get _(){return s(t,e,r)}}),x,g,P,v,L,ke,ve,Ae,ye,ce,z,Oe,de,he,b,q,D,me,F,Ne,Z,Q,ee,te,ue,fe,Y,Ee,Le,ie,De,se,pe,A,Te,B,Se,o,ft,Et,pt,He,Ve,Tt,St,bt,_t,gt,wt,Ie,Ke,p,Rt,Ct,kt,vt,ae,R;const At=Symbol("instance_creation_key"),_i=class Ot{constructor(e){if(S(this,o),S(this,x),S(this,g,{mediaElement:document.createElement("div"),assetFolder:"",apiUrl:"",metrics:!1,logger:{sdk:!1,mediaPipe:!1,beforeRESTCall:!1,afterRESTCall:!1,extractionLibWasm:!1,apiClient:!1,extractionWorker:!1,faceTrackerWorkers:!1},mirrorVideo:!0,displayMediaStream:!0,constraintOverrides:{}}),S(this,P,[{file:"decompress.json",uncompressedSize:89469},{file:"extraction_worker_0.1.0-beta.2_js.json",uncompressedSize:59696},{file:"facetracker_worker_0.1.0-beta.2_js.json",uncompressedSize:306553},{file:"extraction_wasm_0.1.0-beta.2.json",uncompressedSize:1926126},{file:"detectorModel_json.json",uncompressedSize:4640},{file:"detectorModel_bin.json",uncompressedSize:242046},{file:"landmarkModel_json.json",uncompressedSize:5036},{file:"landmarkModel_bin.json",uncompressedSize:1704814}]),S(this,v,new nt),S(this,L,Yt.init()),S(this,ke),S(this,ve),S(this,Ae),S(this,ye),S(this,ce),S(this,z),S(this,Oe),S(this,de,{version:"",sdkId:""}),S(this,he,""),S(this,b),S(this,q,0),S(this,D),S(this,me,j.ASSETS_NOT_DOWNLOADED),S(this,F,""),S(this,Ne,""),S(this,Z,!1),S(this,Q,5),S(this,ee,30),S(this,te,5),S(this,ue,!1),S(this,fe,4),S(this,Y),S(this,Ee),S(this,Le),S(this,ie,1e7),S(this,De,0),S(this,se,new Map),S(this,pe,Promise.resolve()),S(this,A,0),S(this,Te,-1),S(this,B,-1),S(this,Se,.5),ut(this,"on",{beforeRESTCall:null,afterRESTCall:null,bytesDownloaded:null,faceTrackerStateChanged:null,resultsReceived:null,constraintsUpdated:null,mediaElementResize:null,facialLandmarksUpdated:null,chunkSent:null,error:null}),e!==At)throw new Error("Use await Measurement.init() to create an instance of Measurement class.")}static async init(e){if(!e)throw new Error("Missing `settings` object");const i=new Ot(At);if(!i.setSettings(e))throw new Error("Invalid settings object");f(i,x,Bt({url:{http:new URL("https://api.deepaffex.ai")},onBeforeRESTCall:()=>{var n,a;l(n=i,o,St).call(n),l(a=i,o,bt).call(a)},onAfterRESTCall:(n,a)=>{var u,h;l(u=i,o,_t).call(u,n,a),l(h=i,o,gt).call(h,n,a)}}));const c=n=>{var a;const{bytes:u,url:h,uncompressedSize:E,done:_}=n.detail;l(a=i,o,p).call(a,`bytesDownloaded event, ${u}, ${E}, ${h}, ${_}`,m.mediaPipe),i.on.bytesDownloaded&&i.on.bytesDownloaded(u,E,h,_)},d=n=>{var a;const{error:u,url:h}=n.detail;l(a=i,o,p).call(a,`downloadError event, ${h}, ${u}`,m.mediaPipe),i.on.error&&i.on.error(Re.ASSET_DOWNLOAD,{url:h,error:u})};return s(i,L).addEventListener("downloadedError",d),s(i,L).addEventListener("bytesDownloaded",c),s(i,v).setVersion(i.getVersion()),s(i,g).logger&&Object.values(s(i,g).logger).some(n=>n===!0)&&s(i,v).start(),setTimeout(()=>{var n;l(n=i,o,ae).call(n,j.ASSETS_NOT_DOWNLOADED)},500),new Proxy(i,{get(n,a,u){const h=a;return typeof n[h]=="function"?n[h].bind(n):Reflect.get(n,h,u)},set(n,a,u){return console.log(`Setting property "${String(a)}" to "${u}" is not allowed`),!0}})}loadMask(e){if(s(this,b)){let i=!1;const r=s(this,b).mediaElement.querySelector("svg");r&&(i=!0,s(this,b).mediaElement.removeChild(r)),s(this,b).mediaElement.appendChild(e),i&&(s(this,b).mediaElement.style.setProperty("border","1px solid transparent"),setTimeout(()=>{s(this,b).mediaElement.removeAttribute("style")},100))}}setSettings(e){const i=ai(s(this,g),e);return i.results==="valid"?(f(this,g,i.settings),!0):!1}getVersion(){return{webSDK:Je,extractionLib:s(this,de),faceTracker:s(this,he)}}async downloadAssets(){const{assetFolder:e}=s(this,g);try{if(l(this,o,p).call(this,`Asset base URL ${e}`,m.sdk),l(this,o,p).call(this,"Start downloading decompressor...",m.sdk),await s(this,L).fetchAsset(s(this,P),`${e}/`,"decompress.json",!0,"gzip"),s(this,L).canDecompress){await l(this,o,Et).call(this,e),s(this,z)&&await l(this,o,Ve).call(this),l(this,o,p).call(this,"Start downloading TFJS worker...",m.mediaPipe);const i=await s(this,L).fetchAsset(s(this,P),`${e}/`,`facetracker_worker_${this.getVersion().webSDK}_js.json`,!0,"brotli");return i&&(f(this,Oe,i),await l(this,o,ft).call(this,e),await l(this,o,He).call(this)),l(this,o,pt).call(this),!0}}catch{return l(this,o,p).call(this,"Failed to download TFJS face tracker or DFX extraction worker WASM assets",m.mediaPipe),!1}}setExtractionLibSettings(e=6,i=30,r=5){f(this,Q,e-1),f(this,ee,i),f(this,te,r)}async setNextChunkAsFinal(){f(this,ue,!0),await l(this,o,R).call(this,T.SHOULD_END_MEASUREMENT_EARLY,{},!0),l(this,o,p).call(this,"Set the action for the next chunk to LAST::PROCESS",m.extractionLibWasm)}async startTracking(){s(this,b)&&(s(this,b).isExtracting||(s(this,b).setIsExtracting(!0),l(this,o,p).call(this,"Start tracking frames",m.mediaPipe),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0),await l(this,o,Ie).call(this)))}async stopTracking(){if(s(this,b)){s(this,b).stopTracking(),await l(this,o,wt).call(this),s(this,b).setIsExtracting(!1),l(this,o,p).call(this,"Stop extracting frames",m.mediaPipe);const{numOfFramesPresented:e,warmupFrameNumber:i,numOftrackedVideoFrames:r}=s(this,b);l(this,o,p).call(this,"Tracking metrics",m.sdk,{numOfFramesPresented:e,warmupFrameNumber:i,numOftrackedVideoFrames:r}),f(this,F,"")}}async disconnect(){s(this,Z)&&await l(this,o,R).call(this,y.DISCONNECT,{},!0),s(this,g).metrics&&(await l(this,o,R).call(this,T.GET_LOGS,{},!0),s(this,v).retrieveLogs())}async destroy(){s(this,D)&&(s(this,D).destroy(),l(this,o,p).call(this,"Destroyed",m.extractionLibWasm)),s(this,b)&&(s(this,b).destroyWorkers(),l(this,o,p).call(this,"Destroyed",m.mediaPipe))}async reset(){return s(this,me)===j.READY?(await this.stopTracking(),await this.destroy(),f(this,v,new nt),f(this,de,{version:"",sdkId:""}),f(this,he,""),f(this,q,0),f(this,F,""),f(this,Z,!1),f(this,Q,5),f(this,ee,30),f(this,te,5),f(this,ue,!1),f(this,Y,void 0),f(this,ie,1e7),f(this,De,0),f(this,se,new Map),f(this,pe,Promise.resolve()),f(this,A,0),f(this,Te,-1),f(this,B,-1),s(this,g).mediaElement.innerHTML="",await l(this,o,Ve).call(this),await l(this,o,He).call(this),!0):!1}async setMediaStream(e){if(s(this,b)&&!s(this,b).isExtracting&&s(this,D)){await s(this,b).setMediaStream(e);const i=Object.fromEntries(s(this,b).workers.map((r,c)=>[`port${c+1}`,r.channel.port1]));s(this,D).worker.postMessage({action:T.SET_PORTS,payload:{numOfWorkers:s(this,fe),workerPorts:i}},[...s(this,b).workers.map(r=>r.channel.port1)])}}async prepare(e,i,r,c){s(this,x).setSession({userToken:e,userRefreshToken:i});const{region:d,status:n}=await l(this,o,Rt).call(this,"user");let a=`api.${d}.deepaffex.ai`;s(this,g).apiUrl?a=s(this,g).apiUrl:s(this,g).apiUrl=a,s(this,x).setUrl(`https://${a}`);const u=await l(this,o,Ct).call(this,e,i,"user"),h=await l(this,o,kt).call(this,r,c);return u&&h&&n==="200"}async setConstraintsConfig(e){await l(this,o,R).call(this,T.SET_CONSTRAINTS_CONFIG,{...s(this,Le),...e&&{...s(this,g).constraintOverrides}},!0)}async startMeasurement(e=!1,i={}){if(f(this,ue,!1),f(this,F,""),await l(this,o,vt).call(this,i),s(this,D)&&s(this,F)!==""){await l(this,o,Ke).call(this),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,Q)+1},!0),await this.setConstraintsConfig(e),await l(this,o,Tt).call(this),await l(this,o,Ie).call(this);const{userToken:r}=s(this,x).getSession();r?await l(this,o,R).call(this,y.CONNECT,{token:r,measurementId:s(this,F)},!0):l(this,o,p).call(this,"User token is missing. Unable to connect.",m.webSocket)}}setDemographics(e){ri(e)?(f(this,Y,e),l(this,o,p).call(this,`Demographics updated ${JSON.stringify(e)}`,m.extractionLibWasm)):l(this,o,p).call(this,`Error updating Demographics ${JSON.stringify(e)}`,m.extractionLibWasm)}setObjectFit(e){return s(this,b)&&Ce!==void 0&&Object.values(Ce).includes(e)?(s(this,b).settings.objectFit=e,!0):!1}};x=new WeakMap,g=new WeakMap,P=new WeakMap,v=new WeakMap,L=new WeakMap,ke=new WeakMap,ve=new WeakMap,Ae=new WeakMap,ye=new WeakMap,ce=new WeakMap,z=new WeakMap,Oe=new WeakMap,de=new WeakMap,he=new WeakMap,b=new WeakMap,q=new WeakMap,D=new WeakMap,me=new WeakMap,F=new WeakMap,Ne=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,ue=new WeakMap,fe=new WeakMap,Y=new WeakMap,Ee=new WeakMap,Le=new WeakMap,ie=new WeakMap,De=new WeakMap,se=new WeakMap,pe=new WeakMap,A=new WeakMap,Te=new WeakMap,B=new WeakMap,Se=new WeakMap,o=new WeakSet,ft=async function(t){l(this,o,p).call(this,"Start downloading TFJS face tracker assets...",m.mediaPipe);const e=`${t}/models/`,[i,r,c,d]=await Promise.all([s(this,L).fetchAsset(s(this,P),e,"detectorModel_json.json",!0,"brotli"),s(this,L).fetchAsset(s(this,P),e,"detectorModel_bin.json",!0,"brotli"),s(this,L).fetchAsset(s(this,P),e,"landmarkModel_json.json",!0,"brotli"),s(this,L).fetchAsset(s(this,P),e,"landmarkModel_bin.json",!0,"brotli")]);l(this,o,p).call(this,"TFJS face tracker assets successfully downloaded",m.mediaPipe),f(this,ke,i),f(this,ve,r),f(this,Ae,c),f(this,ye,d)},Et=async function(t){l(this,o,p).call(this,"Start downloading DFX extraction worker assets...",m.extractionLibWasm);const[e,i]=await Promise.all([s(this,L).fetchAsset(s(this,P),`${t}/extraction/`,`extraction_wasm_${this.getVersion().webSDK}.json`,!0,"brotli"),s(this,L).fetchAsset(s(this,P),`${t}/`,`extraction_worker_${this.getVersion().webSDK}_js.json`,!0,"brotli")]);l(this,o,p).call(this,"DFX extraction worker assets successfully downloaded",m.extractionLibWasm),f(this,ce,e),f(this,z,i)},pt=function(){if(s(this,b)){const t=e=>{this.on.mediaElementResize&&this.on.mediaElementResize(e)};s(this,g).mediaElement.addEventListener("mediaElementSizeChanged",t)}},He=async function(){s(this,g),l(this,o,ae).call(this,j.NOT_LOADED);const t={faceTrackerCode:s(this,Oe),numOfWorkers:s(this,fe),mediaElement:s(this,g).mediaElement,mirrorVideo:s(this,g).mirrorVideo,metrics:s(this,g).metrics,displayMediaStream:s(this,g).displayMediaStream,isLoggingFaceTrackerWorkers:s(this,g).logger?.faceTrackerWorkers??!1,isLoggingSdk:s(this,g).logger?.sdk??!1,scaleFactor:s(this,Se),models:{detectorJson:s(this,ke),detectorBin:s(this,ve),landmarkJson:s(this,Ae),landmarkBin:s(this,ye)}};l(this,o,ae).call(this,j.LOADING),f(this,b,await pi.init(t,s(this,v))),s(this,b).on.faceTrackersReady=(e,i,r,c)=>{l(this,o,p).call(this,`TFJS face tracker version ${i} loaded. Worker name: ${e} - workerId: ${r} - backend: ${c}`,m.mediaPipe),f(this,he,`${i}-${c}`),f(this,q,s(this,q)+1),s(this,v).setVersion(this.getVersion()),s(this,q)===s(this,fe)&&l(this,o,ae).call(this,j.LOADED)},s(this,b).on.frameAvailable=(e,i,r,c,d)=>{!c&&d?s(this,D).worker.postMessage({action:T.NEW_FRAME,payload:{frameNumber:i,frameTimestamp:e,frame:d,lastFrameNumber:r,tracked:c}},[d]):s(this,D).worker.postMessage({action:T.TRACKING_STATUS,payload:{frameNumber:i,frameTimestamp:e,lastFrameNumber:r,tracked:c}})},s(this,b).on.landmarksAvailable=(e,i,r)=>{const c=r/1e3;s(this,B)===0&&f(this,B,c),f(this,Te,c),s(this,b).numOftrackedVideoFrames+=1;const{starRating:d}=s(this,b),n=30,a=Math.min(s(this,Te)-s(this,B),n),u=s(this,B)>0?a/n*100:0,h={video:s(this,b).videoFpsTracker.fps.toFixed(1),faceTracker:s(this,b).faceTrackerFpsTracker.fps.toFixed(1)},E={face:e,annotations:i,starRating:d,percentCompleted:u,fps:h};this.on.facialLandmarksUpdated&&this.on.facialLandmarksUpdated(E)},s(this,b).on.scaleFactorChanged=e=>{f(this,Se,e),s(this,b).scaleFactor=e,s(this,D).worker.postMessage({action:T.SCALE_FACTOR_CHANGED,payload:{scaleFactor:e}})}},Ve=async function(){const t=new TextDecoder().decode(new Uint8Array(s(this,z)));f(this,D,xe.init(t,"module","EXTRACTION_WORKER"));const{studyCfgData:e}=s(this,x).getSession();e&&s(this,ce)&&s(this,z)&&(s(this,D).worker.onmessage=async i=>{const{data:r}=i,{id:c,result:d}=r,{action:n,payload:a}=d,u=s(this,se).get(c);if(u||c===-1){switch(n){case T.READY:{const{sdkId:h,version:E,workerName:_}=a;f(this,de,{version:E,sdkId:h}),l(this,o,p).call(this,`DFX extraction worker WASM loaded. SDK ID: ${h} - Version: ${E} - Worker Name: ${_}`,m.extractionLibWasm),await l(this,o,R).call(this,T.SET_MODE,{value:"discrete"},!0),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0),await l(this,o,R).call(this,T.SET_TARGET_FPS,{value:s(this,ee)},!0),await l(this,o,R).call(this,T.SET_CHUNK_DURATION_SECONDS,{value:s(this,te)},!0),await l(this,o,R).call(this,T.SET_FRAME_ORDER,{value:ot.RGBA},!0),await l(this,o,R).call(this,T.GET_CONSTRAINTS_CONFIG,{},!0),f(this,Le,s(this,Ee));break}case T.SET_MODE:{a&&l(this,o,p).call(this,`Set mode to ${a.mode}`,m.extractionLibWasm);break}case T.SET_NUMBER_OF_CHUNKS:{a&&l(this,o,p).call(this,`Set number of chunks to ${d.number}`,m.extractionLibWasm);break}case T.SET_TARGET_FPS:{a&&l(this,o,p).call(this,`Set target FPS to ${s(this,ee)}`,m.extractionLibWasm);break}case T.SET_CHUNK_DURATION_SECONDS:{a&&l(this,o,p).call(this,`Set chunk duration to ${s(this,te)} Seconds`,m.extractionLibWasm);break}case T.SET_FRAME_ORDER:{a&&l(this,o,p).call(this,"Set channel order RGBA",m.extractionLibWasm);break}case T.GET_CONSTRAINTS_CONFIG:{a&&(f(this,Ee,a),l(this,o,p).call(this,`Get constraints ${JSON.stringify(a)}`,m.extractionLibWasm));break}case T.SET_CONSTRAINTS_CONFIG:{a&&(f(this,Ee,a),l(this,o,p).call(this,`Set constraints ${JSON.stringify(a)}`,m.extractionLibWasm));break}case T.SET_FACE_ATTRIBUTE:{const{success:h,faceId:E,attribute:_,value:C}=a;h&&l(this,o,p).call(this,`Set face attribute: faceId: ${E}, attribute: ${_}, value: ${C}`,m.extractionLibWasm);break}case T.RESET_COLLECTION:{a&&l(this,o,p).call(this,"Reset collection",m.extractionLibWasm);break}case T.CANCEL_COLLECTION:{a&&l(this,o,p).call(this,"Collecttion cancelled",m.extractionLibWasm);break}case T.START_COLLECTION:{a&&l(this,o,p).call(this,`Collector started - state: ${a}`,m.extractionLibWasm);break}case T.SET_PORTS:{a&&l(this,o,p).call(this,"Ports set",m.extractionLibWasm);break}case T.COLLECTOR_ERROR:{if(a){const{error:h,frameNumber:E}=a;l(this,o,p).call(this,`Collector error on frame ${E}: ${h}`,m.extractionLibWasm),this.on.error&&this.on.error(Re.COLLECTOR,a),await this.stopTracking()}break}case T.STAR_RATING:{s(this,b).starRating=a.rating;break}case T.ALL_FACE_TRACKERS_WARMED_UP:{const{frameNumber:h}=d;s(this,b).warmupFrameNumber=h,l(this,o,p).call(this,"All face tracker workers are warmed up.",m.mediaPipe),l(this,o,ae).call(this,j.READY);break}case T.CONSTRAINTS_UPDATED:{const{feedback:h,status:E}=a;this.on.constraintsUpdated&&this.on.constraintsUpdated(h,E);break}case T.SHOULD_END_MEASUREMENT_EARLY:{const{currentFinalChunkNumber:h,currentResultsOrder:E,newFinalChunkNumber:_}=d;l(this,o,p).call(this,`Request the end measurement early. Current final chunk number: ${h}, Current results order: ${E}, New final chunk number: ${_}`,m.extractionLibWasm);break}case T.GET_LOGS:{console.log(`DFX Log: ${a}`);break}case y.CONNECT:{f(this,Z,!0),f(this,B,0),l(this,o,p).call(this,a?"Connected":"Connection error",m.webSocket);break}case y.LOGIN_WITH_TOKEN_SUCCESS:{l(this,o,p).call(this,"Successfully logged in with token",m.webSocket);break}case y.SUBSCRIBED_TO_RESULTS:{l(this,o,p).call(this,"Subscribed to the results",m.webSocket);break}case y.CHUNK_SENT:{l(this,o,p).call(this,`Chunk sent ${JSON.stringify(a)}`,m.webSocket),this.on.chunkSent&&this.on.chunkSent(a);break}case y.DISCONNECT:{f(this,Z,!1),l(this,o,p).call(this,"Disconnect",m.webSocket);break}case y.DISCONNECTED:{l(this,o,p).call(this,`Disconnected! - code: ${a.code}, reason: ${a.reason}, wasClean: ${a.wasClean}`,m.webSocket),this.on.error&&this.on.error(Re.WEB_SOCKET,a);break}case y.CHUNK_ACKNOWLEDGED:{l(this,o,p).call(this,`Chunk number ${a.chunkOrder} received by the server!`,m.webSocket),s(this,Q)===a.chunkOrder&&await this.stopTracking();break}case y.RESULTS_RECEIVED:{const{resultsOrder:h,finalChunkNumber:E}=a;this.on.resultsReceived&&this.on.resultsReceived(a),l(this,o,p).call(this,`Results received: ${JSON.stringify(a)}`,m.webSocket),h===E&&(await l(this,o,R).call(this,y.DISCONNECT,{},!0),await l(this,o,Ke).call(this),await l(this,o,Ie).call(this));break}case y.NETWORK_DELAY:{const{delay:h,description:E,actionId:_}=a;l(this,o,p).call(this,`Round-trip delay for ${E} call with Action ID ${_} was ${h.toFixed(2)} ms`,m.webSocket,{delay:h,actionId:_,description:E});break}case y.ERROR:{l(this,o,p).call(this,"Error",m.webSocket),this.on.error&&this.on.error(Re.WEB_SOCKET,a);break}}u&&(u.resolve(d),s(this,se).delete(c))}},await l(this,o,R).call(this,T.INIT,{wasm:s(this,ce),studyConfigData:e,isLogging:s(this,g).logger?.extractionWorker||!1,metrics:s(this,g).metrics||!1,apiUrl:s(this,g).apiUrl,scaleFactor:s(this,Se)},!0))},Tt=async function(){if(s(this,b)&&s(this,Y)){const{age:e,height:i,weight:r,sex:c,smoking:d,bloodPressureMedication:n,diabetes:a}=s(this,Y);await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.SEX_ASSIGNED_AT_BIRTH,value:c},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.AGE_YEARS,value:e},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.HEIGHT_CM,value:i},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.WEIGHT_KG,value:r},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.SMOKER,value:d},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.BLOOD_PRESSURE_MEDICATION,value:n},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:K.DIABETES,value:a},!0),l(this,o,p).call(this,`Set demographics for Face ID 1, ${JSON.stringify(s(this,Y))}`,m.extractionLibWasm)}},St=function(){},bt=function(){const t=new Date().toISOString();st(t)&&(l(this,o,p).call(this,`Action ID: ${s(this,A)}`,m.beforeRESTCall),this.on.beforeRESTCall&&this.on.beforeRESTCall(t,s(this,A)))},_t=function(t,e){},gt=function(t,e){const i=new Date().toISOString();st(i)&&(l(this,o,p).call(this,`Action ID: ${s(this,A)}, HTTP status code: ${t}, error: ${JSON.stringify(e)}`,m.afterRESTCall),this.on.afterRESTCall&&this.on.afterRESTCall(i,s(this,A),t,e))},wt=async function(){await l(this,o,R).call(this,T.CANCEL_COLLECTION,{},!0)},Ie=async function(){await l(this,o,R).call(this,T.START_COLLECTION,{},!0)},Ke=async function(){await l(this,o,R).call(this,T.RESET_COLLECTION,{},!0),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0)},p=function(t,e,i){s(this,g).metrics&&s(this,v).log(t,e,"",!0,i),s(this,g).logger?.mediaPipe&&e===m.mediaPipe&&s(this,v).info(t,e),s(this,g).logger?.beforeRESTCall&&e===m.beforeRESTCall&&s(this,v).info(t,e),s(this,g).logger?.afterRESTCall&&e===m.afterRESTCall&&s(this,v).info(t,e),s(this,g).logger?.extractionLibWasm&&e===m.extractionLibWasm&&s(this,v).info(t,e),s(this,g).logger?.apiClient&&e===m.apiClient&&s(this,v).info(t,e),s(this,g).logger?.webSocket&&e===m.webSocket&&s(this,v).info(t,e),s(this,g).logger?.sdk&&e===m.sdk&&s(this,v).info(t,e)},Rt=async function(t){f(this,A,0);const e=performance.now(),i=await s(this,x).http.auths.validate(t),r=performance.now()-e,{status:c,body:d}=i;if(l(this,o,p).call(this,c==="200"?"Successfully validated the Token":`Failed to validate token. Status: ${c}`,m.apiClient,{delay:r,actionId:s(this,A),description:"Validate Token"}),c==="200"){const{Region:n}=d;return{region:n,status:c}}else return{status:c,region:""}},Ct=async function(t,e,i){f(this,A,2304);const r=performance.now(),c=await s(this,x).http.auths.renew({Token:t,RefreshToken:e},i),d=performance.now()-r,{status:n}=c;return l(this,o,p).call(this,n==="200"?"Successfully refreshed the Token":`Failed to refresh token. Status: ${n}`,m.apiClient,{delay:d,actionId:s(this,A),description:"Refresh Token"}),n==="200"},kt=async function(t,e){f(this,A,806);const i=performance.now();f(this,Ne,t);const r=await s(this,x).http.studies.retrieveSdkConfigData({StudyID:t,...e&&{sdkId:e}},"user"),c=performance.now()-i,{status:d}=r;return l(this,o,p).call(this,d==="200"?"Retrieve SDK Config Data - success":"Retrieve SDK Config Data - failure",m.apiClient,{delay:c,actionId:s(this,A),description:"Retrieve SDK Config Data"}),d==="200"},vt=async function(t){l(this,o,p).call(this,"Get Measurement ID",m.apiClient),f(this,A,504);const e=performance.now(),i={StudyID:s(this,Ne),Resolution:100};t.partnerId&&(i.PartnerID=t.partnerId),t.userProfileId&&(i.UserProfileID=t.userProfileId);const r=await s(this,x).http.measurements.create(i,"user"),c=performance.now()-e,{status:d,body:n}=r;let a="";d==="200"?(f(this,F,n.ID),a=`Successfully obtained measurement ID: ${s(this,F)}`):(f(this,F,""),a=`Failed to obtain measurement ID. Status: ${d}`),l(this,o,p).call(this,a,m.apiClient,{delay:c,actionId:s(this,A),measurementId:s(this,F),description:"Get Measurement ID"})},ae=function(t){f(this,me,t),l(this,o,p).call(this,`Face tracker state changed: ${t}`,m.mediaPipe),this.on.faceTrackerStateChanged&&this.on.faceTrackerStateChanged(s(this,me))},R=function(t,e,i=!1){return new Promise(r=>{const c=bi(this,De)._++;s(this,se).set(c,{resolve:r,action:t});const d=()=>s(this,D).worker.postMessage({id:c,action:t,payload:e});i?f(this,pe,s(this,pe).then(d).catch(n=>console.error(n))):d()})},ut(_i,"VERSION",Je);class gi{static VERSION=Nt;#e=document.createElement("div");#i=document.createElement("div");#s=!1;on={results:null,error:null,event:null};constructor(){this.#e.style.height="100%"}init(e){const{container:i,appPath:r,settings:c,profile:d,config:n,loadError:a,language:u,apiUrl:h}=e;this.#i=i;const E=i.attachShadow({mode:"open"}),_="app",C=document.createElement("link");C.rel="stylesheet",C.href=`${r}/stylex.css`,E.appendChild(C);const k=document.createElement("link");k.rel="stylesheet",k.href=`${r}/${_}.css`,E.appendChild(k);const I=H=>{this.on.results&&this.on.results({...H.detail})},W=H=>{this.on.error&&this.on.error({...H.detail})},G=H=>{this.on.event&&this.on.event({...H.detail})};this.#e.addEventListener(U.RESULTS,I),this.#e.addEventListener(U.ERROR,W),this.#e.addEventListener(U.APPEVENT,G),E.appendChild(this.#e);const M=document.createElement("script");M.type="module",M.src=`${r}/${_}.mjs`,M.onload=()=>{import(M.src).then(H=>{H.app.init(this.#e,r,c,d,h,n,u),this.#s=!0}).catch(()=>{a&&a("Failed to initialize Measurement Embedded React app")})},M.onerror=()=>{a&&a("Failed to load the measurement embedded app script")},E.appendChild(M)}#t(){if(!this.#s)throw new Error("MeasurementEmbeddedApp is not initialized. Call init() before using this method.")}async destroy(){return this.#t(),new Promise(e=>{const i=c=>{if(this.#e.removeEventListener(U.DESTROYED,i),this.#i){const d=this.#i.cloneNode(!1);this.#i.replaceWith(d)}e()};this.#e.addEventListener(U.DESTROYED,i);const r=new CustomEvent("measurement-embedded-app-action",{detail:{action:re.DESTROY,data:{}}});this.#e.dispatchEvent(r)})}setTheme(e){this.#t();const i=new CustomEvent("measurement-embedded-app-action",{detail:{action:re.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(i)}setLanguage(e){this.#t();const i=new CustomEvent("measurement-embedded-app-action",{detail:{action:re.SET_LANGUAGE,data:{language:e}}});this.#e.dispatchEvent(i)}async cancel(e){return this.#t(),new Promise(i=>{const r=d=>{this.#e.removeEventListener(U.CANCELLED,r),i(d.detail.reset)};this.#e.addEventListener(U.CANCELLED,r);const c=new CustomEvent("measurement-embedded-app-action",{detail:{action:re.CANCEL,data:{reset:e}}});this.#e.dispatchEvent(c)})}getLogs(){return this.#t(),new Promise(e=>{const i=c=>{this.#e.removeEventListener(U.LOGS,i),e(c.detail.logs)};this.#e.addEventListener(U.LOGS,i);const r=new CustomEvent("measurement-embedded-app-action",{detail:{action:re.GET_LOGS,data:{}}});this.#e.dispatchEvent(r)})}}export{Ye as ErrorCodes,Lt as appEvents,gi as default,di as faceAttributeValue,je as logCategory};
739
+ `}openLogInNewWindow(){const e=this.generateHTMLTable(),i=new Blob([e],{type:"text/html"}),a=URL.createObjectURL(i);window.open(a,"_blank")}}var Zt=Object.defineProperty,Qt=(t,e,i)=>e in t?Zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Re=(t,e,i)=>Qt(t,typeof e!="symbol"?e+"":e,i);class Fe{constructor(e,i){Re(this,"workerUrl"),Re(this,"worker"),this.worker=e,this.workerUrl=i}static init(e,i,a){const c=new Blob([e],{type:"application/javascript"}),d=URL.createObjectURL(c),n=a||`WORKER${String(new Date().getTime())}`,r=new Worker(new URL(d,import.meta.url),{name:n,type:i});return new Fe(r,d)}destroy(){this.worker&&(this.worker.terminate(),URL.revokeObjectURL(this.worker))}}const ei=(t,e,i,a)=>{const c=t/e,d=i/a;let n=0,r=0;c>d?(n=t,r=t/d):(r=e,n=e*d);const u=(t-n)/2,h=(e-r)/2;return{width:n||0,height:r||0,offsetX:u||0,offsetY:h||0}},ti=(t,e,i,a)=>{const c=(t-i)/2,d=(e-a)/2;return{width:i||0,height:a||0,offsetX:c||0,offsetY:d||0}},ii=(t,e,i,a)=>{const c=t/e,d=i/a;let n=0,r=0;c>d?(r=e,n=e*d):(n=t,r=t/d);const u=(t-n)/2,h=(e-r)/2;return{width:n||0,height:r||0,offsetX:u||0,offsetY:h||0}},si=(t,e)=>{switch(t){case"none":return ti(...e);case"cover":return ei(...e);case"contain":default:return ii(...e)}},at=t=>/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(t),ai=t=>t===void 0?!0:!(typeof t.mediaPipe<"u"&&typeof t.mediaPipe!="boolean"||typeof t.beforeRESTCall<"u"&&typeof t.beforeRESTCall!="boolean"||typeof t.afterRESTCall<"u"&&typeof t.afterRESTCall!="boolean"||typeof t.extractionLibWasm<"u"&&typeof t.extractionLibWasm!="boolean"||typeof t.apiClient<"u"&&typeof t.apiClient!="boolean"||typeof t.extractionWorker<"u"&&typeof t.extractionWorker!="boolean"||typeof t.faceTrackerWorkers<"u"&&typeof t.faceTrackerWorkers!="boolean"||typeof t.sdk<"u"&&typeof t.sdk!="boolean"),ri=(t,e)=>{const i={...t};if(e.logger)if(ai(e.logger))i.logger={...i.logger,...e.logger};else return{results:"invalid"};if(e.apiUrl!==void 0)if(typeof e.apiUrl=="string")i.apiUrl=e.apiUrl;else return{results:"invalid"};if(e.metrics!==void 0)if(typeof e.metrics=="boolean")i.metrics=e.metrics;else return{results:"invalid"};if(e.mirrorVideo!==void 0)if(typeof e.mirrorVideo=="boolean")i.mirrorVideo=e.mirrorVideo;else return{results:"invalid"};if(e.displayMediaStream!==void 0)if(typeof e.displayMediaStream=="boolean")i.displayMediaStream=e.displayMediaStream;else return{results:"invalid"};if(e.assetFolder!==void 0)if(typeof e.assetFolder=="string")i.assetFolder=e.assetFolder;else return{results:"invalid"};if(e.mediaElement!==void 0)if(e.mediaElement instanceof HTMLDivElement)i.mediaElement=e.mediaElement;else return{results:"invalid"};if(e.constraintOverrides!==void 0){let a=function(n,r){if(!(n in d))return!1;const u=d[n];return typeof r===u};const d=Object.fromEntries(Object.entries({backLightMaxPixels_pct:30,backLightSearchMult:1.5,backLightThresh:240,boxCenterX_pct:50,boxCenterY_pct:50,boxHeight_pct:99,boxWidth_pct:50,cameraRot_chunkThresh:.7853981633974483,cameraRot_windowThresh:.2617993877991494,checkBackLight:!1,checkCameraMovement:!1,checkCentered:!1,checkDistance:!1,checkEyebrowMovement:!1,checkFaceDirection:!1,checkLighting:!1,checkMaxDistance:!1,checkMinFps:!1,checkMovement:!1,chunkMovementThresh_pct:60,enableDebugLog:!1,enableFigures:!1,faceRotLR_thresh:.33,faceRotUD_lowerthresh:.25,faceRotUD_upperThresh:5,hy_faceRotLR_thresh:.05,hy_maxFaceRotLR_deg:2,hy_maxFaceRotUD_deg:2,hy_minInterPupilDist_px:5,hy_minimumFps:1,maxEyebrowMovement_mm:3,maxFaceRotLR_deg:12.5,maxFaceRotUD_deg:25,maxMovement_mm:10,minInterPupilDist_px:100,minimumFps:26,movementWindow_ms:2e3,threshBright:225,threshDark:48}).map(([n,r])=>[n,typeof r]));for(const n in e.constraintOverrides){const r=e.constraintOverrides[n];if(!a(n,r))return{results:"invalid"}}i.constraintOverrides=e.constraintOverrides}return{results:"valid",settings:i}},ni=t=>typeof t.age!="number"||t.age<13||t.age>120?(console.error("Invalid age. It should be a number between 13 and 120."),!1):typeof t.height!="number"||t.height<120||t.height>220?(console.error("Invalid height. It should be a number between 120 and 220."),!1):typeof t.weight!="number"||t.weight<30||t.weight>300?(console.error("Invalid weight. It should be a number between 30 and 300."),!1):typeof t.sex!="number"||t.sex<1||t.sex>3?(console.error("Invalid sex. It should be a number between 1 and 3."),!1):typeof t.diabetes!="number"||t.diabetes<4||t.diabetes>6?(console.error("Invalid diabetes. It should be a number between 4 and 6."),!1):typeof t.bloodPressureMedication!="number"||t.bloodPressureMedication!==0&&t.bloodPressureMedication!==1?(console.error("Invalid bloodPressureMedication. It should be either 0 or 1."),!1):typeof t.smoking!="number"||t.smoking!==0&&t.smoking!==1?(console.error("Invalid smoking. It should be either 0 or 1."),!1):!0;var m=(t=>(t.beforeRESTCall="Before REST call event",t.afterRESTCall="After REST call event",t.mediaPipe="MediaPipe",t.extractionLibWasm="DFX Extraction lib WASM",t.apiClient="DFX API client",t.webSocket="WebSocket",t.sdk="SDK",t.dfxWorker="DFX Worker",t))(m||{});const oi=t=>{switch(t){case"Before REST call event":return"red";case"After REST call event":return"orange";case"MediaPipe":return"green";case"DFX Extraction lib WASM":return"violet";case"DFX API client":return"#d34110";case"WebSocket":return"#d34110";case"SDK":return"#d34110";case"DFX Worker":return"#ad4393";default:return"black"}};class rt{constructor(e=1e3){Re(this,"timestamps",[]),Re(this,"windowMs"),this.windowMs=e}tick(e=performance.now()){for(this.timestamps.push(e);this.timestamps.length>0&&e-this.timestamps[0]>this.windowMs;)this.timestamps.shift()}get fps(){const e=this.timestamps.length,i=this.timestamps.at(-1)-this.timestamps[0]||1;return e/i*1e3}get frameCount(){return this.timestamps.length}reset(){this.timestamps=[]}}var li=Object.defineProperty,ci=(t,e,i)=>e in t?li(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,nt=(t,e,i)=>ci(t,typeof e!="symbol"?e+"":e,i);const di=()=>{const t=new Date,e=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),a=t.getFullYear();let c=t.getHours();const d=t.getMinutes().toString().padStart(2,"0"),n=t.getSeconds().toString().padStart(2,"0"),r=t.getMilliseconds().toString().padStart(3,"0"),u=c>=12?"PM":"AM";return c=c%12||12,`[${e}/${i}/${a}, ${c}:${d}:${n}.${r} ${u}]`};class ot{constructor(){nt(this,"mertics",new qt),nt(this,"version",{webSDK:"",extractionLib:{version:"",sdkId:""},faceTracker:""})}retrieveLogs(){this.mertics.transferLogs(),this.mertics.openLogInNewWindow(),this.mertics.debugLogs=[]}setVersion(e){this.version=e,this.mertics.version=e}log(e,i,a,c=!1,d={}){const n=di();if(c)this.mertics.appendLog({thread:"Main",timestamp:n,category:i,message:e,meta:d});else{const r=`[${i}]`,u=" ",h=e,p=`color:${a}; font-weight:800;`,S=`color:${oi(i)}; font-weight:700;`;console.log("%c%s%c%s%c%s%c%s",p,n,S,r,"background:inherit;",u,"font-style: italic;",h)}}info(e,i){this.log(e,i,"blue")}warn(e,i){this.log(e,i,"orange")}error(e,i){this.log(e,i,"red")}debug(e,i){this.log(e,i,"green")}start(){console.log("%c%s","color: #5e5e5e; background-color: #2d2d2d; letter-spacing: 0.1em; text-shadow: -1px -1px 1px #111, 2px 2px 1px #363636; font-size: 36px; padding: 20px 40px; text-align: center; text-transform: uppercase; text-rendering: optimizeLegibility;","Anura Web Core SDK"),console.log(`Version: ${this.version.webSDK}`),console.log("https://www.deepaffex.ai")}}const hi={SEX_NOT_PROVIDED:1,SEX_ASSIGNED_MALE_AT_BIRTH:2,SEX_ASSIGNED_FEMALE_AT_BIRTH:3,DIABETES_NONE:4,DIABETES_TYPE1:5,DIABETES_TYPE2:6,SMOKER_TRUE:0,SMOKER_FALSE:1,BLOOD_PRESSURE_MEDICATION_TRUE:1,BLOOD_PRESSURE_MEDICATION_FALSE:0},V={SEX_ASSIGNED_AT_BIRTH:1,AGE_YEARS:2,HEIGHT_CM:3,WEIGHT_KG:4,SMOKER:5,BLOOD_PRESSURE_MEDICATION:7,DIABETES:8};var lt=(t=>(t[t.BGR=1]="BGR",t[t.RGB=2]="RGB",t[t.BGRA=3]="BGRA",t[t.RGBA=4]="RGBA",t[t.Infrared=5]="Infrared",t[t.Infrared888=6]="Infrared888",t[t.BGR_Infrared=7]="BGR_Infrared",t[t.RGB_Infrared=8]="RGB_Infrared",t[t.Gray=9]="Gray",t))(lt||{});const K={ASSETS_NOT_DOWNLOADED:"ASSETS_NOT_DOWNLOADED",NOT_LOADED:"NOT_LOADED",LOADING:"LOADING",LOADED:"LOADED",READY:"READY"},Ce={COLLECTOR:"COLLECTOR",ASSET_DOWNLOAD:"ASSET_DOWNLOAD",WEB_SOCKET:"WEB_SOCKET"},ke={CONTAIN:"contain",COVER:"cover",NONE:"none"};var $=(t=>(t.INIT="INIT",t.READY="READY",t.INIT_TFJS="INIT_TFJS",t.SET_PORT="SET_PORT",t.TRACK="TRACK",t.RESULTS_READY="RESULTS_READY",t.WARM_UP="WARM_UP",t.DESTROY="DESTROY",t.LANDMARKS="LANDMARKS",t.VIDEO_FRAME="VIDEO_FRAME",t.SCALE_FACTOR_CHANGED="SCALE_FACTOR_CHANGED",t))($||{}),mi=Object.defineProperty,ct=t=>{throw TypeError(t)},ui=(t,e,i)=>e in t?mi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,w=(t,e,i)=>ui(t,typeof e!="symbol"?e+"":e,i),Be=(t,e,i)=>e.has(t)||ct("Cannot "+i),dt=(t,e,i)=>(Be(t,e,"read from private field"),i?i.call(t):e.get(t)),ht=(t,e,i)=>e.has(t)?ct("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),fi=(t,e,i,a)=>(Be(t,e,"write to private field"),e.set(t,i),i),Ei=(t,e,i)=>(Be(t,e,"access private method"),i),ce,Ge,mt;const pi=class Ot{constructor(e,i,a){ht(this,Ge),ht(this,ce),w(this,"mediaElement"),w(this,"numOfFramesPresented",0),w(this,"workers",[]),w(this,"numOftrackedVideoFrames",0),w(this,"warmupFrameNumber",0),w(this,"videoCallbackId",0),w(this,"numOfWorkers",4),w(this,"isLoggingFaceTrackerWorkers",!1),w(this,"isLoggingSdk",!1),w(this,"workerIndex",0),w(this,"metrics",!1),w(this,"videoFpsTracker",new rt(1e3)),w(this,"faceTrackerFpsTracker",new rt(1e3)),w(this,"videoElementSize",{width:0,height:0,offsetX:0,offsetY:0}),w(this,"videoElement",document.createElement("video")),w(this,"frameWidth",0),w(this,"frameHeight",0),w(this,"mirrorVideo",!0),w(this,"settings",{faceTrackerWidth:0,faceTrackerHeight:0,displayMediaStream:!0,objectFit:ke.COVER}),w(this,"isExtracting",!1),w(this,"starRating",0),w(this,"scaleFactor",1),w(this,"warmupIndex",0),w(this,"warmingUp",!0),w(this,"ftWorkerIndex",0),w(this,"lastFrameNumber",-1),w(this,"on",{faceTrackersReady:null,frameAvailable:null,landmarksAvailable:null,scaleFactorChanged:null});const{mediaElement:c,mirrorVideo:d,numOfWorkers:n,isLoggingFaceTrackerWorkers:r,isLoggingSdk:u,metrics:h,displayMediaStream:p}=i;this.numOfWorkers=n,this.isLoggingFaceTrackerWorkers=r,this.isLoggingSdk=u,this.metrics=h,fi(this,ce,a),this.settings.displayMediaStream=p,this.mirrorVideo=d,this.mediaElement=c,this.videoFrameCallback=this.videoFrameCallback.bind(this),this.workers=e,this.scaleFactor=i.scaleFactor,this.initWorkerOnMessage(i.models),this.videoElement.muted=!0,this.videoElement.playsInline=!0,this.videoElement.preload="auto"}static async init(e,i){const{numOfWorkers:a,faceTrackerCode:c}=e,d=[],n=new TextDecoder().decode(new Uint8Array(c));if(a>0)for(let r=1;r<=a;r+=1){const u=Fe.init(n,"module",`FACE_TRACKER_WORKER_${r-1}`);d.push({ft:u,channel:new MessageChannel,isBusy:!1})}return new Ot(d,e,i)}initWorkerOnMessage(e){const i=window.matchMedia("(orientation: portrait)").matches,a=i?360:640,c=i?640:360;this.workers.forEach(d=>{d.ft.worker.postMessage({action:$.INIT_TFJS,payload:{width:a,height:c,models:e,scaleFactor:this.scaleFactor}}),d.ft.worker.postMessage({action:$.SET_PORT,payload:{port:d.channel.port2}},[d.channel.port2]),d.ft.worker.onmessage=n=>{const{action:r,payload:u}=n.data;switch(r){case $.INIT_TFJS:break;case $.READY:{const{workerName:h,version:p,workerId:S,backend:C}=u;this.on.faceTrackersReady&&this.on.faceTrackersReady(h,p,S,C);break}case $.LANDMARKS:{this.faceTrackerFpsTracker.tick(),d.isBusy=!1,this.warmingUp&&this.warmupIndex++;const{face:h,annotations:p,frameTimestamp:S}=u;this.on.landmarksAvailable&&this.on.landmarksAvailable(h,p,S);break}case $.DESTROY:{const{workerId:h}=u;this.workers[h].ft.destroy();break}}}})}getMediaElement(){return this.mediaElement}setIsExtracting(e){this.isExtracting=e}destroyWorkers(){setTimeout(async()=>{this.videoCallbackId&&this.videoElement.cancelVideoFrameCallback(this.videoCallbackId),this.workers.forEach(e=>e.ft.worker.postMessage({action:$.DESTROY}))},200)}createMediaElements(){this.videoElement.addEventListener("ended",async()=>{this.destroyWorkers()});const e=document.createElement("div"),i=this.settings.displayMediaStream?this.videoElement:e,a="white";this.mediaElement.appendChild(i),i.style.width="100%",i.style.height="100%",i.style.boxSizing="border-box",this.settings.displayMediaStream&&(i.style.border=`1px solid ${a}`),i.style.objectFit=this.settings.objectFit,i.style.transform=`scale(${this.mirrorVideo?"-1":"1"},1)`,this.settings.displayMediaStream||(i.style.height=`${this.frameHeight}px`,i.style.width=`${this.frameWidth}px`),new ResizeObserver(d=>{const{contentRect:n,target:r}=d[0],{width:u,height:h}=n,{x:p,y:S}=r.getBoundingClientRect(),{faceTrackerWidth:C,faceTrackerHeight:k}=this.settings;this.videoElementSize=si(this.settings.objectFit,[u,h,this.frameWidth,this.frameHeight]);const{width:O,height:P}=this.videoElementSize;if(!this.settings.displayMediaStream){const G=this.settings.objectFit===ke.NONE;i.style.height=`${Math.trunc(G?P:h)}px`,i.style.width=`${Math.trunc(G?O:u)}px`}this.mediaElement.dispatchEvent(new CustomEvent("mediaElementSizeChanged",{detail:{mediaElementSize:{width:u,height:h,x:p,y:S},videoElementSize:this.videoElementSize,frameInfo:{mediaStreamWidth:this.frameWidth,mediaStreamHeight:this.frameHeight,faceTrackerWidth:C,faceTrackerHeight:k},isPortrait:h>u,aspectRatio:u/h}}))}).observe(this.mediaElement)}log(e,i,a){this.isLoggingSdk&&dt(this,ce).info(e,i),this.metrics&&dt(this,ce).log(e,i,"",!0,a)}videoFrameCallback(e,i){const{presentedFrames:a,captureTime:c,expectedDisplayTime:d,mediaTime:n}=i;this.videoFpsTracker.tick();const r=c===void 0?d:c;this.numOfFramesPresented=a;const u=`Number of frames presented: ${this.numOfFramesPresented} - time: ${r}`;let h=0;if(n&&n>0?h=n*1e3:c&&c>0?h=c>1e6?c-performance.timeOrigin:c:h=e,this.log(u,m.sdk,{captureTime:r,presentedFrames:a}),this.warmingUp)if(this.warmupIndex>=this.numOfWorkers)this.warmingUp=!1;else{const p=this.workers[this.warmupIndex];if(!p.isBusy){p.isBusy=!0;const S=new VideoFrame(this.videoElement,{timestamp:h});p.ft.worker.postMessage({action:"TRACK",payload:{frame:S,frameTimestamp:h,frameNumber:this.numOfFramesPresented}},[S])}}if(!this.warmingUp){const p=new VideoFrame(this.videoElement,{timestamp:h});let S=!1;for(let C=0;C<this.numOfWorkers;C++){this.ftWorkerIndex=(this.ftWorkerIndex+1)%this.numOfWorkers;const k=this.workers[this.ftWorkerIndex];if(k&&!k.isBusy){k.isBusy=!0,this.on.frameAvailable(h,this.numOfFramesPresented,this.lastFrameNumber,!0),k.ft.worker.postMessage({action:"TRACK",payload:{frame:p,frameTimestamp:h,frameNumber:this.numOfFramesPresented}},[p]),S=!0;break}}S||this.on.frameAvailable(h,this.numOfFramesPresented,this.lastFrameNumber,!1,p)}this.lastFrameNumber=this.numOfFramesPresented,this.videoCallbackId=this.videoElement.requestVideoFrameCallback(this.videoFrameCallback)}setFaceTrackerMediaStreamResolution(e,i){(e<=360||i<=360)&&(this.scaleFactor=1),this.settings.faceTrackerWidth=e*this.scaleFactor,this.settings.faceTrackerHeight=i*this.scaleFactor,this.workers.forEach(a=>a.ft.worker.postMessage({action:$.SCALE_FACTOR_CHANGED,payload:{scaleFactor:this.scaleFactor}})),this.on.scaleFactorChanged&&this.on.scaleFactorChanged(this.scaleFactor)}async setMediaStream(e){if(e instanceof MediaStream)try{const{settings:i,constraints:a}=await Ei(this,Ge,mt).call(this,e,this.videoElement);await this.videoElement.play(),this.settings.displayMediaStream||(this.videoElement.style.visibility="none");const{width:c,height:d}=i;return this.setFaceTrackerMediaStreamResolution(c??0,d??0),this.frameWidth=c||1,this.frameHeight=d||1,this.log(`Face tracker resolution: ${c} x ${d} pixels. Video resolution: ${this.frameWidth} x ${this.frameHeight} pixels`,m.sdk,{ftWidth:c,ftHeight:d,frameWidth:this.frameWidth,frameHeight:this.frameHeight}),this.createMediaElements(),this.videoCallbackId=this.videoElement.requestVideoFrameCallback(this.videoFrameCallback),!0}catch(i){return console.log("Error applying face tracker video track constraints",i),!1}return!1}stopTracking(){this.videoCallbackId&&this.videoElement.cancelVideoFrameCallback(this.videoCallbackId),this.videoElement.pause(),this.videoElement.srcObject=null}};ce=new WeakMap,Ge=new WeakSet,mt=async function(t,e){e.srcObject=t,await new Promise(a=>e.onloadedmetadata=a);const[i]=t.getVideoTracks();return{constraints:i.getConstraints(),settings:i.getSettings()}};let Ti=pi;var T=(t=>(t.INIT="INIT",t.READY="READY",t.SET_MODE="SET_MODE",t.SET_NUMBER_OF_CHUNKS="SET_NUMBER_OF_CHUNKS",t.SET_TARGET_FPS="SET_TARGET_FPS",t.SET_CHUNK_DURATION_SECONDS="SET_CHUNK_DURATION_SECONDS",t.SET_FRAME_ORDER="SET_FRAME_ORDER",t.GET_CONSTRAINTS_CONFIG="GET_CONSTRAINTS_CONFIG",t.SET_CONSTRAINTS_CONFIG="SET_CONSTRAINTS_CONFIG",t.SET_FACE_ATTRIBUTE="SET_FACE_ATTRIBUTE",t.RESET_COLLECTION="RESET_COLLECTION",t.CANCEL_COLLECTION="CANCEL_COLLECTION",t.START_COLLECTION="START_COLLECTION",t.SET_PORTS="SET_PORTS",t.COLLECTOR_ERROR="COLLECTOR_ERROR",t.STAR_RATING="STAR_RATING",t.ALL_FACE_TRACKERS_WARMED_UP="ALL_FACE_TRACKERS_WARMED_UP",t.CONSTRAINTS_UPDATED="CONSTRAINTS_UPDATED",t.SHOULD_END_MEASUREMENT_EARLY="SHOULD_END_MEASUREMENT_EARLY",t.GET_LOGS="GET_LOGS",t.NEW_FRAME="NEW_FRAME",t.TRACKING_STATUS="TRACKING_STATUS",t.SCALE_FACTOR_CHANGED="SCALE_FACTOR_CHANGED",t))(T||{}),y=(t=>(t.CONNECT="CONNECT",t.DISCONNECT="DISCONNECT",t.DISCONNECTED="DISCONNECTED",t.LOGIN_WITH_TOKEN_SUCCESS="LOGIN_WITH_TOKEN_SUCCESS",t.SUBSCRIBED_TO_RESULTS="SUBSCRIBED_TO_RESULTS",t.CHUNK_SENT="CHUNK_SENT",t.RESULTS_RECEIVED="RESULTS_RECEIVED",t.CHUNK_ACKNOWLEDGED="CHUNK_ACKNOWLEDGED",t.ERROR="ERROR",t.NETWORK_DELAY="NETWORK_DELAY",t))(y||{}),Si=Object.defineProperty,ut=t=>{throw TypeError(t)},bi=(t,e,i)=>e in t?Si(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ft=(t,e,i)=>bi(t,typeof e!="symbol"?e+"":e,i),He=(t,e,i)=>e.has(t)||ut("Cannot "+i),s=(t,e,i)=>(He(t,e,"read from private field"),i?i.call(t):e.get(t)),b=(t,e,i)=>e.has(t)?ut("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),f=(t,e,i,a)=>(He(t,e,"write to private field"),e.set(t,i),i),l=(t,e,i)=>(He(t,e,"access private method"),i),_i=(t,e,i,a)=>({set _(c){f(t,e,c)},get _(){return s(t,e,a)}}),x,g,M,v,D,ve,Ae,ye,Oe,de,z,Ne,he,me,_,q,I,ue,F,Le,Z,Q,ee,te,fe,Ee,j,pe,De,ie,Ie,se,Te,A,Se,B,be,o,Et,pt,Tt,Ve,Ke,St,bt,_t,gt,wt,Rt,xe,je,E,Ct,kt,vt,At,ae,R;const yt=Symbol("instance_creation_key"),gi=class Nt{constructor(e){if(b(this,o),b(this,x),b(this,g,{mediaElement:document.createElement("div"),assetFolder:"",apiUrl:"",metrics:!1,logger:{sdk:!1,mediaPipe:!1,beforeRESTCall:!1,afterRESTCall:!1,extractionLibWasm:!1,apiClient:!1,extractionWorker:!1,faceTrackerWorkers:!1},mirrorVideo:!0,displayMediaStream:!0,constraintOverrides:{}}),b(this,M,[{file:"decompress.json",uncompressedSize:89469},{file:"extraction_worker_0.1.0-beta.2_js.json",uncompressedSize:59696},{file:"facetracker_worker_0.1.0-beta.2_js.json",uncompressedSize:306553},{file:"extraction_wasm_0.1.0-beta.2.json",uncompressedSize:1926126},{file:"detectorModel_json.json",uncompressedSize:4640},{file:"detectorModel_bin.json",uncompressedSize:242046},{file:"landmarkModel_json.json",uncompressedSize:5036},{file:"landmarkModel_bin.json",uncompressedSize:1704814}]),b(this,v,new ot),b(this,D,Jt.init()),b(this,ve),b(this,Ae),b(this,ye),b(this,Oe),b(this,de),b(this,z),b(this,Ne),b(this,he,{version:"",sdkId:""}),b(this,me,""),b(this,_),b(this,q,0),b(this,I),b(this,ue,K.ASSETS_NOT_DOWNLOADED),b(this,F,""),b(this,Le,""),b(this,Z,!1),b(this,Q,5),b(this,ee,30),b(this,te,5),b(this,fe,!1),b(this,Ee,4),b(this,j),b(this,pe),b(this,De),b(this,ie,1e7),b(this,Ie,0),b(this,se,new Map),b(this,Te,Promise.resolve()),b(this,A,0),b(this,Se,-1),b(this,B,-1),b(this,be,.5),ft(this,"on",{beforeRESTCall:null,afterRESTCall:null,bytesDownloaded:null,faceTrackerStateChanged:null,resultsReceived:null,constraintsUpdated:null,mediaElementResize:null,facialLandmarksUpdated:null,chunkSent:null,error:null}),e!==yt)throw new Error("Use await Measurement.init() to create an instance of Measurement class.")}static async init(e){if(!e)throw new Error("Missing `settings` object");const i=new Nt(yt);if(!i.setSettings(e))throw new Error("Invalid settings object");f(i,x,Gt({url:{http:new URL("https://api.deepaffex.ai")},onBeforeRESTCall:()=>{var n,r;l(n=i,o,bt).call(n),l(r=i,o,_t).call(r)},onAfterRESTCall:(n,r)=>{var u,h;l(u=i,o,gt).call(u,n,r),l(h=i,o,wt).call(h,n,r)}}));const c=n=>{var r;const{bytes:u,url:h,uncompressedSize:p,done:S}=n.detail;l(r=i,o,E).call(r,`bytesDownloaded event, ${u}, ${p}, ${h}, ${S}`,m.mediaPipe),i.on.bytesDownloaded&&i.on.bytesDownloaded(u,p,h,S)},d=n=>{var r;const{error:u,url:h}=n.detail;l(r=i,o,E).call(r,`downloadError event, ${h}, ${u}`,m.mediaPipe),i.on.error&&i.on.error(Ce.ASSET_DOWNLOAD,{url:h,error:u})};return s(i,D).addEventListener("downloadedError",d),s(i,D).addEventListener("bytesDownloaded",c),s(i,v).setVersion(i.getVersion()),s(i,g).logger&&Object.values(s(i,g).logger).some(n=>n===!0)&&s(i,v).start(),setTimeout(()=>{var n;l(n=i,o,ae).call(n,K.ASSETS_NOT_DOWNLOADED)},500),new Proxy(i,{get(n,r,u){const h=r;return typeof n[h]=="function"?n[h].bind(n):Reflect.get(n,h,u)},set(n,r,u){return console.log(`Setting property "${String(r)}" to "${u}" is not allowed`),!0}})}loadMask(e){if(s(this,_)){let i=!1;const a=s(this,_).mediaElement.querySelector("svg");a&&(i=!0,s(this,_).mediaElement.removeChild(a)),s(this,_).mediaElement.appendChild(e),i&&(s(this,_).mediaElement.style.setProperty("border","1px solid transparent"),setTimeout(()=>{s(this,_).mediaElement.removeAttribute("style")},100))}}setSettings(e){const i=ri(s(this,g),e);return i.results==="valid"?(f(this,g,i.settings),!0):!1}getVersion(){return{webSDK:Xe,extractionLib:s(this,he),faceTracker:s(this,me)}}async downloadAssets(){const{assetFolder:e}=s(this,g);try{if(l(this,o,E).call(this,`Asset base URL ${e}`,m.sdk),l(this,o,E).call(this,"Start downloading decompressor...",m.sdk),await s(this,D).fetchAsset(s(this,M),`${e}/`,"decompress.json",!0,"gzip"),s(this,D).canDecompress){await l(this,o,pt).call(this,e),s(this,z)&&await l(this,o,Ke).call(this),l(this,o,E).call(this,"Start downloading TFJS worker...",m.mediaPipe);const i=await s(this,D).fetchAsset(s(this,M),`${e}/`,`facetracker_worker_${this.getVersion().webSDK}_js.json`,!0,"brotli");return i&&(f(this,Ne,i),await l(this,o,Et).call(this,e),await l(this,o,Ve).call(this)),l(this,o,Tt).call(this),!0}}catch{return l(this,o,E).call(this,"Failed to download TFJS face tracker or DFX extraction worker WASM assets",m.mediaPipe),!1}}setExtractionLibSettings(e=6,i=30,a=5){f(this,Q,e-1),f(this,ee,i),f(this,te,a)}async setNextChunkAsFinal(){f(this,fe,!0),await l(this,o,R).call(this,T.SHOULD_END_MEASUREMENT_EARLY,{},!0),l(this,o,E).call(this,"Set the action for the next chunk to LAST::PROCESS",m.extractionLibWasm)}async startTracking(){s(this,_)&&(s(this,_).isExtracting||(s(this,_).setIsExtracting(!0),l(this,o,E).call(this,"Start tracking frames",m.mediaPipe),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0),await l(this,o,xe).call(this)))}async stopTracking(){if(s(this,_)){s(this,_).stopTracking(),await l(this,o,Rt).call(this),s(this,_).setIsExtracting(!1),l(this,o,E).call(this,"Stop extracting frames",m.mediaPipe);const{numOfFramesPresented:e,warmupFrameNumber:i,numOftrackedVideoFrames:a}=s(this,_);l(this,o,E).call(this,"Tracking metrics",m.sdk,{numOfFramesPresented:e,warmupFrameNumber:i,numOftrackedVideoFrames:a}),f(this,F,"")}}async disconnect(){s(this,Z)&&await l(this,o,R).call(this,y.DISCONNECT,{},!0),s(this,g).metrics&&(await l(this,o,R).call(this,T.GET_LOGS,{},!0),s(this,v).retrieveLogs())}async destroy(){s(this,I)&&(s(this,I).destroy(),l(this,o,E).call(this,"Destroyed",m.extractionLibWasm)),s(this,_)&&(s(this,_).destroyWorkers(),l(this,o,E).call(this,"Destroyed",m.mediaPipe))}async reset(){return s(this,ue)===K.READY?(await this.stopTracking(),await this.destroy(),f(this,v,new ot),f(this,he,{version:"",sdkId:""}),f(this,me,""),f(this,q,0),f(this,F,""),f(this,Z,!1),f(this,Q,5),f(this,ee,30),f(this,te,5),f(this,fe,!1),f(this,j,void 0),f(this,ie,1e7),f(this,Ie,0),f(this,se,new Map),f(this,Te,Promise.resolve()),f(this,A,0),f(this,Se,-1),f(this,B,-1),s(this,g).mediaElement.innerHTML="",await l(this,o,Ke).call(this),await l(this,o,Ve).call(this),!0):!1}async setMediaStream(e){if(s(this,_)&&!s(this,_).isExtracting&&s(this,I)){await s(this,_).setMediaStream(e);const i=Object.fromEntries(s(this,_).workers.map((a,c)=>[`port${c+1}`,a.channel.port1]));s(this,I).worker.postMessage({action:T.SET_PORTS,payload:{numOfWorkers:s(this,Ee),workerPorts:i}},[...s(this,_).workers.map(a=>a.channel.port1)])}}async prepare(e,i,a,c){s(this,x).setSession({userToken:e,userRefreshToken:i});const{region:d,status:n}=await l(this,o,Ct).call(this,"user");let r=`api.${d}.deepaffex.ai`;s(this,g).apiUrl?r=s(this,g).apiUrl:s(this,g).apiUrl=r,s(this,x).setUrl(`https://${r}`);const u=await l(this,o,kt).call(this,e,i,"user"),h=await l(this,o,vt).call(this,a,c);return u&&h&&n==="200"}async setConstraintsConfig(e){await l(this,o,R).call(this,T.SET_CONSTRAINTS_CONFIG,{...s(this,De),...e&&{...s(this,g).constraintOverrides}},!0)}async startMeasurement(e=!1,i={}){if(f(this,fe,!1),f(this,F,""),await l(this,o,At).call(this,i),s(this,I)&&s(this,F)!==""){await l(this,o,je).call(this),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,Q)+1},!0),await this.setConstraintsConfig(e),await l(this,o,St).call(this),await l(this,o,xe).call(this);const{userToken:a}=s(this,x).getSession();a?await l(this,o,R).call(this,y.CONNECT,{token:a,measurementId:s(this,F)},!0):l(this,o,E).call(this,"User token is missing. Unable to connect.",m.webSocket)}}setDemographics(e){ni(e)?(f(this,j,e),l(this,o,E).call(this,`Demographics updated ${JSON.stringify(e)}`,m.extractionLibWasm)):l(this,o,E).call(this,`Error updating Demographics ${JSON.stringify(e)}`,m.extractionLibWasm)}setObjectFit(e){return s(this,_)&&ke!==void 0&&Object.values(ke).includes(e)?(s(this,_).settings.objectFit=e,!0):!1}};x=new WeakMap,g=new WeakMap,M=new WeakMap,v=new WeakMap,D=new WeakMap,ve=new WeakMap,Ae=new WeakMap,ye=new WeakMap,Oe=new WeakMap,de=new WeakMap,z=new WeakMap,Ne=new WeakMap,he=new WeakMap,me=new WeakMap,_=new WeakMap,q=new WeakMap,I=new WeakMap,ue=new WeakMap,F=new WeakMap,Le=new WeakMap,Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,fe=new WeakMap,Ee=new WeakMap,j=new WeakMap,pe=new WeakMap,De=new WeakMap,ie=new WeakMap,Ie=new WeakMap,se=new WeakMap,Te=new WeakMap,A=new WeakMap,Se=new WeakMap,B=new WeakMap,be=new WeakMap,o=new WeakSet,Et=async function(t){l(this,o,E).call(this,"Start downloading TFJS face tracker assets...",m.mediaPipe);const e=`${t}/models/`,[i,a,c,d]=await Promise.all([s(this,D).fetchAsset(s(this,M),e,"detectorModel_json.json",!0,"brotli"),s(this,D).fetchAsset(s(this,M),e,"detectorModel_bin.json",!0,"brotli"),s(this,D).fetchAsset(s(this,M),e,"landmarkModel_json.json",!0,"brotli"),s(this,D).fetchAsset(s(this,M),e,"landmarkModel_bin.json",!0,"brotli")]);l(this,o,E).call(this,"TFJS face tracker assets successfully downloaded",m.mediaPipe),f(this,ve,i),f(this,Ae,a),f(this,ye,c),f(this,Oe,d)},pt=async function(t){l(this,o,E).call(this,"Start downloading DFX extraction worker assets...",m.extractionLibWasm);const[e,i]=await Promise.all([s(this,D).fetchAsset(s(this,M),`${t}/extraction/`,`extraction_wasm_${this.getVersion().webSDK}.json`,!0,"brotli"),s(this,D).fetchAsset(s(this,M),`${t}/`,`extraction_worker_${this.getVersion().webSDK}_js.json`,!0,"brotli")]);l(this,o,E).call(this,"DFX extraction worker assets successfully downloaded",m.extractionLibWasm),f(this,de,e),f(this,z,i)},Tt=function(){if(s(this,_)){const t=e=>{this.on.mediaElementResize&&this.on.mediaElementResize(e)};s(this,g).mediaElement.addEventListener("mediaElementSizeChanged",t)}},Ve=async function(){s(this,g),l(this,o,ae).call(this,K.NOT_LOADED);const t={faceTrackerCode:s(this,Ne),numOfWorkers:s(this,Ee),mediaElement:s(this,g).mediaElement,mirrorVideo:s(this,g).mirrorVideo,metrics:s(this,g).metrics,displayMediaStream:s(this,g).displayMediaStream,isLoggingFaceTrackerWorkers:s(this,g).logger?.faceTrackerWorkers??!1,isLoggingSdk:s(this,g).logger?.sdk??!1,scaleFactor:s(this,be),models:{detectorJson:s(this,ve),detectorBin:s(this,Ae),landmarkJson:s(this,ye),landmarkBin:s(this,Oe)}};l(this,o,ae).call(this,K.LOADING),f(this,_,await Ti.init(t,s(this,v))),s(this,_).on.faceTrackersReady=(e,i,a,c)=>{l(this,o,E).call(this,`TFJS face tracker version ${i} loaded. Worker name: ${e} - workerId: ${a} - backend: ${c}`,m.mediaPipe),f(this,me,`${i}-${c}`),f(this,q,s(this,q)+1),s(this,v).setVersion(this.getVersion()),s(this,q)===s(this,Ee)&&l(this,o,ae).call(this,K.LOADED)},s(this,_).on.frameAvailable=(e,i,a,c,d)=>{!c&&d?s(this,I).worker.postMessage({action:T.NEW_FRAME,payload:{frameNumber:i,frameTimestamp:e,frame:d,lastFrameNumber:a,tracked:c}},[d]):s(this,I).worker.postMessage({action:T.TRACKING_STATUS,payload:{frameNumber:i,frameTimestamp:e,lastFrameNumber:a,tracked:c}})},s(this,_).on.landmarksAvailable=(e,i,a)=>{const c=a/1e3;s(this,B)===0&&f(this,B,c),f(this,Se,c),s(this,_).numOftrackedVideoFrames+=1;const{starRating:d}=s(this,_),n=30,r=Math.min(s(this,Se)-s(this,B),n),u=s(this,B)>0?r/n*100:0,h={video:s(this,_).videoFpsTracker.fps.toFixed(1),faceTracker:s(this,_).faceTrackerFpsTracker.fps.toFixed(1)},p={face:e,annotations:i,starRating:d,percentCompleted:u,fps:h};this.on.facialLandmarksUpdated&&this.on.facialLandmarksUpdated(p)},s(this,_).on.scaleFactorChanged=e=>{f(this,be,e),s(this,_).scaleFactor=e,s(this,I).worker.postMessage({action:T.SCALE_FACTOR_CHANGED,payload:{scaleFactor:e}})}},Ke=async function(){const t=new TextDecoder().decode(new Uint8Array(s(this,z)));f(this,I,Fe.init(t,"module","EXTRACTION_WORKER"));const{studyCfgData:e}=s(this,x).getSession();e&&s(this,de)&&s(this,z)&&(s(this,I).worker.onmessage=async i=>{const{data:a}=i,{id:c,result:d}=a,{action:n,payload:r}=d,u=s(this,se).get(c);if(u||c===-1){switch(n){case T.READY:{const{sdkId:h,version:p,workerName:S}=r;f(this,he,{version:p,sdkId:h}),l(this,o,E).call(this,`DFX extraction worker WASM loaded. SDK ID: ${h} - Version: ${p} - Worker Name: ${S}`,m.extractionLibWasm),await l(this,o,R).call(this,T.SET_MODE,{value:"discrete"},!0),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0),await l(this,o,R).call(this,T.SET_TARGET_FPS,{value:s(this,ee)},!0),await l(this,o,R).call(this,T.SET_CHUNK_DURATION_SECONDS,{value:s(this,te)},!0),await l(this,o,R).call(this,T.SET_FRAME_ORDER,{value:lt.RGBA},!0),await l(this,o,R).call(this,T.GET_CONSTRAINTS_CONFIG,{},!0),f(this,De,s(this,pe));break}case T.SET_MODE:{r&&l(this,o,E).call(this,`Set mode to ${r.mode}`,m.extractionLibWasm);break}case T.SET_NUMBER_OF_CHUNKS:{r&&l(this,o,E).call(this,`Set number of chunks to ${d.number}`,m.extractionLibWasm);break}case T.SET_TARGET_FPS:{r&&l(this,o,E).call(this,`Set target FPS to ${s(this,ee)}`,m.extractionLibWasm);break}case T.SET_CHUNK_DURATION_SECONDS:{r&&l(this,o,E).call(this,`Set chunk duration to ${s(this,te)} Seconds`,m.extractionLibWasm);break}case T.SET_FRAME_ORDER:{r&&l(this,o,E).call(this,"Set channel order RGBA",m.extractionLibWasm);break}case T.GET_CONSTRAINTS_CONFIG:{r&&(f(this,pe,r),l(this,o,E).call(this,`Get constraints ${JSON.stringify(r)}`,m.extractionLibWasm));break}case T.SET_CONSTRAINTS_CONFIG:{r&&(f(this,pe,r),l(this,o,E).call(this,`Set constraints ${JSON.stringify(r)}`,m.extractionLibWasm));break}case T.SET_FACE_ATTRIBUTE:{const{success:h,faceId:p,attribute:S,value:C}=r;h&&l(this,o,E).call(this,`Set face attribute: faceId: ${p}, attribute: ${S}, value: ${C}`,m.extractionLibWasm);break}case T.RESET_COLLECTION:{r&&l(this,o,E).call(this,"Reset collection",m.extractionLibWasm);break}case T.CANCEL_COLLECTION:{r&&l(this,o,E).call(this,"Collecttion cancelled",m.extractionLibWasm);break}case T.START_COLLECTION:{r&&l(this,o,E).call(this,`Collector started - state: ${r}`,m.extractionLibWasm);break}case T.SET_PORTS:{r&&l(this,o,E).call(this,"Ports set",m.extractionLibWasm);break}case T.COLLECTOR_ERROR:{if(r){const{error:h,frameNumber:p}=r;l(this,o,E).call(this,`Collector error on frame ${p}: ${h}`,m.extractionLibWasm),this.on.error&&this.on.error(Ce.COLLECTOR,r),await this.stopTracking()}break}case T.STAR_RATING:{s(this,_).starRating=r.rating;break}case T.ALL_FACE_TRACKERS_WARMED_UP:{const{frameNumber:h}=d;s(this,_).warmupFrameNumber=h,l(this,o,E).call(this,"All face tracker workers are warmed up.",m.mediaPipe),l(this,o,ae).call(this,K.READY);break}case T.CONSTRAINTS_UPDATED:{const{feedback:h,status:p}=r;this.on.constraintsUpdated&&this.on.constraintsUpdated(h,p);break}case T.SHOULD_END_MEASUREMENT_EARLY:{const{currentFinalChunkNumber:h,currentResultsOrder:p,newFinalChunkNumber:S}=d;l(this,o,E).call(this,`Request the end measurement early. Current final chunk number: ${h}, Current results order: ${p}, New final chunk number: ${S}`,m.extractionLibWasm);break}case T.GET_LOGS:{console.log(`DFX Log: ${r}`);break}case y.CONNECT:{f(this,Z,!0),f(this,B,0),l(this,o,E).call(this,r?"Connected":"Connection error",m.webSocket);break}case y.LOGIN_WITH_TOKEN_SUCCESS:{l(this,o,E).call(this,"Successfully logged in with token",m.webSocket);break}case y.SUBSCRIBED_TO_RESULTS:{l(this,o,E).call(this,"Subscribed to the results",m.webSocket);break}case y.CHUNK_SENT:{l(this,o,E).call(this,`Chunk sent ${JSON.stringify(r)}`,m.webSocket),this.on.chunkSent&&this.on.chunkSent(r);break}case y.DISCONNECT:{f(this,Z,!1),l(this,o,E).call(this,"Disconnect",m.webSocket);break}case y.DISCONNECTED:{l(this,o,E).call(this,`Disconnected! - code: ${r.code}, reason: ${r.reason}, wasClean: ${r.wasClean}`,m.webSocket),this.on.error&&this.on.error(Ce.WEB_SOCKET,r);break}case y.CHUNK_ACKNOWLEDGED:{l(this,o,E).call(this,`Chunk number ${r.chunkOrder} received by the server!`,m.webSocket),s(this,Q)===r.chunkOrder&&await this.stopTracking();break}case y.RESULTS_RECEIVED:{const{resultsOrder:h,finalChunkNumber:p}=r;this.on.resultsReceived&&this.on.resultsReceived(r),l(this,o,E).call(this,`Results received: ${JSON.stringify(r)}`,m.webSocket),h===p&&(await l(this,o,R).call(this,y.DISCONNECT,{},!0),await l(this,o,je).call(this),await l(this,o,xe).call(this));break}case y.NETWORK_DELAY:{const{delay:h,description:p,actionId:S}=r;l(this,o,E).call(this,`Round-trip delay for ${p} call with Action ID ${S} was ${h.toFixed(2)} ms`,m.webSocket,{delay:h,actionId:S,description:p});break}case y.ERROR:{l(this,o,E).call(this,"Error",m.webSocket),this.on.error&&this.on.error(Ce.WEB_SOCKET,r);break}}u&&(u.resolve(d),s(this,se).delete(c))}},await l(this,o,R).call(this,T.INIT,{wasm:s(this,de),studyConfigData:e,isLogging:s(this,g).logger?.extractionWorker||!1,metrics:s(this,g).metrics||!1,apiUrl:s(this,g).apiUrl,scaleFactor:s(this,be)},!0))},St=async function(){if(s(this,_)&&s(this,j)){const{age:e,height:i,weight:a,sex:c,smoking:d,bloodPressureMedication:n,diabetes:r}=s(this,j);await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.SEX_ASSIGNED_AT_BIRTH,value:c},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.AGE_YEARS,value:e},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.HEIGHT_CM,value:i},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.WEIGHT_KG,value:a},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.SMOKER,value:d},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.BLOOD_PRESSURE_MEDICATION,value:n},!0),await l(this,o,R).call(this,T.SET_FACE_ATTRIBUTE,{faceId:"1",attribute:V.DIABETES,value:r},!0),l(this,o,E).call(this,`Set demographics for Face ID 1, ${JSON.stringify(s(this,j))}`,m.extractionLibWasm)}},bt=function(){},_t=function(){const t=new Date().toISOString();at(t)&&(l(this,o,E).call(this,`Action ID: ${s(this,A)}`,m.beforeRESTCall),this.on.beforeRESTCall&&this.on.beforeRESTCall(t,s(this,A)))},gt=function(t,e){},wt=function(t,e){const i=new Date().toISOString();at(i)&&(l(this,o,E).call(this,`Action ID: ${s(this,A)}, HTTP status code: ${t}, error: ${JSON.stringify(e)}`,m.afterRESTCall),this.on.afterRESTCall&&this.on.afterRESTCall(i,s(this,A),t,e))},Rt=async function(){await l(this,o,R).call(this,T.CANCEL_COLLECTION,{},!0)},xe=async function(){await l(this,o,R).call(this,T.START_COLLECTION,{},!0)},je=async function(){await l(this,o,R).call(this,T.RESET_COLLECTION,{},!0),await l(this,o,R).call(this,T.SET_NUMBER_OF_CHUNKS,{value:s(this,ie)},!0)},E=function(t,e,i){s(this,g).metrics&&s(this,v).log(t,e,"",!0,i),s(this,g).logger?.mediaPipe&&e===m.mediaPipe&&s(this,v).info(t,e),s(this,g).logger?.beforeRESTCall&&e===m.beforeRESTCall&&s(this,v).info(t,e),s(this,g).logger?.afterRESTCall&&e===m.afterRESTCall&&s(this,v).info(t,e),s(this,g).logger?.extractionLibWasm&&e===m.extractionLibWasm&&s(this,v).info(t,e),s(this,g).logger?.apiClient&&e===m.apiClient&&s(this,v).info(t,e),s(this,g).logger?.webSocket&&e===m.webSocket&&s(this,v).info(t,e),s(this,g).logger?.sdk&&e===m.sdk&&s(this,v).info(t,e)},Ct=async function(t){f(this,A,0);const e=performance.now(),i=await s(this,x).http.auths.validate(t),a=performance.now()-e,{status:c,body:d}=i;if(l(this,o,E).call(this,c==="200"?"Successfully validated the Token":`Failed to validate token. Status: ${c}`,m.apiClient,{delay:a,actionId:s(this,A),description:"Validate Token"}),c==="200"){const{Region:n}=d;return{region:n,status:c}}else return{status:c,region:""}},kt=async function(t,e,i){f(this,A,2304);const a=performance.now(),c=await s(this,x).http.auths.renew({Token:t,RefreshToken:e},i),d=performance.now()-a,{status:n}=c;return l(this,o,E).call(this,n==="200"?"Successfully refreshed the Token":`Failed to refresh token. Status: ${n}`,m.apiClient,{delay:d,actionId:s(this,A),description:"Refresh Token"}),n==="200"},vt=async function(t,e){f(this,A,806);const i=performance.now();f(this,Le,t);const a=await s(this,x).http.studies.retrieveSdkConfigData({StudyID:t,...e&&{sdkId:e}},"user"),c=performance.now()-i,{status:d}=a;return l(this,o,E).call(this,d==="200"?"Retrieve SDK Config Data - success":"Retrieve SDK Config Data - failure",m.apiClient,{delay:c,actionId:s(this,A),description:"Retrieve SDK Config Data"}),d==="200"},At=async function(t){l(this,o,E).call(this,"Get Measurement ID",m.apiClient),f(this,A,504);const e=performance.now(),i={StudyID:s(this,Le),Resolution:100};t.partnerId&&(i.PartnerID=t.partnerId),t.userProfileId&&(i.UserProfileID=t.userProfileId);const a=await s(this,x).http.measurements.create(i,"user"),c=performance.now()-e,{status:d,body:n}=a;let r="";d==="200"?(f(this,F,n.ID),r=`Successfully obtained measurement ID: ${s(this,F)}`):(f(this,F,""),r=`Failed to obtain measurement ID. Status: ${d}`),l(this,o,E).call(this,r,m.apiClient,{delay:c,actionId:s(this,A),measurementId:s(this,F),description:"Get Measurement ID"})},ae=function(t){f(this,ue,t),l(this,o,E).call(this,`Face tracker state changed: ${t}`,m.mediaPipe),this.on.faceTrackerStateChanged&&this.on.faceTrackerStateChanged(s(this,ue))},R=function(t,e,i=!1){return new Promise(a=>{const c=_i(this,Ie)._++;s(this,se).set(c,{resolve:a,action:t});const d=()=>s(this,I).worker.postMessage({id:c,action:t,payload:e});i?f(this,Te,s(this,Te).then(d).catch(n=>console.error(n))):d()})},ft(gi,"VERSION",Xe);class wi{static VERSION=Lt;#e=document.createElement("div");#i=document.createElement("div");#s=!1;on={results:null,error:null,event:null};constructor(){this.#e.style.height="100%"}async init(e){const{container:i,appPath:a,settings:c,profile:d,config:n,language:r,apiUrl:u}=e;return this.#i=i,new Promise((h,p)=>{const S=i.attachShadow({mode:"open"}),C="app",k=document.createElement("link");k.rel="stylesheet",k.href=`${a}/stylex.css`,S.appendChild(k);const O=document.createElement("link");O.rel="stylesheet",O.href=`${a}/${C}.css`,S.appendChild(O);const P=W=>{this.on.results&&this.on.results({...W.detail})},G=W=>{this.on.error&&this.on.error({...W.detail})},re=W=>{this.on.event&&this.on.event({...W.detail})};this.#e.addEventListener(U.RESULTS,P),this.#e.addEventListener(U.ERROR,G),this.#e.addEventListener(U.APPEVENT,re),S.appendChild(this.#e);const Y=document.createElement("script");Y.type="module",Y.src=`${a}/${C}.mjs`,Y.onload=()=>{import(Y.src).then(W=>{W.app.init(this.#e,a,c,d,u,n,r),this.#s=!0,h()}).catch(W=>{p(new Error("Failed to initialize Measurement Embedded React app: "+W.message))})},Y.onerror=()=>{p(new Error("Failed to load the measurement embedded app script"))},S.appendChild(Y)})}#t(){if(!this.#s)throw new Error("MeasurementEmbeddedApp is not initialized. Call init() before using this method.")}async destroy(){return this.#t(),new Promise(e=>{const i=c=>{if(this.#e.removeEventListener(U.DESTROYED,i),this.#i){const d=this.#i.cloneNode(!1);this.#i.replaceWith(d)}e()};this.#e.addEventListener(U.DESTROYED,i);const a=new CustomEvent("measurement-embedded-app-action",{detail:{action:ne.DESTROY,data:{}}});this.#e.dispatchEvent(a)})}setTheme(e){this.#t();const i=new CustomEvent("measurement-embedded-app-action",{detail:{action:ne.SET_THEME,data:{theme:e}}});this.#e.dispatchEvent(i)}setLanguage(e){this.#t();const i=new CustomEvent("measurement-embedded-app-action",{detail:{action:ne.SET_LANGUAGE,data:{language:e}}});this.#e.dispatchEvent(i)}async cancel(e){return this.#t(),new Promise(i=>{const a=d=>{this.#e.removeEventListener(U.CANCELLED,a),i(d.detail.reset)};this.#e.addEventListener(U.CANCELLED,a);const c=new CustomEvent("measurement-embedded-app-action",{detail:{action:ne.CANCEL,data:{reset:e}}});this.#e.dispatchEvent(c)})}getLogs(){return this.#t(),new Promise(e=>{const i=c=>{this.#e.removeEventListener(U.LOGS,i),e(c.detail.logs)};this.#e.addEventListener(U.LOGS,i);const a=new CustomEvent("measurement-embedded-app-action",{detail:{action:ne.GET_LOGS,data:{}}});this.#e.dispatchEvent(a)})}}export{Je as ErrorCodes,Dt as appEvents,wi as default,hi as faceAttributeValue,Ye as logCategory};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuralogix.ai/web-measurement-embedded-app",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.4",
4
4
  "description": "Web Measurement Embedded App",
5
5
  "homepage": "https://docs.deepaffex.ai/wmea/",
6
6
  "contributors": [