@voltom.io/sdk 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/assets/locales/ar.json +34 -2
  2. package/dist/assets/locales/ch.json +34 -2
  3. package/dist/assets/locales/de.json +34 -2
  4. package/dist/assets/locales/en.json +34 -2
  5. package/dist/assets/locales/es.json +34 -2
  6. package/dist/assets/locales/fr.json +34 -2
  7. package/dist/assets/locales/it.json +34 -2
  8. package/dist/assets/locales/ja.json +34 -2
  9. package/dist/assets/locales/pt.json +34 -2
  10. package/dist/assets/locales/ru.json +34 -2
  11. package/dist/assets/locales/zh.json +34 -2
  12. package/dist/sdk/PoseSilhouette-D2pGu7Lh.js +2 -0
  13. package/dist/sdk/PoseSuccess-R_8JYo--.js +2 -0
  14. package/dist/sdk/errors.d.ts +121 -0
  15. package/dist/sdk/facegate/global.d.ts +1 -1
  16. package/dist/sdk/facegate.d.ts +42 -19
  17. package/dist/sdk/facegate.dist.js +4 -4
  18. package/dist/sdk/facegate.js +1 -1
  19. package/dist/sdk/facekey.browser-VlDa2K-w.js +2 -0
  20. package/dist/sdk/facekey.d.ts +50 -26
  21. package/dist/sdk/facekey.dist.js +6 -6
  22. package/dist/sdk/facekey.js +1 -1
  23. package/dist/sdk/presentation-COhoAxj3.js +8 -0
  24. package/dist/sdk/presentation-ye0KVm6U.js +2 -0
  25. package/dist/sdk/requests-DW8zDX51.js +65 -0
  26. package/dist/sdk/verify.d.ts +58 -22
  27. package/dist/sdk/verify.dist.js +18 -18
  28. package/dist/sdk/verify.js +1 -1
  29. package/dist/sdk/view-CF_YOVly.js +3 -0
  30. package/dist/sdk/view-Cb4XCb-z.js +3 -0
  31. package/dist/sdk/view-DcbwHph_.js +2 -0
  32. package/package.json +7 -5
  33. package/dist/sdk/PoseSilhouette-Bbwmry4Z.js +0 -2
  34. package/dist/sdk/PoseSuccess-C3aBF88E.js +0 -2
  35. package/dist/sdk/eyeLevelCamera-DY4onSBz.js +0 -65
  36. package/dist/sdk/facekey.browser-CVJiBw1f.js +0 -2
  37. package/dist/sdk/media-BRKPXpu3.js +0 -2
  38. package/dist/sdk/presentation-B-TOKUZ3.js +0 -8
  39. package/dist/sdk/presentation-BsnbDv0i.js +0 -2
  40. package/dist/sdk/view-Bfg8u_hZ.js +0 -2
  41. package/dist/sdk/view-CHSkN6gO.js +0 -3
  42. package/dist/sdk/view-DmGKdc3M.js +0 -3
@@ -1,7 +1,7 @@
1
1
  /*! Copyright (c) 2026 VOLTOM. All rights reserved. Proprietary software. See LICENSE at https://voltom.io/license. */
2
- (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){e&&e.parentNode&&e.remove()}function i(e,t,n){var r,i,o,s={},c=arguments.length;for(o in t)o==`key`?r=t[o]:o==`ref`&&typeof e!=`function`?i=t[o]:s[o]=t[o];return c>2&&(s.children=c>3?ve.call(arguments,2):n),a(e,s,r,i,null)}function a(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:pe,__v:i||++re,__i:-1,__u:0};return!i&&E.vnode&&E.vnode(a),a}function o(){return{current:null}}function s(e){return e.children}function c(e,t){this.props=e,this.context=t,this.__g=0}function l(e,t){if(t==null)return e.__&&l(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:l(e)}function u(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),u(e)}function d(e){(8&e.__g||(e.__g|=8,ae.push(e),se++))&&oe==E.debounceRendering||((oe=E.debounceRendering)||queueMicrotask)(f)}function f(){var e,t,n,r,i,a,o,s,c;try{for(t=1;ae.length;)ae.length>t&&ae.sort(ce),e=ae.shift(),t=ae.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=ye({constructor:pe},i)).__v=i.__v+1,E.vnode&&E.vnode(r),b(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||l(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,C(o,r,s),i.__=i.__e=null,r.__e!=a&&u(r)))}finally{(se=ae.length)&&(oe||queueMicrotask)(f)}}function p(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y=r.__k||he,x=t.length;for(c=m(n,t,y,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||me,p.__i=d,v=b(e,p,f,i,a,o,s,c,l,u),g=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&T(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||g,p)),_||=g,4&p.__u?(c=h(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-21);return n.__e=_,c}function m(e,t,n,r,i){var o,c,u,d,f,p,m,h,_,v=n.length,y=v,b=0,x=0,S=e.__k=Array(i);for(o=0;o<i;o++)(c=t[o])!=null&&typeof c!=`boolean`&&typeof c!=`function`?(typeof c!=`object`||c.constructor===String?c=S[o]=a(null,c):_e(c)?c=S[o]=a(s,{children:c}):c.constructor===pe&&c.__b?c=S[o]=a(c.type,c.props,c.key,c.ref,c.__v):S[o]=c,d=o+b,c.__=e,c.__b=e.__b+1,u=null,~(f=c.__i=g(c,n,d,y))&&(y--,(u=n[f])&&(u.__u|=2)),u&&u.__v?(c.__u|=16,f==d-1?b--:f==d+1?b++:f!=d&&(f>d?b--:b++,x=1)):(~f||(i>v?b--:i<v&&b++),typeof c.type!=`function`&&(c.__u|=4))):S[o]=null;if(x){for(p=[],m=[],o=0;o<i;o++)if((c=S[o])&&16&c.__u){for(b=0,h=p.length;b<h;)p[_=b+h>>1]<c.__i?b=_+1:h=_;p[b]=c.__i,m[o]=b+1}for(b=p.length;o--;)m[o]&&(m[o]==b?b--:S[o].__u|=4)}if(y)for(o=0;o<v;o++)!(u=n[o])||2&u.__u||(u.__e==r&&(r=l(u)),ee(u,u));return r}function h(e,t,n,r){var i,a,o,s;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=h(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=l(e))&&!t.parentNode&&(t=null),o=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(o!=s&&(!r&&n.moveBefore&&o.parentNode?n.moveBefore(o,t):n.insertBefore(o,t||null)),t=o;(t&&=t.nextSibling)&&t.nodeType==8&&!t.data.startsWith(`$s`););return t}function g(e,t,n,r){var i,a=e.key,o=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&o==s.type)return n;if(r>+!!c){for(i=n-1;i>=0;i--)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i;for(i=n+1;i<t.length;i++)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i}return-1}function _(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function v(e,t,n,r,i){var a,o;if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||_(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||_(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=fe[t]||(fe[t]=y(t)),(e.__a||={})[t]=de,a=t!=(t=t.replace(ue,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;return}catch{}if(typeof n==`function`)return;n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n)}}function y(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[le]==null)t[le]=de++;else if(t[le]<this.__a[e])return;return n(E.event?E.event(t):t)}}}function b(e,t,n,i,a,o,u,d,f,m){var h,g,_,v,y,b,C,T,ne,re,ie,ae,oe,se,ce,le,ue,de,fe=t.type;if(t.constructor!==pe)return null;128&n.__u&&(f=32&n.__u,h=n.__c.__z)&&(t.__u|=f,g=o=[],h.nodeType==8?d=x(h,o):o.push(h),d=o[0]||d),(h=E.__b)&&h(t);n:if(typeof fe==`function`){_=u.length;try{if(T=t.props,ne=(h=fe.prototype)&&h.render,re=(h=fe.contextType)&&i[h.__c],ie=h?re?re.props.value:h.__:i,(v=n.__c)?(t.__c=v,2&v.__g&&(v.__g|=1)):(ne?t.__c=v=new fe(T,ie):(t.__c=v=new c(T,ie),v.constructor=fe,v.render=te),re&&re.sub(v),v.state||(v.state={}),v.__n=i,v.__g|=8,v.__h=[],v.__k=[]),ne&&(v.__s||(v.__s=v.state),fe.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=ye({},v.__s)),ye(v.__s,fe.getDerivedStateFromProps(T,v.__s)))),y=v.props,b=v.state,v.__v=t,n.__c){if(T!==y&&ne&&!fe.getDerivedStateFromProps&&v.componentWillReceiveProps&&v.componentWillReceiveProps(T,ie),t.__v==n.__v&&!(8&v.__g)||!(4&v.__g)&&v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(T,v.__s,ie)){t.__v!=n.__v&&(v.props=T,v.state=v.__s,v.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),he.push.apply(v.__h,v.__k),v.__k=[],v.__h.length&&u.push(v),d=l(n);break n}v.componentWillUpdate&&v.componentWillUpdate(T,v.__s,ie),ne&&v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(y,b,C)})}else ne&&!fe.getDerivedStateFromProps&&v.componentWillMount&&v.componentWillMount(),ne&&v.componentDidMount&&v.__h.push(v.componentDidMount);if(v.context=ie,v.props=T,v.__P=e,v.__g&=-5,ae=E.__r,oe=0,ne)v.state=v.__s,v.__g&=-9,ae&&ae(t),h=v.render(v.props,v.state,v.context),he.push.apply(v.__h,v.__k),v.__k=[];else do v.__g&=-9,ae&&ae(t),h=v.render(v.props,v.state,v.context),v.state=v.__s;while(8&v.__g&&++oe<25);v.state=v.__s,v.getChildContext&&(i=ye({},i,v.getChildContext())),ne&&n.__c&&v.getSnapshotBeforeUpdate&&(C=v.getSnapshotBeforeUpdate(y,b)),se=h&&h.type===s&&h.key==null?h.props.children:h,T.__P&&(h=d,a=(e=T.__P).namespaceURI,f=o=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&ee(e,e)}),n.__k=null),d=n.__k?l(n,0):null),d=p(e,_e(se)?se:[se],t,n,i,a,o,u,d,f,m),T.__P&&(t.__e=null,d=h),t.__u&=-161,g&&g.some(r),v.__h.length&&u.push(v),1&v.__g&&(v.__g&=-4)}catch(e){if(u.length=_,t.__v=null,f||o){if(e.then){if(ce=0,t.__u|=128|f,o){for(~(ue=o.indexOf(d||void 0))||(ue=o.length);(de=o[ue-1])&&de.nodeType==8;)ue--;for(;ue<o.length;ue++)if(de=o[ue]){if(o[ue]=null,de.nodeType==8){if(de.data.startsWith(`$s`))ce++||(le=de);else if(ce&&de.data.startsWith(`/$s`)&&!--ce)break}else if(!ce)break}}if(!le){for(;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;le=d}(h=x(le=t.__c.__z||(t.__c.__z=le)))?(t.__e=le,d=h):t.__e=d,d&&=d.nextSibling}else o&&o.some(r)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||S(t),E.__e(e,t,n)}}else d=t.__e=w(n.__e,t,n,i,a,o,u,f,m,e);return(h=E.diffed)&&h(t),d}function x(e,t){if(e&&e.nodeType==8&&e.data.startsWith(`$s`))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith(`$s`))n++;else if(e.data.startsWith(`/$s`)&&!--n)return e}t&&t.push(e)}}function S(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(S))}function C(e,t,n){for(var r=0;r<n.length;)T(n[r++],n[r++],n[r++]);E.__c&&E.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){E.__e(e,t.__v)}})}function w(e,t,n,i,a,o,s,c,u,d){var f,m,h,g,_,y,b,x,S,C=n.props||me,w=t.props,T=t.type;if(T==`svg`?a=`http://www.w3.org/2000/svg`:T==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(f=0;f<o.length;f++)if((_=o[f])&&(T?_.localName==T:_.nodeType==3)){e=_,o[f]=null;break}}if(!e){if(x=d.ownerDocument||document,!T)return x.createTextNode(w);e=x.createElementNS(a,T,w.is&&w),c&&=(E.__m&&E.__m(t,o),!1),o=null}if(T){if(d=T==`template`&&e.content||e,o=T==`textarea`&&w.defaultValue!=null?null:o&&ve.call(d.childNodes),!c&&o)for(C={},f=0;f<e.attributes.length;f++)C[(_=e.attributes[f]).name]=_.value;for(f in C)_=C[f],f==`dangerouslySetInnerHTML`?h=_:f==`children`||f in w||f==`value`&&`defaultValue`in w||f==`checked`&&`defaultChecked`in w||v(e,f,null,_,a);for(f in S=1&n.__u,w)_=w[f],f==`children`?g=_:f==`dangerouslySetInnerHTML`?m=_:f==`value`?y=_:f==`checked`?b=_:c&&typeof _!=`function`||!(C[f]!==_||S&&_!=null)||v(e,f,_,C[f],a);m?(c||h&&(m.__html==h.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[]):(h&&(e.textContent=``),(T==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&ge.test(T))&&(a=`http://www.w3.org/1999/xhtml`),p(d,_e(g)?g:[g],t,n,i,a,o,s,o?o[0]:n.__k&&l(n,0),c,u),o&&o.some(r)),c&&T!=`textarea`||(f=`value`,T==`progress`&&y==null?e.removeAttribute(f):y==null||y===e[f]&&(T!=`progress`||y)||v(e,f,y,C[f],a),f=`checked`,b!=null&&b!=e[f]&&v(e,f,b,C[f],a))}else C===w||c&&e.data==w||(e.data=w);return e}function T(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){E.__e(e,n)}}function ee(e,t,n){var i,a,o,s;if(E.unmount&&E.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||T(i,null,t,e),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){E.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&ee(i[s],t,typeof e.type!=`function`||n&&!e.props.__P);!n&&(i=e.__c)&&(i=i.__z)&&(a=x(i,o=[]))&&(i==e.__e&&o.some(r),r(a),r(i)),(i=e.__e)&&(n||r(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function te(e,t,n){return this.constructor(e,n)}function ne(e,t){var n,r,i,o;E.__&&E.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=a(s,{children:[e]}),i=[],o=[],b(t,t.__k,r||me,me,t.namespaceURI,r?null:t.firstChild?ve.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,o),C(i,t.__k,o),t.__k.props.children=null}var E,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be=t((()=>{pe=Symbol.for(`pv`),me={},he=[],ge=/^m(i|n|o|s|text|space)$/,_e=Array.isArray,ve=he.slice,ye=Object.assign,E={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((o=(a=i.constructor)&&a.getDerivedStateFromError)&&i.setState(a.getDerivedStateFromError(e)),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=1),o&&8&i.__g)return void(i.__g|=2)}catch(t){e=t}}throw se=0,e}},re=0,ie=function(e){return e!=null&&e.constructor===pe},c.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=ye({},this.state)),typeof e==`function`&&(e=e(ye({},n),this.props)),e&&(ye(n,e),this.__v&&(t&&this.__k.push(t),d(this)))},c.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),d(this))},c.prototype.render=s,ae=[],se=0,ce=function(e,t){return e.__v.__b-t.__v.__b},le=Symbol(),ue=/(PointerCapture)$|Capture$/i,de=0,fe={}}));function xe(e,t){D.__h&&D.__h(je,e,Fe||t),Fe=0;var n=je.__H||(je.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Se(e,t){var n=xe(Ae++,4);!D.__s&&ke(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,je.__h.push(n))}function Ce(e,t){var n=xe(Ae++,7);return ke(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function we(){var e;do{for(;e=Le.shift();)try{De(e)}catch(t){D.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Ie.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(De),t.__h.some(Oe),t.__h=[]}catch(n){t.__h=[],D.__e(n,e.__v)}}}while(Le.length)}function Te(e){var t,n=function(){clearTimeout(r),We&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);We&&(t=requestAnimationFrame(n))}function Ee(e){e!=1&&Ne==D.requestAnimationFrame||((Ne=D.requestAnimationFrame)||Te)(we)}function De(e){var t=je,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),je=t}function Oe(e){var t=je;e.__c=e.__(),je=t}function ke(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Pe(t,e[n])})}var Ae,je,Me,Ne,Pe,Fe,Ie,Le,D,Re,ze,Be,Ve,He,Ue,We,Ge=t((()=>{be(),Pe=Object.is,Fe=0,Ie=[],Le=[],D=E,Re=D.__b,ze=D.__r,Be=D.diffed,Ve=D.__c,He=D.unmount,Ue=D.__,D.__b=function(e){je=null,Re&&Re(e)},D.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ue&&Ue(e,t)},D.__r=function(e){ze&&ze(e),Ae=0;var t=(je=e.__c).__H;t&&(Me==je?je.__h=[]:(t.__h.some(De),t.__h.some(Oe),Ae=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Me=je},D.diffed=function(e){Be&&Be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ee(Ie.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Me=je=null},D.__c=function(e,t){t.some(function(e){try{e.__h.some(De),e.__h=e.__h.filter(function(e){return!e.__||Oe(e)})}catch(t){e.__h=[function(){throw t}]}}),Ve&&Ve(e,t)},D.unmount=function(e){He&&He(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,Ee(Le.push(r))}else De(r)}catch(e){t=e}}),r.__H=void 0,t&&D.__e(t,r.__v))},We=typeof requestAnimationFrame==`function`}));Ge();var Ke=Symbol.for(`preact-signals`);function qe(){if(Qe>1)Qe--;else{var e,t=!1;for((function(){var e=nt;for(nt=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Ze!==void 0;){var n=Ze;for(Ze=void 0,$e++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ot(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if($e=0,Qe--,t)throw e}}function Je(e){if(Qe>0)return e();tt=++et,Qe++;try{return e()}finally{qe()}}var Ye,O=void 0;function Xe(e){var t=O,n=Ye;O=void 0,Ye=void 0;try{return e()}finally{O=t,Ye=n}}var Ze=void 0,Qe=0,$e=0,et=0,tt=0,nt=void 0,rt=0;function it(e){if(O!==void 0){var t=e.n;if(t===void 0||t.t!==O)return t={i:0,S:e,p:O.s,n:void 0,t:O,e:void 0,x:void 0,r:t},O.s!==void 0&&(O.s.n=t),O.s=t,e.n=t,32&O.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=O.s,t.n=void 0,O.s.n=t,O.s=t),t}}function k(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}k.prototype.brand=Ke,k.prototype.h=function(){return!0},k.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Xe(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},k.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Xe(function(){var e;(e=t.Z)==null||e.call(t)}))}},k.prototype.subscribe=function(e){var t=this;return ht(function(){var n=t.value;Xe(function(){return e(n)})},{name:`sub`})},k.prototype.valueOf=function(){return this.value},k.prototype.toString=function(){return this.value+``},k.prototype.toJSON=function(){return this.value},k.prototype.peek=function(){var e=this;return Xe(function(){return e.value})},Object.defineProperty(k.prototype,"value",{get:function(){var e=it(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if($e>100)throw Error(`Cycle detected`);(function(e){Qe!==0&&$e===0&&e.l!==tt&&(e.l=tt,nt={S:e,v:e.v,i:e.i,o:nt})})(this),this.v=e,this.i++,rt++,Qe++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{qe()}}}});function at(e,t){return new k(e,t)}function ot(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function st(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ct(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function lt(e,t){k.call(this,void 0,t),this.x=e,this.s=void 0,this.g=rt-1,this.f=4}lt.prototype=new k,lt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===rt))return!0;if(this.g=rt,this.f|=1,this.i>0&&!ot(this))return this.f&=-2,!0;var e=O;try{st(this),O=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return O=e,ct(this),this.f&=-2,!0},lt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}k.prototype.S.call(this,e)},lt.prototype.U=function(e){if(this.t!==void 0&&(k.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},lt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(lt.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=it(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ut(e,t){return new lt(e,t)}function dt(e){var t=e.j;if(e.j=void 0,typeof t==`function`){Qe++;var n=O;O=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,ft(e),t}finally{O=n,qe()}}}function ft(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,dt(e)}function pt(e){if(O!==this)throw Error(`Out-of-order effect`);ct(this),O=e,this.f&=-2;try{8&this.f&&ft(this)}finally{qe()}}function mt(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ye&&Ye.push(this)}mt.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.j=t)}finally{e()}},mt.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,dt(this),st(this),Qe++;var e=O;return O=this,pt.bind(this,e)},mt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Ze,Ze=this)},mt.prototype.d=function(){this.f|=8,1&this.f||ft(this)},mt.prototype.dispose=function(){this.d()};function ht(e,t){var n=new mt(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}be();var gt,_t,vt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,yt=[];ht(function(){gt=this.N})();function bt(e,t){E[e]=t.bind(null,E[e]||function(){})}function xt(e){if(_t){var t=_t;_t=void 0,t()}_t=e&&e.S()}function St(e){var t=this,n=e.data,r=wt(n);r.name=`ReactiveDom`,r.value=n;var i=Ce(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var i=ut(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),a=ut(function(){return!Array.isArray(i.value)&&!ie(i.value)}),o=ht(function(){if(this.N=Dt,a.value){var t=i.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=t.__$u.d;return t.__$u.d=function(){o(),s.call(this)},[a,i]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}St.displayName=`ReactiveTextNode`,Object.defineProperties(k.prototype,{constructor:{configurable:!0,value:i(s,null).constructor},type:{configurable:!0,value:St},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),bt(`__b`,function(e,t){if(xt(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof k&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),bt(`__r`,function(e,t){if(e(t),t.type!==s){xt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return ht(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;vt&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),xt(n)}}),bt(`__e`,function(e,t,n,r){xt(),e(t,n,r)}),bt(`diffed`,function(e,t){xt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=Ct(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function Ct(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=at(n);return{o:function(e,t){a.value=e,r=t},d:ht(function(){this.N=Dt;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}bt(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),bt(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),c.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function wt(e,t){return Ce(function(){return at(e,t)},[])}var Tt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Et(){Je(function(){for(var e;e=yt.shift();)gt.call(e)})}function Dt(){yt.push(this)===1&&(E.requestAnimationFrame||Tt)(Et)}function Ot(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function kt(e,t=`|`){return e.map(e=>en(e)).join(t)}function At(e,t){return typeof t==`bigint`?t.toString():t}var jt=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function Mt(e){return new jt(e)}function Nt(e){return e==null}function Pt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ft(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function It(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Lt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Rt(e){return Lt(e._zod.def)??e._zod.def.shape}function zt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return It(this,t,e),e},enumerable:!0,configurable:!0})}function Bt(e,t,n){t in e?It(e,t,n):e[t]=n}function Vt(e,t,n,r){let i=Rt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?zt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Bt(e,a,r?r(n.value,a):n.value))}}function Ht(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?zt(e,n,()=>t[n]):Bt(e,n,r.value))}}function Ut(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Wt(e){return JSON.stringify(e)}function Gt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Kt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function qt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Jt=Mt(()=>{if(Wn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Yt(e){if(qt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return qt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Xt(e){return Yt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Zt=new Set([`string`,`number`,`symbol`]);function Qt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $t(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function en(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function tn(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var nn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},rn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function an(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Vt(i,e,on(e,t)),$t(e,Ut(n,{shape:i,checks:[]}))}function on(e,t){let n=Rt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function sn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(on(e,t)),a={};return Vt(a,e,Reflect.ownKeys(Rt(e)).filter(e=>!i.has(e))),$t(e,Ut(n,{shape:a,checks:[]}))}function cn(e,t){if(!Yt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Rt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return $t(e,Ut(e._zod.def,{shape:ln(e,t)}))}function ln(e,t){let n={};return Vt(n,e,Reflect.ownKeys(Rt(e))),Ht(n,t),n}function un(e,t){if(!Yt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return $t(e,Ut(e._zod.def,{shape:ln(e,t)}))}function dn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Vt(n,e,Reflect.ownKeys(Rt(e))),Vt(n,t,Reflect.ownKeys(Rt(t))),$t(e,Ut(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function fn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(on(t,n)):void 0,o={};return Vt(o,t,Reflect.ownKeys(Rt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),$t(t,Ut(t._zod.def,{shape:o,checks:[]}))}function pn(e,t,n){let r=n?new Set(on(t,n)):void 0,i={};return Vt(i,t,Reflect.ownKeys(Rt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),$t(t,Ut(t._zod.def,{shape:i}))}function mn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function hn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function gn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function _n(e){return typeof e==`string`?e:e?.message}function vn(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function yn(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function bn(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:_n(e.inst?._zod.def?.error?.(e))??_n(a?.(e))??_n(t?.error?.(e))??_n(n.customError?.(e))??_n(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var xn=/[\uD800-\uDBFF]/;function Sn(e){let t=e.length;if(!xn.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Cn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function wn(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Tn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function En(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):An(e,n,r.value)}}function Dn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function On(e,t,n){return Dn(e,t,n,!1)}function kn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Dn(this,n,r(this))},set(e){Dn(this,n,e)}})}return t}function An(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Dn(this,t,n.bind(this))},set(e){Dn(this,t,e)}})}function jn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Mn,Nn=!1,Pn={configurable:!0,get(){Nn=!0}};function j(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Mn!==e._zod?Mn=void 0:(Mn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Pn);let e=Nn;Nn=!1;try{let r=n(this);return Nn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Nn||=e,r}catch(n){throw delete this[t],Nn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function Fn(e,t,n,r){let i=jn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var In=`~constantCatch`;function Ln(e){let t=()=>e;return t[In]=!0,t}var Rn,zn={value:void 0,enumerable:!1},Bn=`captureStackTrace`in Error?Error:null;function Vn(e){let t=Bn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Bn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){zn.value=new a(r);try{Object.defineProperty(n,"_zod",zn)}finally{zn.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),En(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Vn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Hn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Un=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Rn=globalThis).__zod_globalConfig??(Rn.__zod_globalConfig={});var Wn=globalThis.__zod_globalConfig;function Gn(e){return e&&Object.assign(Wn,e),Wn}function Kn(){let e=this._zod;return e.message??=JSON.stringify(e.def,At,2),e.message}function qn(e){this._zod.message=e}var Jn={get:Kn,set:qn,enumerable:!0,configurable:!0},Yn={value:void 0,enumerable:!1},Xn=new WeakSet([Object.prototype,Error.prototype]),Zn=M(`$ZodError`,(e,t)=>{e.name=`$ZodError`,Yn.value=t,Object.defineProperty(e,"issues",Yn),Yn.value=void 0,Object.defineProperty(e,"message",Jn);let n=Object.getPrototypeOf(e);Xn.has(n)||(Xn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))});function Qn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function $n(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Qn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function er(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function tr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var nr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Hn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>bn(e,o,Gn())));throw Kt(n,a?.callee??t),n}return s.value};return t},rr=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>bn(e,o,Gn())));throw Kt(n,a?.callee??t),n}return s.value};return t},ir=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Hn;return a.issues.length?ar(e,a.issues,i):{success:!0,data:a.value}};function ar(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>bn(e,n,Gn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var or=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ar(e,a.issues,i):{success:!0,data:a.value}},sr=Symbol.for(`zod.compile.invalid`),cr=Symbol.for(`zod.compile.fallback`),lr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==sr)return!0;if(r.definite===!0&&n===void 0)return!1}return ur(e,t,n)});function ur(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[cr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Hn;return a.issues.length===0}var dr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},fr=e=>{let t=nr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,tr(n,a))};return n},pr=e=>{let t=nr(e),n=(e,r,i,a)=>t(e,r,i,tr(n,a));return n},mr=e=>{let t=rr(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,tr(n,a))};return n},hr=e=>{let t=rr(e),n=async(e,r,i,a)=>await t(e,r,i,tr(n,a));return n},gr=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ir(e)(t,n,i)},_r=e=>(t,n,r)=>ir(e)(t,n,r),vr=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return or(e)(t,n,i)},yr=e=>async(t,n,r)=>or(e)(t,n,r),br=/^[cC][0-9a-z]{6,}$/,xr=/^[0-9a-z]+$/,Sr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cr=/^[0-9a-vA-V]{20}$/,wr=/^[A-Za-z0-9]{27}$/,Tr=/^[a-zA-Z0-9_-]{21}$/;function Er(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Dr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Or=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,kr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ar=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,jr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Mr(){return new RegExp(jr,`u`)}var Nr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Pr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Fr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ir=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Lr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,zr=/^https?$/,Br=/^\+[1-9]\d{6,14}$/,Vr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Hr(e){return RegExp(`^${e}$`)}var Ur=Hr(Vr);function Wr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Gr(e){return RegExp(`^${Wr(e)}$`)}function Kr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Wr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Wr({precision:e.precision})}`:n;return RegExp(`^${Vr}T(?:${r})$`)}var qr=/^[\s\S]{0,}$/,Jr=/^-?\d+$/,Yr=/^-?\d+(?:\.\d+)?$/,Xr=/^(?:true|false)$/i,Zr=/^[^A-Z]*$/,Qr=/^[^a-z]*$/,N=M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$r=e=>{let t=e.value;return!Nt(t)&&t.length!==void 0},ei={number:`number`,bigint:`bigint`,object:`date`},ti=M(`$ZodCheckLessThan`,(e,t)=>{N.init(e,t);let n=ei[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:ei[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ni=M(`$ZodCheckGreaterThan`,(e,t)=>{N.init(e,t);let n=ei[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:ei[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ri=M(`$ZodCheckMultipleOf`,(e,t)=>{N.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ft(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ii=M(`$ZodCheckNumberFormat`,(e,t)=>{N.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=nn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),ai=M(`$ZodCheckMaxLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=$r),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Sn(r):i)<=t.maximum)return;let a=Cn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),oi=M(`$ZodCheckMinLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=$r),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Sn(r):i)>=t.minimum)return;let a=Cn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),si=M(`$ZodCheckLengthEquals`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=$r),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Sn(r):i;if(a===t.length)return;let o=Cn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ci=M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;N.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),li=M(`$ZodCheckRegex`,(e,t)=>{ci.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ui=M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Zr,ci.init(e,t)}),di=M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Qr,ci.init(e,t)}),fi=M(`$ZodCheckIncludes`,(e,t)=>{N.init(e,t);let n=Qt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),pi=M(`$ZodCheckStartsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`^${Qt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),mi=M(`$ZodCheckEndsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`.*${Qt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),hi=M(`$ZodCheckOverwrite`,(e,t)=>{N.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),gi=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ (function(){var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};function r(e){e&&e.parentNode&&e.remove()}function i(e,t,n){var r,i,o,s={},c=arguments.length;for(o in t)o==`key`?r=t[o]:o==`ref`&&typeof e!=`function`?i=t[o]:s[o]=t[o];return c>2&&(s.children=c>3?ve.call(arguments,2):n),a(e,s,r,i,null)}function a(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:pe,__v:i||++re,__i:-1,__u:0};return!i&&E.vnode&&E.vnode(a),a}function o(){return{current:null}}function s(e){return e.children}function c(e,t){this.props=e,this.context=t,this.__g=0}function l(e,t){if(t==null)return e.__&&l(e.__,e.__i+1);for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:l(e)}function u(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),u(e)}function d(e){(8&e.__g||(e.__g|=8,ae.push(e),se++))&&oe==E.debounceRendering||((oe=E.debounceRendering)||queueMicrotask)(f)}function f(){var e,t,n,r,i,a,o,s,c;try{for(t=1;ae.length;)ae.length>t&&ae.sort(ce),e=ae.shift(),t=ae.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=ye({constructor:pe},i)).__v=i.__v+1,E.vnode&&E.vnode(r),b(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||l(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,C(o,r,s),i.__=i.__e=null,r.__e!=a&&u(r)))}finally{(se=ae.length)&&(oe||queueMicrotask)(f)}}function p(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,g,_,v,y=r.__k||he,x=t.length;for(c=m(n,t,y,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=~p.__i&&y[p.__i]||me,p.__i=d,v=b(e,p,f,i,a,o,s,c,l,u),g=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&T(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||g,p)),_||=g,4&p.__u?(c=h(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&v!==void 0?c=v:g&&(c=g.nextSibling),p.__u&=-21);return n.__e=_,c}function m(e,t,n,r,i){var o,c,u,d,f,p,m,h,_,v=n.length,y=v,b=0,x=0,S=e.__k=Array(i);for(o=0;o<i;o++)(c=t[o])!=null&&typeof c!=`boolean`&&typeof c!=`function`?(typeof c!=`object`||c.constructor===String?c=S[o]=a(null,c):_e(c)?c=S[o]=a(s,{children:c}):c.constructor===pe&&c.__b?c=S[o]=a(c.type,c.props,c.key,c.ref,c.__v):S[o]=c,d=o+b,c.__=e,c.__b=e.__b+1,u=null,~(f=c.__i=g(c,n,d,y))&&(y--,(u=n[f])&&(u.__u|=2)),u&&u.__v?(c.__u|=16,f==d-1?b--:f==d+1?b++:f!=d&&(f>d?b--:b++,x=1)):(~f||(i>v?b--:i<v&&b++),typeof c.type!=`function`&&(c.__u|=4))):S[o]=null;if(x){for(p=[],m=[],o=0;o<i;o++)if((c=S[o])&&16&c.__u){for(b=0,h=p.length;b<h;)p[_=b+h>>1]<c.__i?b=_+1:h=_;p[b]=c.__i,m[o]=b+1}for(b=p.length;o--;)m[o]&&(m[o]==b?b--:S[o].__u|=4)}if(y)for(o=0;o<v;o++)!(u=n[o])||2&u.__u||(u.__e==r&&(r=l(u)),ee(u,u));return r}function h(e,t,n,r){var i,a,o,s;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=h(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=l(e))&&!t.parentNode&&(t=null),o=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(o!=s&&(!r&&n.moveBefore&&o.parentNode?n.moveBefore(o,t):n.insertBefore(o,t||null)),t=o;(t&&=t.nextSibling)&&t.nodeType==8&&!t.data.startsWith(`$s`););return t}function g(e,t,n,r){var i,a=e.key,o=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&o==s.type)return n;if(r>+!!c){for(i=n-1;i>=0;i--)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i;for(i=n+1;i<t.length;i++)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i}return-1}function _(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function v(e,t,n,r,i){var a,o;if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||_(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||_(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=fe[t]||(fe[t]=y(t)),(e.__a||={})[t]=de,a=t!=(t=t.replace(ue,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;return}catch{}if(typeof n==`function`)return;n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n)}}function y(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[le]==null)t[le]=de++;else if(t[le]<this.__a[e])return;return n(E.event?E.event(t):t)}}}function b(e,t,n,i,a,o,u,d,f,m){var h,g,_,v,y,b,C,T,ne,re,ie,ae,oe,se,ce,le,ue,de,fe=t.type;if(t.constructor!==pe)return null;128&n.__u&&(f=32&n.__u,h=n.__c.__z)&&(t.__u|=f,g=o=[],h.nodeType==8?d=x(h,o):o.push(h),d=o[0]||d),(h=E.__b)&&h(t);n:if(typeof fe==`function`){_=u.length;try{if(T=t.props,ne=(h=fe.prototype)&&h.render,re=(h=fe.contextType)&&i[h.__c],ie=h?re?re.props.value:h.__:i,(v=n.__c)?(t.__c=v,2&v.__g&&(v.__g|=1)):(ne?t.__c=v=new fe(T,ie):(t.__c=v=new c(T,ie),v.constructor=fe,v.render=te),re&&re.sub(v),v.state||(v.state={}),v.__n=i,v.__g|=8,v.__h=[],v.__k=[]),ne&&(v.__s||(v.__s=v.state),fe.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=ye({},v.__s)),ye(v.__s,fe.getDerivedStateFromProps(T,v.__s)))),y=v.props,b=v.state,v.__v=t,n.__c){if(T!==y&&ne&&!fe.getDerivedStateFromProps&&v.componentWillReceiveProps&&v.componentWillReceiveProps(T,ie),t.__v==n.__v&&!(8&v.__g)||!(4&v.__g)&&v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(T,v.__s,ie)){t.__v!=n.__v&&(v.props=T,v.state=v.__s,v.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),he.push.apply(v.__h,v.__k),v.__k=[],v.__h.length&&u.push(v),d=l(n);break n}v.componentWillUpdate&&v.componentWillUpdate(T,v.__s,ie),ne&&v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(y,b,C)})}else ne&&!fe.getDerivedStateFromProps&&v.componentWillMount&&v.componentWillMount(),ne&&v.componentDidMount&&v.__h.push(v.componentDidMount);if(v.context=ie,v.props=T,v.__P=e,v.__g&=-5,ae=E.__r,oe=0,ne)v.state=v.__s,v.__g&=-9,ae&&ae(t),h=v.render(v.props,v.state,v.context),he.push.apply(v.__h,v.__k),v.__k=[];else do v.__g&=-9,ae&&ae(t),h=v.render(v.props,v.state,v.context),v.state=v.__s;while(8&v.__g&&++oe<25);v.state=v.__s,v.getChildContext&&(i=ye({},i,v.getChildContext())),ne&&n.__c&&v.getSnapshotBeforeUpdate&&(C=v.getSnapshotBeforeUpdate(y,b)),se=h&&h.type===s&&h.key==null?h.props.children:h,T.__P&&(h=d,a=(e=T.__P).namespaceURI,f=o=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&ee(e,e)}),n.__k=null),d=n.__k?l(n,0):null),d=p(e,_e(se)?se:[se],t,n,i,a,o,u,d,f,m),T.__P&&(t.__e=null,d=h),t.__u&=-161,g&&g.some(r),v.__h.length&&u.push(v),1&v.__g&&(v.__g&=-4)}catch(e){if(u.length=_,t.__v=null,f||o){if(e.then){if(ce=0,t.__u|=128|f,o){for(~(ue=o.indexOf(d||void 0))||(ue=o.length);(de=o[ue-1])&&de.nodeType==8;)ue--;for(;ue<o.length;ue++)if(de=o[ue]){if(o[ue]=null,de.nodeType==8){if(de.data.startsWith(`$s`))ce++||(le=de);else if(ce&&de.data.startsWith(`/$s`)&&!--ce)break}else if(!ce)break}}if(!le){for(;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;le=d}(h=x(le=t.__c.__z||(t.__c.__z=le)))?(t.__e=le,d=h):t.__e=d,d&&=d.nextSibling}else o&&o.some(r)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||S(t),E.__e(e,t,n)}}else d=t.__e=w(n.__e,t,n,i,a,o,u,f,m,e);return(h=E.diffed)&&h(t),d}function x(e,t){if(e&&e.nodeType==8&&e.data.startsWith(`$s`))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith(`$s`))n++;else if(e.data.startsWith(`/$s`)&&!--n)return e}t&&t.push(e)}}function S(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(S))}function C(e,t,n){for(var r=0;r<n.length;)T(n[r++],n[r++],n[r++]);E.__c&&E.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){E.__e(e,t.__v)}})}function w(e,t,n,i,a,o,s,c,u,d){var f,m,h,g,_,y,b,x,S,C=n.props||me,w=t.props,T=t.type;if(T==`svg`?a=`http://www.w3.org/2000/svg`:T==`math`?a=`http://www.w3.org/1998/Math/MathML`:a||=`http://www.w3.org/1999/xhtml`,o){for(f=0;f<o.length;f++)if((_=o[f])&&(T?_.localName==T:_.nodeType==3)){e=_,o[f]=null;break}}if(!e){if(x=d.ownerDocument||document,!T)return x.createTextNode(w);e=x.createElementNS(a,T,w.is&&w),c&&=(E.__m&&E.__m(t,o),!1),o=null}if(T){if(d=T==`template`&&e.content||e,o=T==`textarea`&&w.defaultValue!=null?null:o&&ve.call(d.childNodes),!c&&o)for(C={},f=0;f<e.attributes.length;f++)C[(_=e.attributes[f]).name]=_.value;for(f in C)_=C[f],f==`dangerouslySetInnerHTML`?h=_:f==`children`||f in w||f==`value`&&`defaultValue`in w||f==`checked`&&`defaultChecked`in w||v(e,f,null,_,a);for(f in S=1&n.__u,w)_=w[f],f==`children`?g=_:f==`dangerouslySetInnerHTML`?m=_:f==`value`?y=_:f==`checked`?b=_:c&&typeof _!=`function`||!(C[f]!==_||S&&_!=null)||v(e,f,_,C[f],a);m?(c||h&&(m.__html==h.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[]):(h&&(e.textContent=``),(T==`foreignObject`||a==`http://www.w3.org/1998/Math/MathML`&&ge.test(T))&&(a=`http://www.w3.org/1999/xhtml`),p(d,_e(g)?g:[g],t,n,i,a,o,s,o?o[0]:n.__k&&l(n,0),c,u),o&&o.some(r)),c&&T!=`textarea`||(f=`value`,T==`progress`&&y==null?e.removeAttribute(f):y==null||y===e[f]&&(T!=`progress`||y)||v(e,f,y,C[f],a),f=`checked`,b!=null&&b!=e[f]&&v(e,f,b,C[f],a))}else C===w||c&&e.data==w||(e.data=w);return e}function T(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){E.__e(e,n)}}function ee(e,t,n){var i,a,o,s;if(E.unmount&&E.unmount(e),!(i=e.ref)||i.current&&i.current!=e.__e||T(i,null,t,e),i=e.__c){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){E.__e(e,t)}i.__P=i.__n=null}if(i=e.__k)for(s=0;s<i.length;s++)i[s]&&ee(i[s],t,typeof e.type!=`function`||n&&!e.props.__P);!n&&(i=e.__c)&&(i=i.__z)&&(a=x(i,o=[]))&&(i==e.__e&&o.some(r),r(a),r(i)),(i=e.__e)&&(n||r(i),i.__e&&(i.__e=null)),e.__e=e.__c=e.__=null}function te(e,t,n){return this.constructor(e,n)}function ne(e,t){var n,r,i,o;E.__&&E.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=a(s,{children:[e]}),i=[],o=[],b(t,t.__k,r||me,me,t.namespaceURI,r?null:t.firstChild?ve.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,o),C(i,t.__k,o),t.__k.props.children=null}var E,re,ie,ae,oe,se,ce,le,ue,de,fe,pe,me,he,ge,_e,ve,ye,be=t((()=>{pe=Symbol.for(`pv`),me={},he=[],ge=/^m(i|n|o|s|text|space)$/,_e=Array.isArray,ve=he.slice,ye=Object.assign,E={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((o=(a=i.constructor)&&a.getDerivedStateFromError)&&i.setState(a.getDerivedStateFromError(e)),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=1),o&&8&i.__g)return void(i.__g|=2)}catch(t){e=t}}throw se=0,e}},re=0,ie=function(e){return e!=null&&e.constructor===pe},c.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=ye({},this.state)),typeof e==`function`&&(e=e(ye({},n),this.props)),e&&(ye(n,e),this.__v&&(t&&this.__k.push(t),d(this)))},c.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),d(this))},c.prototype.render=s,ae=[],se=0,ce=function(e,t){return e.__v.__b-t.__v.__b},le=Symbol(),ue=/(PointerCapture)$|Capture$/i,de=0,fe={}}));function xe(e,t){D.__h&&D.__h(Me,e,Ie||t),Ie=0;var n=Me.__H||(Me.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Se(e,t){var n=xe(je++,4);!D.__s&&Ae(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,Me.__h.push(n))}function Ce(e,t){var n=xe(je++,7);return Ae(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function we(){var e=xe(je++,11);if(!e.__){for(var t=Me.__v;!t.__m&&t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__=`P`+n[0]+`-`+n[1]++}return e.__}function Te(){var e;do{for(;e=Re.shift();)try{Oe(e)}catch(t){D.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Le.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Oe),t.__h.some(ke),t.__h=[]}catch(n){t.__h=[],D.__e(n,e.__v)}}}while(Re.length)}function Ee(e){var t,n=function(){clearTimeout(r),Ge&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ge&&(t=requestAnimationFrame(n))}function De(e){e!=1&&Pe==D.requestAnimationFrame||((Pe=D.requestAnimationFrame)||Ee)(Te)}function Oe(e){var t=Me,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Me=t}function ke(e){var t=Me;e.__c=e.__(),Me=t}function Ae(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Fe(t,e[n])})}var je,Me,Ne,Pe,Fe,Ie,Le,Re,D,ze,Be,Ve,He,Ue,We,Ge,Ke=t((()=>{be(),Fe=Object.is,Ie=0,Le=[],Re=[],D=E,ze=D.__b,Be=D.__r,Ve=D.diffed,He=D.__c,Ue=D.unmount,We=D.__,D.__b=function(e){Me=null,ze&&ze(e)},D.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),We&&We(e,t)},D.__r=function(e){Be&&Be(e),je=0;var t=(Me=e.__c).__H;t&&(Ne==Me?Me.__h=[]:(t.__h.some(Oe),t.__h.some(ke),je=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Ne=Me},D.diffed=function(e){Ve&&Ve(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&De(Le.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Ne=Me=null},D.__c=function(e,t){t.some(function(e){try{e.__h.some(Oe),e.__h=e.__h.filter(function(e){return!e.__||ke(e)})}catch(t){e.__h=[function(){throw t}]}}),He&&He(e,t)},D.unmount=function(e){Ue&&Ue(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,De(Re.push(r))}else Oe(r)}catch(e){t=e}}),r.__H=void 0,t&&D.__e(t,r.__v))},Ge=typeof requestAnimationFrame==`function`}));Ke();var qe=Symbol.for(`preact-signals`);function Je(){if($e>1)$e--;else{var e,t=!1;for((function(){var e=rt;for(rt=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();Qe!==void 0;){var n=Qe;for(Qe=void 0,et++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&st(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(et=0,$e--,t)throw e}}function Ye(e){if($e>0)return e();nt=++tt,$e++;try{return e()}finally{Je()}}var Xe,O=void 0;function Ze(e){var t=O,n=Xe;O=void 0,Xe=void 0;try{return e()}finally{O=t,Xe=n}}var Qe=void 0,$e=0,et=0,tt=0,nt=0,rt=void 0,it=0;function at(e){if(O!==void 0){var t=e.n;if(t===void 0||t.t!==O)return t={i:0,S:e,p:O.s,n:void 0,t:O,e:void 0,x:void 0,r:t},O.s!==void 0&&(O.s.n=t),O.s=t,e.n=t,32&O.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=O.s,t.n=void 0,O.s.n=t,O.s=t),t}}function k(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}k.prototype.brand=qe,k.prototype.h=function(){return!0},k.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?Ze(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},k.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&Ze(function(){var e;(e=t.Z)==null||e.call(t)}))}},k.prototype.subscribe=function(e){var t=this;return gt(function(){var n=t.value;Ze(function(){return e(n)})},{name:`sub`})},k.prototype.valueOf=function(){return this.value},k.prototype.toString=function(){return this.value+``},k.prototype.toJSON=function(){return this.value},k.prototype.peek=function(){var e=this;return Ze(function(){return e.value})},Object.defineProperty(k.prototype,"value",{get:function(){var e=at(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(et>100)throw Error(`Cycle detected`);(function(e){$e!==0&&et===0&&e.l!==nt&&(e.l=nt,rt={S:e,v:e.v,i:e.i,o:rt})})(this),this.v=e,this.i++,it++,$e++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Je()}}}});function ot(e,t){return new k(e,t)}function st(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ct(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function lt(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function ut(e,t){k.call(this,void 0,t),this.x=e,this.s=void 0,this.g=it-1,this.f=4}ut.prototype=new k,ut.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===it))return!0;if(this.g=it,this.f|=1,this.i>0&&!st(this))return this.f&=-2,!0;var e=O;try{ct(this),O=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return O=e,lt(this),this.f&=-2,!0},ut.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}k.prototype.S.call(this,e)},ut.prototype.U=function(e){if(this.t!==void 0&&(k.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},ut.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(ut.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=at(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function dt(e,t){return new ut(e,t)}function ft(e){var t=e.j;if(e.j=void 0,typeof t==`function`){$e++;var n=O;O=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,pt(e),t}finally{O=n,Je()}}}function pt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ft(e)}function mt(e){if(O!==this)throw Error(`Out-of-order effect`);lt(this),O=e,this.f&=-2;try{8&this.f&&pt(this)}finally{Je()}}function ht(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Xe&&Xe.push(this)}ht.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.j=t)}finally{e()}},ht.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,ft(this),ct(this),$e++;var e=O;return O=this,mt.bind(this,e)},ht.prototype.N=function(){2&this.f||(this.f|=2,this.u=Qe,Qe=this)},ht.prototype.d=function(){this.f|=8,1&this.f||pt(this)},ht.prototype.dispose=function(){this.d()};function gt(e,t){var n=new ht(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}be();var _t,vt,yt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,bt=[];gt(function(){_t=this.N})();function xt(e,t){E[e]=t.bind(null,E[e]||function(){})}function St(e){if(vt){var t=vt;vt=void 0,t()}vt=e&&e.S()}function Ct(e){var t=this,n=e.data,r=Tt(n);r.name=`ReactiveDom`,r.value=n;var i=Ce(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var i=dt(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),a=dt(function(){return!Array.isArray(i.value)&&!ie(i.value)}),o=gt(function(){if(this.N=Ot,a.value){var t=i.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=t.__$u.d;return t.__$u.d=function(){o(),s.call(this)},[a,i]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Ct.displayName=`ReactiveTextNode`,Object.defineProperties(k.prototype,{constructor:{configurable:!0,value:i(s,null).constructor},type:{configurable:!0,value:Ct},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),xt(`__b`,function(e,t){if(St(),typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof k&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),xt(`__r`,function(e,t){if(e(t),t.type!==s){St();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return gt(function(){n=this},{name:t}),n.c=e,n}(function(e){return function(){var t;yt&&((t=this.y)==null||t.call(this)),e.__$f|=1,e.setState({})}}(r),typeof t.type==`function`?t.type.displayName||t.type.name:``))),St(n)}}),xt(`__e`,function(e,t,n,r){St(),e(t,n,r)}),xt(`diffed`,function(e,t){St();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=wt(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function wt(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=ot(n);return{o:function(e,t){a.value=e,r=t},d:gt(function(){this.N=Ot;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}xt(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){l.__$f|=8;var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),xt(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),c.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Tt(e,t){return Ce(function(){return ot(e,t)},[])}var Et=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Dt(){Ye(function(){for(var e;e=bt.shift();)_t.call(e)})}function Ot(){bt.push(this)===1&&(E.requestAnimationFrame||Et)(Dt)}function kt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function At(e,t=`|`){return e.map(e=>Zt(e)).join(t)}function jt(e,t){return typeof t==`bigint`?t.toString():t}function Mt(e){return new On(e)}function Nt(e){return e==null}function Pt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ft(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function It(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Lt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Rt(e){return Lt(e._zod.def)??e._zod.def.shape}function zt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return It(this,t,e),e},enumerable:!0,configurable:!0})}function Bt(e,t,n){t in e?It(e,t,n):e[t]=n}function Vt(e,t,n,r){let i=Rt(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?zt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Bt(e,a,r?r(n.value,a):n.value))}}function Ht(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?zt(e,n,()=>t[n]):Bt(e,n,r.value))}}function Ut(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Wt(e){return JSON.stringify(e)}function Gt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}function Kt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qt(e){if(Kt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Kt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Jt(e){return qt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Yt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xt(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function A(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Zt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Qt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function $t(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return Vt(i,e,en(e,t)),Xt(e,Ut(n,{shape:i,checks:[]}))}function en(e,t){let n=Rt(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function tn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(en(e,t)),a={};return Vt(a,e,Reflect.ownKeys(Rt(e)).filter(e=>!i.has(e))),Xt(e,Ut(n,{shape:a,checks:[]}))}function nn(e,t){if(!qt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Rt(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Xt(e,Ut(e._zod.def,{shape:rn(e,t)}))}function rn(e,t){let n={};return Vt(n,e,Reflect.ownKeys(Rt(e))),Ht(n,t),n}function an(e,t){if(!qt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Xt(e,Ut(e._zod.def,{shape:rn(e,t)}))}function on(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return Vt(n,e,Reflect.ownKeys(Rt(e))),Vt(n,t,Reflect.ownKeys(Rt(t))),Xt(e,Ut(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function sn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(en(t,n)):void 0,o={};return Vt(o,t,Reflect.ownKeys(Rt(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Xt(t,Ut(t._zod.def,{shape:o,checks:[]}))}function cn(e,t,n){let r=n?new Set(en(t,n)):void 0,i={};return Vt(i,t,Reflect.ownKeys(Rt(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Xt(t,Ut(t._zod.def,{shape:i}))}function ln(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function un(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function dn(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function fn(e){return typeof e==`string`?e:e?.message}function pn(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function mn(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function hn(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:fn(e.inst?._zod.def?.error?.(e))??fn(a?.(e))??fn(t?.error?.(e))??fn(n.customError?.(e))??fn(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}function gn(e){let t=e.length;if(!Pn.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function _n(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function vn(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function yn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function bn(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):wn(e,n,r.value)}}function xn(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Sn(e,t,n){return xn(e,t,n,!1)}function Cn(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xn(this,n,r(this))},set(e){xn(this,n,e)}})}return t}function wn(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xn(this,t,n.bind(this))},set(e){xn(this,t,e)}})}function Tn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}function j(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&Fn!==e._zod?Fn=void 0:(Fn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ln);let e=In;In=!1;try{let r=n(this);return In?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),In||=e,r}catch(n){throw delete this[t],In||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function En(e,t,n,r){let i=Tn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function Dn(e){let t=()=>e;return t[Rn]=!0,t}var On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn=t((()=>{Jn(),On=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}},kn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},An=Mt(()=>{if(qn.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}}),jn=new Set([`string`,`number`,`symbol`]),Mn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Nn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]},Pn=/[\uD800-\uDBFF]/,In=!1,Ln={configurable:!0,get(){In=!0}},Rn=`~constantCatch`}));function Bn(e){let t=Wn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Wn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function M(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Un.value=new a(r);try{Object.defineProperty(n,"_zod",Un)}finally{Un.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),bn(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Bn(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}function Vn(e){return e&&Object.assign(qn,e),qn}var Hn,Un,Wn,Gn,Kn,qn,Jn=t((()=>{zn(),Un={value:void 0,enumerable:!1},Wn=`captureStackTrace`in Error?Error:null,Gn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Kn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},(Hn=globalThis).__zod_globalConfig??(Hn.__zod_globalConfig={}),qn=globalThis.__zod_globalConfig}));function Yn(){let e=this._zod;return e.message??=JSON.stringify(e.def,jt,2),e.message}function Xn(e){this._zod.message=e}function Zn(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Qn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Zn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function $n(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}var er,tr,nr,rr,ir,ar=t((()=>{Jn(),zn(),er={get:Yn,set:Xn,enumerable:!0,configurable:!0},tr={value:void 0,enumerable:!1},nr=new WeakSet([Object.prototype,Error.prototype]),rr=(e,t)=>{e.name=`$ZodError`,tr.value=t,Object.defineProperty(e,"issues",tr),tr.value=void 0,Object.defineProperty(e,"message",er);let n=Object.getPrototypeOf(e);nr.has(n)||(nr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},ir=M(`$ZodError`,rr)}));function or(e,t){return{callee:t?.callee??e,Err:t?.Err}}function sr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>hn(e,n,Vn()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}function cr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[mr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Gn;return a.issues.length===0}var lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr=t((()=>{Jn(),zn(),lr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Gn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>hn(e,o,Vn())));throw kn(n,a?.callee??t),n}return s.value};return t},ur=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>hn(e,o,Vn())));throw kn(n,a?.callee??t),n}return s.value};return t},dr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Gn;return a.issues.length?sr(e,a.issues,i):{success:!0,data:a.value}},fr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?sr(e,a.issues,i):{success:!0,data:a.value}},pr=Symbol.for(`zod.compile.invalid`),mr=Symbol.for(`zod.compile.fallback`),hr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==pr)return!0;if(r.definite===!0&&n===void 0)return!1}return cr(e,t,n)}),gr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},_r=e=>{let t=lr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,or(n,a))};return n},vr=e=>{let t=lr(e),n=(e,r,i,a)=>t(e,r,i,or(n,a));return n},yr=e=>{let t=ur(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,or(n,a))};return n},br=e=>{let t=ur(e),n=async(e,r,i,a)=>await t(e,r,i,or(n,a));return n},xr=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dr(e)(t,n,i)},Sr=e=>(t,n,r)=>dr(e)(t,n,r),Cr=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return fr(e)(t,n,i)},wr=e=>async(t,n,r)=>fr(e)(t,n,r)}));function Er(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function Dr(){return new RegExp(Hr,`u`)}function Or(e){return RegExp(`^${e}$`)}function kr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ar(e){return RegExp(`^${kr(e)}$`)}function jr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${kr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${kr({precision:e.precision})}`:n;return RegExp(`^${Zr}T(?:${r})$`)}var Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai=t((()=>{Mr=/^[cC][0-9a-z]{6,}$/,Nr=/^[0-9a-z]+$/,Pr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Fr=/^[0-9a-vA-V]{20}$/,Ir=/^[A-Za-z0-9]{27}$/,Lr=/^[a-zA-Z0-9_-]{21}$/,Rr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,zr=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Br=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,Ur=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Wr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Gr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Kr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Yr=/^https?$/,Xr=/^\+[1-9]\d{6,14}$/,Zr=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Qr=Or(Zr),$r=/^[\s\S]{0,}$/,ei=/^-?\d+$/,ti=/^-?\d+(?:\.\d+)?$/,ni=/^(?:true|false)$/i,ri=/^[^A-Z]*$/,ii=/^[^a-z]*$/})),N,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci=t((()=>{Jn(),ai(),zn(),N=M(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),oi=e=>{let t=e.value;return!Nt(t)&&t.length!==void 0},si={number:`number`,bigint:`bigint`,object:`date`},ci=M(`$ZodCheckLessThan`,(e,t)=>{N.init(e,t);let n=si[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:si[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),li=M(`$ZodCheckGreaterThan`,(e,t)=>{N.init(e,t);let n=si[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:si[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ui=M(`$ZodCheckMultipleOf`,(e,t)=>{N.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ft(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),di=M(`$ZodCheckNumberFormat`,(e,t)=>{N.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Mn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fi=M(`$ZodCheckMaxLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=oi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?gn(r):i)<=t.maximum)return;let a=_n(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pi=M(`$ZodCheckMinLength`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=oi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?gn(r):i)>=t.minimum)return;let a=_n(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mi=M(`$ZodCheckLengthEquals`,(e,t)=>{var n;N.init(e,t),(n=e._zod.def).when??(n.when=oi),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?gn(r):i;if(a===t.length)return;let o=_n(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hi=M(`$ZodCheckStringFormat`,(e,t)=>{var n,r;N.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gi=M(`$ZodCheckRegex`,(e,t)=>{hi.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_i=M(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ri,hi.init(e,t)}),vi=M(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ii,hi.init(e,t)}),yi=M(`$ZodCheckIncludes`,(e,t)=>{N.init(e,t);let n=Yt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bi=M(`$ZodCheckStartsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`^${Yt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xi=M(`$ZodCheckEndsWith`,(e,t)=>{N.init(e,t);let n=RegExp(`.*${Yt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Si=M(`$ZodCheckOverwrite`,(e,t)=>{N.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}})})),wi,Ti=t((()=>{wi=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
4
- `)}\n};`)(...Object.values(this.closed))}},_i={major:4,minor:6,patch:7},P=M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_i;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=mn(t),a;for(let o of n){if(o._zod.def.when){if(hn(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Hn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(yn(t.issues,n,e),i||=mn(t,n))});else{if(t.issues.length===n)continue;yn(t.issues,n,e),i||=mn(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(mn(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Hn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Hn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return On(this,`~standard`,bi(this))},set"~standard"(e){Dn(this,`~standard`,e)}}),vi=(e,t)=>e.issues.length?{issues:e.issues.map(e=>bn(e,t,Gn()))}:{value:e.value};async function yi(e,t){let n={async:!0};return vi(await e._zod.run({value:t,issues:[]},n),n)}function bi(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return vi(r,n)}catch{}return yi(e,t)},vendor:`zod`,version:1}}var xi=M(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??qr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=M(`$ZodStringFormat`,(e,t)=>{ci.init(e,t),xi.init(e,t)}),Si=M(`$ZodGUID`,(e,t)=>{t.pattern??=Or,F.init(e,t)}),Ci=M(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=kr(e)}else t.pattern??=kr();F.init(e,t)}),wi=M(`$ZodEmail`,(e,t)=>{t.pattern??=Ar,F.init(e,t)});function Ti(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ei(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ti(e)||2:Di(e,t)}function Di(e,t){if(!t.normalize&&t.protocol?.source===zr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Oi=/[\t\n\r]/g;function ki(e){return e.replace(Oi,``)}function Ai(e,t){return t.lastIndex=0,t.test(e.hostname)}function ji(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Mi=M(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ei(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ki(r);return}t.hostname&&!Ai(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ji(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ki(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Ni=M(`$ZodEmoji`,(e,t)=>{t.pattern??=Mr(),F.init(e,t)}),Pi=M(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Tr:Er(t.length),F.init(e,t)}),Fi=M(`$ZodCUID`,(e,t)=>{t.pattern??=br,F.init(e,t)}),Ii=M(`$ZodCUID2`,(e,t)=>{t.pattern??=xr,F.init(e,t)}),Li=M(`$ZodULID`,(e,t)=>{t.pattern??=Sr,F.init(e,t)}),Ri=M(`$ZodXID`,(e,t)=>{t.pattern??=Cr,F.init(e,t)}),zi=M(`$ZodKSUID`,(e,t)=>{t.pattern??=wr,F.init(e,t)}),Bi=M(`$ZodISODateTime`,(e,t)=>{t.pattern??=Kr(t),F.init(e,t)}),Vi=M(`$ZodISODate`,(e,t)=>{t.pattern??=Ur,F.init(e,t)}),Hi=M(`$ZodISOTime`,(e,t)=>{t.pattern??=Gr(t),F.init(e,t)}),Ui=M(`$ZodISODuration`,(e,t)=>{t.pattern??=Dr,F.init(e,t)}),Wi=M(`$ZodIPv4`,(e,t)=>{t.pattern??=Nr,F.init(e,t)}),Gi=/^[0-9a-fA-F:.]+$/;function Ki(e){return Gi.test(e)?Ti(`http://[${e}]`):!1}var qi=M(`$ZodIPv6`,(e,t)=>{t.pattern??=Pr,F.init(e,t),e._zod.check=n=>{Ki(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ji=M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Fr,F.init(e,t)});function Yi(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ki(n)}var Xi=M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ir,F.init(e,t),e._zod.check=n=>{Yi(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Zi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Qi=/^[0-9a-zA-Z+/]*={0,2}$/,$i=M(`$ZodBase64`,(e,t)=>{t.pattern??=Qi,F.init(e,t),e._zod.check=n=>{Zi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ea=/^[A-Za-z0-9_-]*$/;function ta(e){if(!ea.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Zi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var na=M(`$ZodBase64URL`,(e,t)=>{t.pattern??=ea,F.init(e,t),e._zod.check=n=>{ta(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ra=M(`$ZodE164`,(e,t)=>{t.pattern??=Br,F.init(e,t)});function ia(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var aa=M(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{ia(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),oa=M(`$ZodNumber`,(e,t)=>{P.init(e,t),e._zod.pattern=Yr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),sa=M(`$ZodNumberFormat`,(e,t)=>{ii.init(e,t),oa.init(e,t)}),ca=M(`$ZodBoolean`,(e,t)=>{P.init(e,t),e._zod.pattern=Xr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),la=M(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),ua=M(`$ZodNever`,(e,t)=>{P.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function da(e,t){let n=vn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of vn(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,yn(n.issues,t,e),n}}return i(n,a)}}var fa=e=>Array.isArray(e)?e.length:-1;function pa(e,t,n){e.issues.length&&t.issues.push(...gn(n,e.issues)),t.value[n]=e.value}var ma=M(`$ZodArray`,(e,t)=>{P.init(e,t);let n=Wn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>pa(t,r,e)));else if(pa(c,r,e),s&&c.issues.length!==0&&mn(c))break}return o.length?Promise.all(o).then(()=>r):r},da(e,fa)});function ha(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...gn(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var ga=[];function _a(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ga,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=tn(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function va(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(mn(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ha(e,n,i,t,d,f))):ha(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var ya=M(`$ZodObject`,(e,t)=>{P.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Mt(()=>_a(t));j(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||It(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=qt,o=t.catchall,s,c=Wn.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(mn(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>ha(n,t,e,r,a,o))):ha(s,t,e,r,a,o)}return o?va(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),ba=M(`$ZodObjectJIT`,(e,t)=>{ya.init(e,t);let n=e._zod.parse,r=Mt(()=>_a(t)),i=Wn.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new gi([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ `)}\n};`)(...Object.values(this.closed))}}})),Ei,Di=t((()=>{Ei={major:4,minor:6,patch:7}}));async function Oi(e,t){let n={async:!0};return aa(await e._zod.run({value:t,issues:[]},n),n)}function ki(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return aa(r,n)}catch{}return Oi(e,t)},vendor:`zod`,version:1}}function Ai(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ji(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ai(e)||2:Mi(e,t)}function Mi(e,t){if(!t.normalize&&t.protocol?.source===Yr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}function Ni(e){return e.replace(ua,``)}function Pi(e,t){return t.lastIndex=0,t.test(e.hostname)}function Fi(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}function Ii(e){return wa.test(e)?Ai(`http://[${e}]`):!1}function Li(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ii(n)}function Ri(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}function zi(e){if(!Aa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Ri(t.padEnd(Math.ceil(t.length/4)*4,`=`))}function Bi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}function Vi(e,t){let n=pn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of pn(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,mn(n.issues,t,e),n}}return i(n,a)}}function Hi(e,t,n){e.issues.length&&t.issues.push(...dn(n,e.issues)),t.value[n]=e.value}function Ui(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...dn(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}function Wi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Va,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Qt(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Gi(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(ln(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ui(e,n,i,t,d,f))):Ui(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}function Ki(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ln(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>hn(e,r,Vn())))}),t)}function qi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(qt(e)&&qt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=qi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=qi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ji(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=qi(t.value,n.value);if(!c.valid){if(ln(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}function Yi(e,t){for(let n=e.length-1;n>=0;n--)if(!(t===`optin`?e[n]._zod.optin!==void 0:e[n]._zod.optout===`optional`))return n+1;return 0}function Xi(e,t,n){e.issues.length&&t.issues.push(...dn(n,e.issues)),t.value[n]=e.value}function Zi(e,t,n,r,i){for(let a=0;a<n.length;a++){let o=e[a],s=a<r.length;if(!s&&a>=i&&n[a]._zod.optin===`optional`){t.value.length=a;break}if(o.issues.length){if(!s&&a>=i){t.value.length=a;break}t.issues.push(...dn(a,o.issues))}t.value[a]=o.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}function Qi(e,t){return e.value=t.issues.length?void 0:t.value,e}function $i(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ea(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ta(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>hn(e,r,Vn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function na(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}function ra(e){return e.memo||(e.value=Object.freeze(e.value)),e}function ia(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(yn(e))}}var P,aa,oa,F,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,ao,oo,so,co=t((()=>{Ci(),Jn(),Ti(),ai(),zn(),Di(),P=M(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ei;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=ln(t),a;for(let o of n){if(o._zod.def.when){if(un(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Gn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(mn(t.issues,n,e),i||=ln(t,n))});else{if(t.issues.length===n)continue;mn(t.issues,n,e),i||=ln(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(ln(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Gn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Gn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Sn(this,`~standard`,ki(this))},set"~standard"(e){xn(this,`~standard`,e)}}),aa=(e,t)=>e.issues.length?{issues:e.issues.map(e=>hn(e,t,Vn()))}:{value:e.value},oa=M(`$ZodString`,(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??$r,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),F=M(`$ZodStringFormat`,(e,t)=>{hi.init(e,t),oa.init(e,t)}),sa=M(`$ZodGUID`,(e,t)=>{t.pattern??=zr,F.init(e,t)}),ca=M(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Br(e)}else t.pattern??=Br();F.init(e,t)}),la=M(`$ZodEmail`,(e,t)=>{t.pattern??=Vr,F.init(e,t)}),ua=/[\t\n\r]/g,da=M(`$ZodURL`,(e,t)=>{F.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=ji(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ni(r);return}t.hostname&&!Pi(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Fi(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ni(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),fa=M(`$ZodEmoji`,(e,t)=>{t.pattern??=Dr(),F.init(e,t)}),pa=M(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Lr:Er(t.length),F.init(e,t)}),ma=M(`$ZodCUID`,(e,t)=>{t.pattern??=Mr,F.init(e,t)}),ha=M(`$ZodCUID2`,(e,t)=>{t.pattern??=Nr,F.init(e,t)}),ga=M(`$ZodULID`,(e,t)=>{t.pattern??=Pr,F.init(e,t)}),_a=M(`$ZodXID`,(e,t)=>{t.pattern??=Fr,F.init(e,t)}),va=M(`$ZodKSUID`,(e,t)=>{t.pattern??=Ir,F.init(e,t)}),ya=M(`$ZodISODateTime`,(e,t)=>{t.pattern??=jr(t),F.init(e,t)}),ba=M(`$ZodISODate`,(e,t)=>{t.pattern??=Qr,F.init(e,t)}),xa=M(`$ZodISOTime`,(e,t)=>{t.pattern??=Ar(t),F.init(e,t)}),Sa=M(`$ZodISODuration`,(e,t)=>{t.pattern??=Rr,F.init(e,t)}),Ca=M(`$ZodIPv4`,(e,t)=>{t.pattern??=Ur,F.init(e,t)}),wa=/^[0-9a-fA-F:.]+$/,Ta=M(`$ZodIPv6`,(e,t)=>{t.pattern??=Wr,F.init(e,t),e._zod.check=n=>{Ii(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ea=M(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Gr,F.init(e,t)}),Da=M(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Kr,F.init(e,t),e._zod.check=n=>{Li(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}),Oa=/^[0-9a-zA-Z+/]*={0,2}$/,ka=M(`$ZodBase64`,(e,t)=>{t.pattern??=Oa,F.init(e,t),e._zod.check=n=>{Ri(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Aa=/^[A-Za-z0-9_-]*$/,ja=M(`$ZodBase64URL`,(e,t)=>{t.pattern??=Aa,F.init(e,t),e._zod.check=n=>{zi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ma=M(`$ZodE164`,(e,t)=>{t.pattern??=Xr,F.init(e,t)}),Na=M(`$ZodJWT`,(e,t)=>{F.init(e,t),e._zod.check=n=>{Bi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Pa=M(`$ZodNumber`,(e,t)=>{P.init(e,t),e._zod.pattern=ti,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Fa=M(`$ZodNumberFormat`,(e,t)=>{di.init(e,t),Pa.init(e,t)}),Ia=M(`$ZodBoolean`,(e,t)=>{P.init(e,t),e._zod.pattern=ni,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),La=M(`$ZodUnknown`,(e,t)=>{P.init(e,t),e._zod.parse=e=>e}),Ra=M(`$ZodNever`,(e,t)=>{P.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),za=e=>Array.isArray(e)?e.length:-1,Ba=M(`$ZodArray`,(e,t)=>{P.init(e,t);let n=qn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Hi(t,r,e)));else if(Hi(c,r,e),s&&c.issues.length!==0&&ln(c))break}return o.length?Promise.all(o).then(()=>r):r},Vi(e,za)}),Va=[],Ha=M(`$ZodObject`,(e,t)=>{P.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=Mt(()=>Wi(t));j(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||It(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Kt,o=t.catchall,s,c=qn.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(ln(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ui(n,t,e,r,a,o))):Ui(s,t,e,r,a,o)}return o?Gi(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ua=M(`$ZodObjectJIT`,(e,t)=>{Ha.init(e,t);let n=e._zod.parse,r=Mt(()=>Wi(t)),i=qn.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new wi([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
5
5
  let ${e}_ab = false;
6
6
  for (let i = 0; i < ${e}.issues.length; i++) {
7
7
  const iss = ${e}.issues[i];
@@ -51,6 +51,6 @@
51
51
  newResult[${r}] = ${n}.value;
52
52
  }
53
53
 
54
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=qt,c=!Wn.jitless,l=c&&Jt.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?va([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function xa(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!mn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>bn(e,r,Gn())))}),t)}var Sa=M(`$ZodUnion`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),j(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),j(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Pt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>xa(t,r,e,i)):xa(o,r,e,i)}}),Ca=M(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ta(e,t,n)):Ta(e,i,a)}});function wa(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Yt(e)&&Yt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=wa(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=wa(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ta(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=wa(t.value,n.value);if(!c.valid){if(mn(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Ea=M(`$ZodRecord`,(e,t)=>{P.init(e,t);let n=Wn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Yt(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>bn(e,i,Gn())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...gn(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...gn(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Yr.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>bn(e,i,Gn())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...gn(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...gn(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Da=M(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=Ot(t.entries),r=new Set(n);e._zod.values=r,j(e,`pattern`,e=>{let t=Ot(e.def.entries).filter(e=>Zt.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Qt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Oa=M(`$ZodLiteral`,(e,t)=>{P.init(e,t);let n=new Set(t.values);e._zod.values=n,j(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Qt(e):e?Qt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),ka=M(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,Wn.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Un(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Hn;return n.value=i,n}});function Aa(e,t){return e.value=t.issues.length?void 0:t.value,e}var ja=M(`$ZodOptional`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Pt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Aa(e,t)):Aa(e,r)}return t.innerType._zod.run(e,n)}}),Ma=M(`$ZodExactOptional`,(e,t)=>{ja.init(e,t),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Na=M(`$ZodNullable`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Pt(t.source)}|null)$`):void 0}),j(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Pa=M(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Fa(e,t)):Fa(r,t)}});function Fa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ia=M(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),La=M(`$ZodNonOptional`,(e,t)=>{P.init(e,t),j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ra(t,e)):Ra(i,e)}});function Ra(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function za(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>bn(e,r,Gn()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Ba=M(`$ZodCatch`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>za(e,r,t,n)):za(e,r,t,n)}}),Va=M(`$ZodPipe`,(e,t)=>{P.init(e,t),j(e,`values`,e=>e.def.in._zod.values),j(e,`optin`,e=>e.def.in._zod.optin),j(e,`optout`,e=>e.def.out._zod.optout),j(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ha(e,t.in,n)):Ha(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ha(e,t.out,n)):Ha(r,t.out,n)}});function Ha(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ua=M(`$ZodReadonly`,(e,t)=>{P.init(e,t),j(e,`propValues`,e=>e.def.innerType._zod.propValues),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`optin`,e=>e.def.innerType?._zod?.optin),j(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Wa):Wa(r)}});function Wa(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Ga=M(`$ZodCustom`,(e,t)=>{N.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Ka(t,n,r,e));Ka(i,n,r,e)}});function Ka(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Tn(e))}}var qa=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ja=`~memo`,Ya=[];function Xa(e){return typeof e==`object`&&!!e}function Za(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Qa=new WeakMap,$a=0,eo=1,to=2;function no(e,t,n){let r=Qa.get(e);if(r!==void 0)return r?to:$a;if(t.has(e))return to;t.add(e);let i=$a,a=e=>{if(i!==to&&e?._zod){let r=no(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=$a;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?eo:o.value?._zod?no(o.value,t,n):$a;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Lt(c);s(e?o(e,!0):eo),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?no(r,t,!1):eo);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ro(e,i)}function ro(e,t){return t!==eo&&Qa.set(e,t===to),t}function io(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ao,oo=[],so={alloc(e,t,n){let r=ao;if(!r)return n;ao=void 0;let i={value:n,issues:null};return r.set(t.value,i),oo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&lo(n,e.value))throw new qa;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=no(e,new Set,!1);if(i===$a)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===to||r?n=!0:r=!0}let l=s.value;if(!Xa(l))return t(s,c);let u=c[Ja];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ja]=u);let d;i===c?d=a:(d=io(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Za(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;ao=d;let p=oo.length,m=t(s,c);ao=void 0;let h=oo.length>p?oo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Za(e.issues):Ya),e)):(h&&(h.issues=m.issues.length?Za(m.issues):Ya),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function co(){return so}function lo(e,t){let n=e[Ja]?.backEdges;return n!==void 0&&Xa(t)&&n.has(t)}var uo=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(wn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${en(e.values[0])}`:`Invalid option: expected one of ${kt(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${kt(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function fo(){return{localeError:uo()}}var po,mo=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ho(){return new mo}(po=globalThis).__zod_globalRegistry??(po.__zod_globalRegistry=ho());var go=globalThis.__zod_globalRegistry;function _o(e){return e.checks&&=[...e.checks],e}function vo(e,t){return new e(_o({type:`string`,...A(t)}))}function yo(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...A(t)})}function bo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...A(t)})}function xo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...A(t)})}function So(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...A(t)})}function Co(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...A(t)})}function wo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...A(t)})}function To(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...A(t)})}function Eo(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...A(t)})}function Do(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...A(t)})}function Oo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...A(t)})}function ko(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...A(t)})}function Ao(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...A(t)})}function jo(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...A(t)})}function Mo(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...A(t)})}function No(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...A(t)})}function Po(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...A(t)})}function Fo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...A(t)})}function Io(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...A(t)})}function Lo(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...A(t)})}function Ro(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...A(t)})}function zo(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...A(t)})}function Bo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...A(t)})}function Vo(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...A(t)})}function Ho(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...A(t)})}function Uo(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...A(t)})}function Wo(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...A(t)})}function Go(e,t){return new e(_o({type:`number`,checks:[],...A(t)}))}function Ko(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...A(t)})}function qo(e,t){return new e({type:`boolean`,...A(t)})}function Jo(e){return new e({type:`unknown`})}function Yo(e,t){return new e({type:`never`,...A(t)})}function Xo(e,t){return new ti({check:`less_than`,...A(t),value:e,inclusive:!1})}function Zo(e,t){return new ti({check:`less_than`,...A(t),value:e,inclusive:!0})}function Qo(e,t){return new ni({check:`greater_than`,...A(t),value:e,inclusive:!1})}function $o(e,t){return new ni({check:`greater_than`,...A(t),value:e,inclusive:!0})}function es(e,t){return new ri({check:`multiple_of`,...A(t),value:e})}function ts(e,t){return new ai({check:`max_length`,...A(t),maximum:e})}function ns(e,t){return new oi({check:`min_length`,...A(t),minimum:e})}function rs(e,t){return new si({check:`length_equals`,...A(t),length:e})}function is(e,t){return new li({check:`string_format`,format:`regex`,...A(t),pattern:e})}function as(e){return new ui({check:`string_format`,format:`lowercase`,...A(e)})}function os(e){return new di({check:`string_format`,format:`uppercase`,...A(e)})}function ss(e,t){return new fi({check:`string_format`,format:`includes`,...A(t),includes:e})}function cs(e,t){return new pi({check:`string_format`,format:`starts_with`,...A(t),prefix:e})}function ls(e,t){return new mi({check:`string_format`,format:`ends_with`,...A(t),suffix:e})}function us(e){return new hi({check:`overwrite`,tx:e})}function ds(e){return us(t=>t.normalize(e))}function fs(){return us(e=>e.trim())}function ps(){return us(e=>e.toLowerCase())}function ms(){return us(e=>e.toUpperCase())}function hs(){return us(e=>Gt(e))}function gs(e,t,n){return new e({type:`array`,element:t,...A(n)})}function _s(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...A(n)})}function vs(e,t){let n=ys(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Tn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Tn(r))}},e(t.value,t)),t);return n}function ys(e,t){let n=new N({check:`custom`,...A(t)});return n._zod.check=e,n}function bs(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&It(e,t,n[t]);return e}function xs(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??go,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Ss(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&bs(o.schema,c),t.io===`input`&&L(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Cs(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function ws(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Cs(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Cs(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Kt,c=!qn.jitless,l=c&&An.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Gi([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}}),Wa=M(`$ZodUnion`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),j(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),j(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),j(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>Pt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ki(t,r,e,i)):Ki(o,r,e,i)}}),Ga=M(`$ZodIntersection`,(e,t)=>{P.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ji(e,t,n)):Ji(e,i,a)}}),Ka=M(`$ZodTuple`,(e,t)=>{P.init(e,t);let n=t.items,r=qn.memoizer;r?.attach(e),e._zod.parse=(i,a)=>{let o=i.value;if(!Array.isArray(o))return i.issues.push({input:o,inst:e,expected:`tuple`,code:`invalid_type`}),i;i.value=r?r.alloc(e,i,[],a):[];let s=[],c=Yi(n,`optin`),l=Yi(n,`optout`);if(!t.rest){if(o.length<c)return i.issues.push({code:`too_small`,minimum:c,inclusive:!0,input:o,inst:e,origin:`array`}),i;o.length>n.length&&i.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:o,inst:e,origin:`array`})}let u=Array(n.length),d=t.rest?a?.abortEarly:void 0,f=!1;for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:o[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{u[e]=t})):(u[e]=t,d&&!f&&t.issues.length&&(f=ln(t)))}if(t.rest&&!f){let e=n.length-1,r=o.slice(n.length),c=i.issues.length;for(let n of r){if(d&&i.issues.length!==c){if(ln(i,c))break;c=i.issues.length}e++;let r=t.rest._zod.run({value:n,issues:[]},a);r instanceof Promise?s.push(r.then(t=>Xi(t,i,e))):Xi(r,i,e)}}return s.length?Promise.all(s).then(()=>Zi(u,i,n,o,l)):Zi(u,i,n,o,l)}}),qa=M(`$ZodRecord`,(e,t)=>{P.init(e,t);let n=qn.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!qt(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>hn(e,i,Vn())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...dn(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...dn(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&ti.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>hn(e,i,Vn())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...dn(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...dn(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Ja=M(`$ZodEnum`,(e,t)=>{P.init(e,t);let n=kt(t.entries),r=new Set(n);e._zod.values=r,j(e,`pattern`,e=>{let t=kt(e.def.entries).filter(e=>jn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Yt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Ya=M(`$ZodLiteral`,(e,t)=>{P.init(e,t);let n=new Set(t.values);e._zod.values=n,j(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Yt(e):e?Yt(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Xa=M(`$ZodTransform`,(e,t)=>{P.init(e,t),e._zod.optin=`optional`,qn.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Kn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Gn;return n.value=i,n}}),Za=M(`$ZodOptional`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Pt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Qi(e,t)):Qi(e,r)}return t.innerType._zod.run(e,n)}}),Qa=M(`$ZodExactOptional`,(e,t)=>{Za.init(e,t),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),$a=M(`$ZodNullable`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Pt(t.source)}|null)$`):void 0}),j(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),eo=M(`$ZodDefault`,(e,t)=>{P.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>$i(e,t)):$i(r,t)}}),to=M(`$ZodPrefault`,(e,t)=>{P.init(e,t),e._zod.optin=`defaulted`,j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),no=M(`$ZodNonOptional`,(e,t)=>{P.init(e,t),j(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ea(t,e)):ea(i,e)}}),ro=M(`$ZodCatch`,(e,t)=>{P.init(e,t),j(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),j(e,`optout`,e=>e.def.innerType._zod.optout),j(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ta(e,r,t,n)):ta(e,r,t,n)}}),io=M(`$ZodPipe`,(e,t)=>{P.init(e,t),j(e,`values`,e=>e.def.in._zod.values),j(e,`optin`,e=>e.def.in._zod.optin),j(e,`optout`,e=>e.def.out._zod.optout),j(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>na(e,t.in,n)):na(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>na(e,t.out,n)):na(r,t.out,n)}}),ao=M(`$ZodPreprocess`,(e,t)=>{io.init(e,t)}),oo=M(`$ZodReadonly`,(e,t)=>{P.init(e,t),j(e,`propValues`,e=>e.def.innerType._zod.propValues),j(e,`values`,e=>e.def.innerType._zod.values),j(e,`optin`,e=>e.def.innerType?._zod?.optin),j(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ra):ra(r)}}),so=M(`$ZodCustom`,(e,t)=>{N.init(e,t),P.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ia(t,n,r,e));ia(i,n,r,e)}})}));function lo(e){return typeof e==`object`&&!!e}function uo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}function fo(e,t,n){let r=bo.get(e);if(r!==void 0)return r?Co:xo;if(t.has(e))return Co;t.add(e);let i=xo,a=e=>{if(i!==Co&&e?._zod){let r=fo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=xo;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?So:o.value?._zod?fo(o.value,t,n):xo;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Lt(c);s(e?o(e,!0):So),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?fo(r,t,!1):So);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),po(e,i)}function po(e,t){return t!==So&&bo.set(e,t===Co),t}function mo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}function ho(){return Eo}function go(e,t){let n=e[vo]?.backEdges;return n!==void 0&&lo(t)&&n.has(t)}var _o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do=t((()=>{zn(),_o=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},vo=`~memo`,yo=[],bo=new WeakMap,xo=0,So=1,Co=2,To=[],Eo={alloc(e,t,n){let r=wo;if(!r)return n;wo=void 0;let i={value:n,issues:null};return r.set(t.value,i),To.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&go(n,e.value))throw new _o;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=fo(e,new Set,!1);if(i===xo)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Co||r?n=!0:r=!0}let l=s.value;if(!lo(l))return t(s,c);let u=c[vo];u||(u={buckets:new WeakMap,backEdges:void 0},c[vo]=u);let d;i===c?d=a:(d=mo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...uo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;wo=d;let p=To.length,m=t(s,c);wo=void 0;let h=To.length>p?To.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?uo(e.issues):yo),e)):(h&&(h.issues=m.issues.length?uo(m.issues):yo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}}}));function Oo(){return{localeError:ko()}}var ko,Ao=t((()=>{zn(),ko=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(vn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Zt(e.values[0])}`:`Invalid option: expected one of ${At(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${At(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}}}));function jo(){return new No}var Mo,No,Po,Fo=t((()=>{No=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}},(Mo=globalThis).__zod_globalRegistry??(Mo.__zod_globalRegistry=jo()),Po=globalThis.__zod_globalRegistry})),Io=t((()=>{}));function Lo(e){return e.checks&&=[...e.checks],e}function Ro(e,t){return new e(Lo({type:`string`,...A(t)}))}function zo(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...A(t)})}function Bo(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...A(t)})}function Vo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...A(t)})}function Ho(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...A(t)})}function Uo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...A(t)})}function Wo(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...A(t)})}function Go(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...A(t)})}function Ko(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...A(t)})}function qo(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...A(t)})}function Jo(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...A(t)})}function Yo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...A(t)})}function Xo(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...A(t)})}function Zo(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...A(t)})}function Qo(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...A(t)})}function $o(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...A(t)})}function es(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...A(t)})}function ts(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...A(t)})}function ns(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...A(t)})}function rs(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...A(t)})}function is(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...A(t)})}function as(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...A(t)})}function os(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...A(t)})}function ss(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...A(t)})}function cs(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...A(t)})}function ls(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...A(t)})}function us(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...A(t)})}function ds(e,t){return new e(Lo({type:`number`,checks:[],...A(t)}))}function fs(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...A(t)})}function ps(e,t){return new e({type:`boolean`,...A(t)})}function ms(e){return new e({type:`unknown`})}function hs(e,t){return new e({type:`never`,...A(t)})}function gs(e,t){return new ci({check:`less_than`,...A(t),value:e,inclusive:!1})}function _s(e,t){return new ci({check:`less_than`,...A(t),value:e,inclusive:!0})}function vs(e,t){return new li({check:`greater_than`,...A(t),value:e,inclusive:!1})}function ys(e,t){return new li({check:`greater_than`,...A(t),value:e,inclusive:!0})}function bs(e,t){return new ui({check:`multiple_of`,...A(t),value:e})}function xs(e,t){return new fi({check:`max_length`,...A(t),maximum:e})}function Ss(e,t){return new pi({check:`min_length`,...A(t),minimum:e})}function Cs(e,t){return new mi({check:`length_equals`,...A(t),length:e})}function ws(e,t){return new gi({check:`string_format`,format:`regex`,...A(t),pattern:e})}function Ts(e){return new _i({check:`string_format`,format:`lowercase`,...A(e)})}function Es(e){return new vi({check:`string_format`,format:`uppercase`,...A(e)})}function Ds(e,t){return new yi({check:`string_format`,format:`includes`,...A(t),includes:e})}function Os(e,t){return new bi({check:`string_format`,format:`starts_with`,...A(t),prefix:e})}function ks(e,t){return new xi({check:`string_format`,format:`ends_with`,...A(t),suffix:e})}function As(e){return new Si({check:`overwrite`,tx:e})}function js(e){return As(t=>t.normalize(e))}function Ms(){return As(e=>e.trim())}function Ns(){return As(e=>e.toLowerCase())}function Ps(){return As(e=>e.toUpperCase())}function Fs(){return As(e=>Gt(e))}function Is(e,t,n){return new e({type:`array`,element:t,...A(n)})}function Ls(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...A(n)})}function Rs(e,t){let n=zs(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(yn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(yn(r))}},e(t.value,t)),t);return n}function zs(e,t){let n=new N({check:`custom`,...A(t)});return n._zod.check=e,n}var Bs=t((()=>{Ci(),zn()}));function Vs(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&It(e,t,n[t]);return e}function Hs(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Po,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Us(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function I(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Vs(o.schema,c),t.io===`input`&&Zs(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ws(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Gs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ws(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ws(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
55
55
 
56
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ts(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ts(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Es=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ds=[`oneOf`,`anyOf`];function Os(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function ks(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Es.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Os(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}It(n,r,e.length===1?e[0]:ks(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Os(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function As(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Es)if(t in e)return;let n=t.filter(e=>Ds.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=ks(t);else{let e=n[0],i=Ds.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>ks([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,bs(e,r))}function js(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):bs(i,s),bs(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ts(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])As(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}bs(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,It(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ns(t,`input`,e.processors),output:Ns(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function L(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return L(r.element,n);if(r.type===`set`)return L(r.valueType,n);if(r.type===`lazy`)return L(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return L(r.innerType,n);if(r.type===`intersection`)return L(r.left,n)||L(r.right,n);if(r.type===`record`||r.type===`map`)return L(r.keyType,n)||L(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:L(r.in,n)||L(r.out,n);if(r.type===`object`){for(let e in r.shape)if(L(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(L(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(L(e,n))return!0;return!!(r.rest&&L(r.rest,n))}return!1}var Ms=(e,t={})=>n=>{let r=xs({...n,processors:t});return I(e,r),ws(r,e),js(r,e)},Ns=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=xs({...i??{},target:a,io:t,processors:n});return I(e,o),ws(o,e),js(o,e)},Ps=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Fs=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Is=(e,t)=>{Ps(e,`minimum`,t),Fs(e,`maximum`,t)},Ls=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Rs=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},zs=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Bs=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Vs=(e,t)=>Ps(e,`minimum`,t.minimum),Hs=(e,t)=>Fs(e,`maximum`,t.maximum),Us=e=>(t,n)=>{Bs(t,n.format);let[r,i]=e[n.format];Ps(t,`minimum`,r),Fs(t,`maximum`,i)},Ws={greater_than:(e,t)=>Ps(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Fs(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ls(e,t.value),number_format:Us(nn),bigint_format:Us(rn),min_length:Vs,max_length:Hs,length_equals:(e,t)=>Is(e,t.length),min_size:Vs,max_size:Hs,size_equals:(e,t)=>Is(e,t.size),string_format:(e,t)=>{Bs(e,t.format),t.pattern&&Rs(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>zs(e,t.mime)};function Gs(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Ws[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ps(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ps(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Fs(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Fs(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ls(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&zs(t,i.mime);for(let e of i.patterns??[])Rs(t,e);return t}var Ks={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qs=new Map([[Qi,Lr],[ea,Rr]]),Js=e=>qs.get(e)??e,Ys=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Gs(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Ks[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Js);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Xs=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Gs(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Ss(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Zs=(e,t,n,r)=>{n.type=`boolean`},Qs=(e,t,n,r)=>{n.not={}},$s=(e,t,n,r)=>{let i=e._zod.def,a=Ot(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},ec=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Ss(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ss(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},tc=(e,t,n,r)=>{Ss(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},nc=(e,t,n,r)=>{Ss(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},rc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Gs(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})};function ic(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ic(t.out):t.type===`catch`?ic(t.innerType):e._zod.optin}var ac=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ss(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)It(i.properties,e,I(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ic(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},oc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},sc=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function cc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=cc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>cc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Yr:Jr).source)),p}var lc=new WeakMap;function uc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of lc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=cc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var dc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Gs(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=I(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)It(i.patternProperties,Js(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=I(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=lc.get(t);n||(n=[],lc.set(t,n),t.deferred.push(()=>uc(t))),n.push(e)}i.additionalProperties=I(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ic(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},fc=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},pc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},mc=Symbol();function hc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ss(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),mc):JSON.parse(o)}var gc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=hc(i.defaultValue,e,t,n,r);o!==mc&&(n.default=o)},_c=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=hc(i.defaultValue,e,t,n,r);o!==mc&&(n._prefault=o)},vc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ss(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},yc=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I(o,t,r);let s=t.seen.get(e);s.ref=o},bc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},xc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Sc=new WeakSet([Object.prototype,Error.prototype]);function Cc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var wc=M(`ZodError`,(e,t)=>{Zn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Sc.has(n)||(Sc.add(n),Cc(n,`format`,e=>t=>er(e,t)),Cc(n,`flatten`,e=>t=>$n(e,t)),Cc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,At,2)}),Cc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,At,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Tc=nr(wc),Ec=rr(wc),Dc=ir(wc),Oc=or(wc),kc=fr(wc),Ac=pr(wc),jc=mr(wc),Mc=hr(wc),Nc=gr(wc),Pc=_r(wc),Fc=vr(wc),Ic=yr(wc);function Lc(){Wn.localeError||Gn(fo())}function Rc(){Wn.memoizer||Gn({memoizer:co()})}var R=M(`ZodType`,(e,t)=>(Lc(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ut(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return $t(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(eu(e,t))},superRefine(e,t){return this.check(tu(e,t))},overwrite(e){return this.check(us(e))},optional(){return Il(this)},exactOptional(){return Rl(this)},nullable(){return Bl(this)},nullish(){return Il(Bl(this))},nonoptional(e){return Kl(this,e)},array(){return bl(this)},or(e){return Cl([this,e])},and(e){return Tl(this,e)},transform(e){return Xl(this,Pl(e))},default(e){return Hl(this,e)},prefault(e){return Wl(this,e)},catch(e){return Jl(this,e)},pipe(e){return Xl(this,e)},readonly(){return Ql(this)},describe(e){let t=this.clone();return go.add(t,{description:e}),t},meta(...e){if(e.length===0)return go.get(this);let t=this.clone();return go.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return On(this,`~standard`,{...bi(this),jsonSchema:{input:Ns(this,`input`),output:Ns(this,`output`)}})},set"~standard"(e){Dn(this,`~standard`,e)},parse:function e(t,n){return Tc(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ec(this,t,n,{callee:e})},safeParse(e,t){return Dc(this,e,t)},async safeParseAsync(e,t){return Oc(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Dn(this,`spa`,e)},validate(e,t){return lr(this,e,t)},validateAsync(e,t){return dr(this,e,t)},encode:function e(t,n){return kc(this,t,n,{callee:e})},decode:function e(t,n){return Ac(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await jc(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Mc(this,t,n,{callee:e})},safeEncode(e,t){return Nc(this,e,t)},safeDecode(e,t){return Pc(this,e,t)},async safeEncodeAsync(e,t){return Fc(this,e,t)},async safeDecodeAsync(e,t){return Ic(this,e,t)},toJSONSchema(e){return Ms(this,{})(e)},get description(){return go.get(this)?.description},get _def(){return this._zod.def}}),zc=M(`_ZodString`,(e,t)=>{xi.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ys(e,t,n,r)},kn({format:e=>Gs(e).format??null,minLength:e=>Gs(e).minimum??null,maxLength:e=>Gs(e).maximum??null},{regex(...e){return this.check(is(...e))},includes(...e){return this.check(ss(...e))},startsWith(...e){return this.check(cs(...e))},endsWith(...e){return this.check(ls(...e))},min(...e){return this.check(ns(...e))},max(...e){return this.check(ts(...e))},length(...e){return this.check(rs(...e))},nonempty(...e){return this.check(ns(1,...e))},lowercase(e){return this.check(as(e))},uppercase(e){return this.check(os(e))},trim(){return this.check(fs())},normalize(...e){return this.check(ds(...e))},toLowerCase(){return this.check(ps())},toUpperCase(){return this.check(ms())},slugify(){return this.check(hs())}})),Bc=M(`ZodString`,(e,t)=>{xi.init(e,t),zc.init(e,t)},{email(e){return this.check(yo(Gc,e))},url(e){return this.check(To(Jc,e))},jwt(e){return this.check(Bo(ll,e))},emoji(e){return this.check(Eo(Yc,e))},guid(e){return this.check(bo(Kc,e))},uuid(e){return this.check(xo(qc,e))},uuidv4(e){return this.check(So(qc,e))},uuidv6(e){return this.check(Co(qc,e))},uuidv7(e){return this.check(wo(qc,e))},nanoid(e){return this.check(Do(Xc,e))},cuid(e){return this.check(Oo(Zc,e))},cuid2(e){return this.check(ko(Qc,e))},ulid(e){return this.check(Ao($c,e))},base64(e){return this.check(Lo(ol,e))},base64url(e){return this.check(Ro(sl,e))},xid(e){return this.check(jo(el,e))},ksuid(e){return this.check(Mo(tl,e))},ipv4(e){return this.check(No(nl,e))},ipv6(e){return this.check(Po(rl,e))},cidrv4(e){return this.check(Fo(il,e))},cidrv6(e){return this.check(Io(al,e))},e164(e){return this.check(zo(cl,e))},datetime(e){return this.check(Vo(Vc,e))},date(e){return this.check(Ho(Hc,e))},time(e){return this.check(Uo(Uc,e))},duration(e){return this.check(Wo(Wc,e))}});function z(e){return vo(Bc,e)}var B=M(`ZodStringFormat`,(e,t)=>{F.init(e,t),zc.init(e,t)}),Vc=M(`ZodISODateTime`,(e,t)=>{Bi.init(e,t),B.init(e,t)}),Hc=M(`ZodISODate`,(e,t)=>{Vi.init(e,t),B.init(e,t)}),Uc=M(`ZodISOTime`,(e,t)=>{Hi.init(e,t),B.init(e,t)}),Wc=M(`ZodISODuration`,(e,t)=>{Ui.init(e,t),B.init(e,t)}),Gc=M(`ZodEmail`,(e,t)=>{wi.init(e,t),B.init(e,t)}),Kc=M(`ZodGUID`,(e,t)=>{Si.init(e,t),B.init(e,t)}),qc=M(`ZodUUID`,(e,t)=>{Ci.init(e,t),B.init(e,t)}),Jc=M(`ZodURL`,(e,t)=>{Mi.init(e,t),B.init(e,t)}),Yc=M(`ZodEmoji`,(e,t)=>{Ni.init(e,t),B.init(e,t)}),Xc=M(`ZodNanoID`,(e,t)=>{Pi.init(e,t),B.init(e,t)}),Zc=M(`ZodCUID`,(e,t)=>{Fi.init(e,t),B.init(e,t)}),Qc=M(`ZodCUID2`,(e,t)=>{Ii.init(e,t),B.init(e,t)}),$c=M(`ZodULID`,(e,t)=>{Li.init(e,t),B.init(e,t)}),el=M(`ZodXID`,(e,t)=>{Ri.init(e,t),B.init(e,t)}),tl=M(`ZodKSUID`,(e,t)=>{zi.init(e,t),B.init(e,t)}),nl=M(`ZodIPv4`,(e,t)=>{Wi.init(e,t),B.init(e,t)}),rl=M(`ZodIPv6`,(e,t)=>{qi.init(e,t),B.init(e,t)}),il=M(`ZodCIDRv4`,(e,t)=>{Ji.init(e,t),B.init(e,t)}),al=M(`ZodCIDRv6`,(e,t)=>{Xi.init(e,t),B.init(e,t)}),ol=M(`ZodBase64`,(e,t)=>{$i.init(e,t),B.init(e,t)}),sl=M(`ZodBase64URL`,(e,t)=>{na.init(e,t),B.init(e,t)}),cl=M(`ZodE164`,(e,t)=>{ra.init(e,t),B.init(e,t)}),ll=M(`ZodJWT`,(e,t)=>{aa.init(e,t),B.init(e,t)}),ul=M(`ZodNumber`,(e,t)=>{oa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e.isFinite=!0},kn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Gs(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Gs(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Gs(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Gs(e).format??null},{gt(e,t){return this.check(Qo(e,t))},gte(e,t){return this.check($o(e,t))},min(e,t){return this.check($o(e,t))},lt(e,t){return this.check(Xo(e,t))},lte(e,t){return this.check(Zo(e,t))},max(e,t){return this.check(Zo(e,t))},int(e){return this.check(fl(e))},safe(e){return this.check(fl(e))},positive(e){return this.check(Qo(0,e))},nonnegative(e){return this.check($o(0,e))},negative(e){return this.check(Xo(0,e))},nonpositive(e){return this.check(Zo(0,e))},multipleOf(e,t){return this.check(es(e,t))},step(e,t){return this.check(es(e,t))},finite(){return this}}));function V(e){return Go(ul,e)}var dl=M(`ZodNumberFormat`,(e,t)=>{sa.init(e,t),ul.init(e,t)});function fl(e){return Ko(dl,e)}var pl=M(`ZodBoolean`,(e,t)=>{ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r)});function ml(e){return qo(pl,e)}var hl=M(`ZodUnknown`,(e,t)=>{la.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function gl(){return Jo(hl)}var _l=M(`ZodNever`,(e,t)=>{ua.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qs(e,t,n,r)});function vl(e){return Yo(_l,e)}var yl=M(`ZodArray`,(e,t)=>{Rc(),ma.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ns(e,t))},nonempty(e){return this.check(ns(1,e))},max(e,t){return this.check(ts(e,t))},length(e,t){return this.check(rs(e,t))},unwrap(){return this.element}});function bl(e,t){return gs(yl,e,t)}var xl=M(`ZodObject`,(e,t)=>{Rc(),ba.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ac(e,t,n,r),Fn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Al(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ut(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ut(this._zod.def,{catchall:gl()}))},loose(){return this.clone(Ut(this._zod.def,{catchall:gl()}))},strict(){return this.clone(Ut(this._zod.def,{catchall:vl()}))},strip(){return this.clone(Ut(this._zod.def,{catchall:void 0}))},extend(e){return cn(this,e)},safeExtend(e){return un(this,e)},merge(e){return dn(this,e)},pick(e){return an(this,e)},omit(e){return sn(this,e)},partial(...e){return fn(Fl,this,e[0])},exactPartial(...e){return fn(Ll,this,e[0],`exactPartial`)},required(...e){return pn(Gl,this,e[0])}});function H(e,t){return new xl({type:`object`,shape:e??{},...A(t)})}var Sl=M(`ZodUnion`,(e,t)=>{Sa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oc(e,t,n,r),e.options=t.options});function Cl(e,t){return new Sl({type:`union`,options:e,...A(t)})}var wl=M(`ZodIntersection`,(e,t)=>{Ca.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sc(e,t,n,r)});function Tl(e,t){return new wl({type:`intersection`,left:e,right:t})}var El=M(`ZodRecord`,(e,t)=>{Rc(),Ea.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Dl(e,t,n){return!t||!t._zod?new El({type:`record`,keyType:z(),valueType:e,...A(t)}):new El({type:`record`,keyType:e,valueType:t,...A(n)})}function Ol(e,t,n){return new El({type:`record`,keyType:e,valueType:t,...A(n),partial:!0})}var kl=M(`ZodEnum`,(e,t)=>{Da.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$s(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new kl({...t,checks:[],...A(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new kl({...t,checks:[],...A(r),entries:i})}});function Al(e,t){return new kl({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...A(t)})}var jl=M(`ZodLiteral`,(e,t)=>{Oa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ec(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ml(e,t){return new jl({type:`literal`,values:Array.isArray(e)?e:[e],...A(t)})}var Nl=M(`ZodTransform`,(e,t)=>{Rc(),ka.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Un(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Tn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Tn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Pl(e){return new Nl({type:`transform`,transform:e})}var Fl=M(`ZodOptional`,(e,t)=>{ja.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Il(e){return new Fl({type:`optional`,innerType:e})}var Ll=M(`ZodExactOptional`,(e,t)=>{Ma.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rl(e){return new Ll({type:`optional`,innerType:e})}var zl=M(`ZodNullable`,(e,t)=>{Na.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bl(e){return new zl({type:`nullable`,innerType:e})}var Vl=M(`ZodDefault`,(e,t)=>{Pa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Hl(e,t){return new Vl({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xt(t)}})}var Ul=M(`ZodPrefault`,(e,t)=>{Ia.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wl(e,t){return new Ul({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Xt(t)}})}var Gl=M(`ZodNonOptional`,(e,t)=>{La.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kl(e,t){return new Gl({type:`nonoptional`,innerType:e,...A(t)})}var ql=M(`ZodCatch`,(e,t)=>{Ba.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jl(e,t){return new ql({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Ln(t)})}var Yl=M(`ZodPipe`,(e,t)=>{Va.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yc(e,t,n,r),e.in=t.in,e.out=t.out});function Xl(e,t){return new Yl({type:`pipe`,in:e,out:t})}var Zl=M(`ZodReadonly`,(e,t)=>{Ua.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ql(e){return new Zl({type:`readonly`,innerType:e})}var $l=M(`ZodCustom`,(e,t)=>{Ga.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tc(e,t,n,r)});function eu(e,t={}){return _s($l,e,t)}function tu(e,t){return vs(e,t)}function nu(e){return Ho(Hc,e)}var U={FACEKEY_TOKEN_INVALID:`FACEKEY_TOKEN_INVALID`,FACEKEY_ALREADY_ENROLLED:`FACEKEY_ALREADY_ENROLLED`,FACEKEY_NOT_ENROLLED:`FACEKEY_NOT_ENROLLED`,FACEKEY_VERSION_MISMATCH:`FACEKEY_VERSION_MISMATCH`,FACEKEY_KEY_UNAVAILABLE:`FACEKEY_KEY_UNAVAILABLE`,FACEKEY_TEMPLATE_INVALID:`FACEKEY_TEMPLATE_INVALID`,FACEGATE_TOKEN_INVALID:`FACEGATE_TOKEN_INVALID`,FACEGATE_ABORTED:`FACEGATE_ABORTED`,FACEGATE_TIMEOUT:`FACEGATE_TIMEOUT`,CLIENT_KEY_REQUIRED:`CLIENT_KEY_REQUIRED`,API_KEY_FORBIDDEN:`API_KEY_FORBIDDEN`,CAMERA_INTERRUPTED:`CAMERA_INTERRUPTED`,CAMERA_NOT_FOUND:`CAMERA_NOT_FOUND`,CAMERA_PERMISSION_DENIED:`CAMERA_PERMISSION_DENIED`,CAMERA_UNAVAILABLE:`CAMERA_UNAVAILABLE`,CAMERA_UNSUPPORTED:`CAMERA_UNSUPPORTED`,CAPTURES_INCOMPLETE:`CAPTURES_INCOMPLETE`,CLIENT_ASSET_NOT_FOUND:`CLIENT_ASSET_NOT_FOUND`,CLIENT_NOT_AVAILABLE:`CLIENT_NOT_AVAILABLE`,CONTACT_RATE_LIMITED:`CONTACT_RATE_LIMITED`,DOCUMENT_BACK_CONTAINS_FACE:`DOCUMENT_BACK_CONTAINS_FACE`,DOCUMENT_BACK_NOT_DISTINCT:`DOCUMENT_BACK_NOT_DISTINCT`,DOCUMENT_BACK_REQUIRED:`DOCUMENT_BACK_REQUIRED`,DOCUMENT_BLURRY:`DOCUMENT_BLURRY`,DOCUMENT_CODE_TYPE_MISMATCH:`DOCUMENT_CODE_TYPE_MISMATCH`,DOCUMENT_FACE_GEOMETRY_INVALID:`DOCUMENT_FACE_GEOMETRY_INVALID`,DOCUMENT_FACE_NOT_CONTAINED:`DOCUMENT_FACE_NOT_CONTAINED`,DOCUMENT_FACE_NOT_FOUND:`DOCUMENT_FACE_NOT_FOUND`,DOCUMENT_NOT_FOUND:`DOCUMENT_NOT_FOUND`,DOCUMENT_NOT_RECOGNIZED:`DOCUMENT_NOT_RECOGNIZED`,DOCUMENT_TEXT_ALIGNMENT_INVALID:`DOCUMENT_TEXT_ALIGNMENT_INVALID`,DOCUMENT_TEXT_NOT_READABLE:`DOCUMENT_TEXT_NOT_READABLE`,DOCUMENT_VALIDATION_FAILED:`DOCUMENT_VALIDATION_FAILED`,EMAIL_ALREADY_REGISTERED:`EMAIL_ALREADY_REGISTERED`,EMAIL_DELIVERY_FAILED:`EMAIL_DELIVERY_FAILED`,EUROPEAN_LICENCE_BACK_MARKER_REQUIRED:`EUROPEAN_LICENCE_BACK_MARKER_REQUIRED`,FACE_ALIGNMENT_FAILED:`FACE_ALIGNMENT_FAILED`,FACE_LIGHTING_INVALID:`FACE_LIGHTING_INVALID`,FACE_MISMATCH:`FACE_MISMATCH`,FACE_NOT_FOUND:`FACE_NOT_FOUND`,FACE_NOT_STABLE:`FACE_NOT_STABLE`,FACE_NOT_USABLE:`FACE_NOT_USABLE`,FACE_OUT_OF_FRAME:`FACE_OUT_OF_FRAME`,FACE_POSE_INVALID:`FACE_POSE_INVALID`,GEO_DATABASE_DOWNLOAD_EMPTY:`GEO_DATABASE_DOWNLOAD_EMPTY`,GEO_DATABASE_DOWNLOAD_FAILED:`GEO_DATABASE_DOWNLOAD_FAILED`,IMAGE_DECODE_FAILED:`IMAGE_DECODE_FAILED`,IMAGE_ENCODE_FAILED:`IMAGE_ENCODE_FAILED`,IMAGE_PROCESSING_FAILED:`IMAGE_PROCESSING_FAILED`,IMAGE_TOO_LARGE:`IMAGE_TOO_LARGE`,INFERENCE_FAILED:`INFERENCE_FAILED`,INFERENCE_QUEUE_FULL:`INFERENCE_QUEUE_FULL`,INFERENCE_TIMEOUT:`INFERENCE_TIMEOUT`,VALIDATION_ERROR:`VALIDATION_ERROR`,RESPONSE_VALIDATION_ERROR:`RESPONSE_VALIDATION_ERROR`,RESOURCE_NOT_FOUND:`RESOURCE_NOT_FOUND`,RESOURCE_NOT_FOUND_IN_VIEW:`RESOURCE_NOT_FOUND_IN_VIEW`,REQUEST_TOO_LARGE:`REQUEST_TOO_LARGE`,INTERNAL_ERROR:`INTERNAL_ERROR`,INVALID_CREDENTIALS:`INVALID_CREDENTIALS`,BILLING_DETAILS_REQUIRED:`BILLING_DETAILS_REQUIRED`,PAYMENT_METHOD_NOT_FOUND:`PAYMENT_METHOD_NOT_FOUND`,PAYMENT_NOT_FOUND:`PAYMENT_NOT_FOUND`,RECOVERY_SENT:`RECOVERY_SENT`,INVALID_DOCUMENT_AAMVA:`INVALID_DOCUMENT_AAMVA`,INVALID_DOCUMENT_MRZ:`INVALID_DOCUMENT_MRZ`,INVALID_FACE_MATCH_INPUT:`INVALID_FACE_MATCH_INPUT`,INVALID_IMAGE:`INVALID_IMAGE`,INVALID_KEY_LABEL:`INVALID_KEY_LABEL`,INVALID_MODEL_OUTPUT:`INVALID_MODEL_OUTPUT`,INVALID_OPTIONS:`INVALID_OPTIONS`,INVALID_PASSPORT_MRZ:`INVALID_PASSPORT_MRZ`,INVALID_POSES:`INVALID_POSES`,INVALID_CLIENT_KEY:`INVALID_CLIENT_KEY`,INVALID_REGISTRATION:`INVALID_REGISTRATION`,INVALID_SERVICE_RESPONSE:`INVALID_SERVICE_RESPONSE`,INVALID_VERIFICATION_FEEDBACK:`INVALID_VERIFICATION_FEEDBACK`,INVALID_VERIFICATION_INPUT:`INVALID_VERIFICATION_INPUT`,KEY_NOT_FOUND:`KEY_NOT_FOUND`,MODEL_LOAD_FAILED:`MODEL_LOAD_FAILED`,MULTIPLE_FACES:`MULTIPLE_FACES`,NETWORK_ERROR:`NETWORK_ERROR`,NO_USABLE_CANDIDATES:`NO_USABLE_CANDIDATES`,NO_USABLE_REFERENCES:`NO_USABLE_REFERENCES`,OCR_DICTIONARY_MISMATCH:`OCR_DICTIONARY_MISMATCH`,OCR_ENVIRONMENT_MISMATCH:`OCR_ENVIRONMENT_MISMATCH`,OCR_LANGUAGE_UNSUPPORTED:`OCR_LANGUAGE_UNSUPPORTED`,OCR_MODEL_UNSUPPORTED:`OCR_MODEL_UNSUPPORTED`,PAYMENT_FAILED:`PAYMENT_FAILED`,BILLING_ACCOUNT_BLOCKED:`BILLING_ACCOUNT_BLOCKED`,ACCOUNT_HAS_UNBILLED_USAGE:`ACCOUNT_HAS_UNBILLED_USAGE`,POSE_IDENTITY_MISMATCH:`POSE_IDENTITY_MISMATCH`,POSE_BACKGROUND_MISMATCH:`POSE_BACKGROUND_MISMATCH`,SERVICE_UNAVAILABLE:`SERVICE_UNAVAILABLE`,SUPERADMIN_REQUIRED:`SUPERADMIN_REQUIRED`,UI_ELEMENT_NOT_FOUND:`UI_ELEMENT_NOT_FOUND`,UNAUTHORIZED:`UNAUTHORIZED`,USER_ACCESS_REQUIRED:`USER_ACCESS_REQUIRED`,USER_NOT_FOUND:`USER_NOT_FOUND`,VERIFICATION_CANCELLED:`VERIFICATION_CANCELLED`,VERIFICATION_SAVE_FAILED:`VERIFICATION_SAVE_FAILED`},ru=Al(U),iu=({error:e,fallback:t=U.INTERNAL_ERROR})=>{let n=typeof e==`object`&&e&&`code`in e?ru.safeParse(e.code):null;if(n!==null&&n.success)return n.data;let r=e instanceof Error?e.message:e,i=ru.safeParse(r);return i.success?i.data:t};H({code:ru,message:z(),payload:Dl(z(),gl()).optional()});var au={"dd.ort":`259d860d37e4d12055a63e17685992265ad7d07e656e7ceb564d6e97464f5066`,"do.ort":`d77468ab16b74fd8268cb9d2179aa7fc7d45a5658d3684128d516b1729fd5776`,"fd.ort":`328a81c28493a21cf65b7be4322b1c16d726c485c59615a916dd2090ae1cedec`,"fdl.ort":`d1367545b14a23ec8f827e00580f06f13467f08bbd7399230f1d44bb423c8e10`,"fdh.ort":`5315c6b22309439a3ba1e853133e3ef7ffd43a8d34910bd35e9eacc3c6cacdd0`,"fl.ort":`fa9272923b5f12d61809ceee5611c698c6527e8603857c108891fa4ec41385bf`,"fe.ort":`d1a3c6d54a24b696e88ee12856624c2ea92b9f014f1c4483eb47788c8a6f1f33`,"fm.ort":`34652e9faf44e8a092aad1613d4c67d6775de3f212f3c68f865059ee2b40876d`,"fmh.ort":`57211303a9ded4edc6d98eefed051e029fe56377beb3be1d790c29adb234681a`,"fmu.ort":`f29c1f06155166bd9aa3c50cdb479d1a224c180d761a2d9c8102b1a759155d9b`,"od.ort":`f47d2359be464ca55c28c9986f1b8bf7ee8b3e9ff86e8ecb25d8b2f8eaa55c9e`,"or.ort":`4c7818163f775a89bddba87569edef3f2964f05855ee600d3a34d02c53715fc7`,"ods.ort":`062ed9d8d3e1dfeca55c15763c850ba701f642199d294f7e14a4ea6110dcc43b`,"ors.ort":`f7b99bfde9d06e8cd6844c26d2a0b3d2bb3b6d0c005f1c8003aa241ff89dc466`,"odm.ort":`0896849bbddb9e447b4ab2dcc3b7e40a76efb97199b7195d85f325340239d0f9`,"orj.ort":`bc9c51ff695f866dfb167219f5e8891e9c420b08fad427fe447e922ee16c3450`,"orcs.ort":`86be3129de7cd6d363d5d69bfe5cda792c188d144deca0f2f26cc83d1da9cc21`,"orct.ort":`9690a26ecf8f8a38dbcf763cd9b8a496fba361339e55bfaddbdd46f4462d4d81`,"orc.ort":`5d3c49fc3b5c376a2f4162156d1c5009d63fa3990d37fb807f33dd3227b3f445`,"ora.ort":`470417d05cd0a99b3345af0b970dd337084c5b79d3562e58f92c2196360f6bda`,"ot.txt":`c5cbe34ef40c29c4df07ed012bf96569cb69a2d2a01a07027e9f13cb832bd9cd`,"ots.txt":`41557512862dfe31970cf22407742b629725461dd84c0d8771bde9c87c2202c8`,"otj.txt":`1dcfcb41eec90576a945b3084f22ade11ced506e24f14879245b071698f308e8`,"otcs.txt":`28b2362ad4ab2dc38769aa72feb535e3a9ddb3fd2a7585a05920e6393b1dc7f7`,"otct.txt":`832551fee1f2fbc97508772d81ebdc8dba12c00de97a35c71c9ddf43ddac1a83`,"otc.txt":`90822a96058eb83f8e637ace75f90cbd36c41253f9dbdfb88fcf5a2bdd50d669`,"ota.txt":`7f92f7dbb9b75a4787a83bfb4f6d14a8ab515525130c9d40a9036f61cf6999e9`},ou=new Map,su=globalThis.document?.currentScript,cu=globalThis.HTMLScriptElement&&su instanceof globalThis.HTMLScriptElement?su.src:``,lu=typeof{}.url==`string`?{}.url:``,uu=()=>globalThis.__VOLTOM_ASSET_BASE_URL__,du=()=>uu()||cu||globalThis.location?.href||lu||`http://localhost/`,fu=({filename:e})=>{let t=au[e];if(!t&&/\.(onnx|ort|txt)$/.test(e))throw Error(U.MODEL_LOAD_FAILED);let n=new URL(`./${t?`models`:`assets`}/${e}`,du());return t&&n.searchParams.set(`v`,t),n.href},pu=async({filenames:e})=>{let t=[...new Set(e)];await Promise.all(t.map(async e=>{let t=fu({filename:e}),n=ou.get(t);n||(n=(async()=>{let e=await fetch(t);if(!e.ok)throw Error(U.MODEL_LOAD_FAILED);await e.arrayBuffer()})(),ou.set(t,n));try{await n}catch(e){throw ou.get(t)===n&&ou.delete(t),e}}))},W=z().trim().min(1).nullable(),mu=nu().nullable(),hu=Al([`MRZ`,`AAMVA`,`OCR`]),gu=Al([`PASSPORT`,`ID`,`VISA`,`DRV`,`PERMIT`]),_u=Al([`M`,`F`,`X`]),vu=H({source:hu,type:gu.nullable(),issuing_country:W,number:W,issuing_authority:W.default(null),issue_date:mu,expiry_date:mu,optional_data:W}),yu=H({first_name:W,last_name:W,middle_name:W,birth_place:W.default(null),birth_date:mu,sex:_u.nullable(),nationality:W,personal_number:W}),bu=H({full:W,street:W,city:W,state_province:W,postal_code:W}),xu=H({mrz_lines:bl(z().min(1)),aamva_version:W});H({document:vu,holder:yu,address:bu.nullable(),raw_data:xu});var G={language:`en`,ocrEngine:`auto`,alignment:`eyes-nose-mouth`,maxPitch:8,minPitch:-20,maxYaw:12,minYaw:-12,maxRoll:8,minDocumentFaceAreaRatio:.02,maxDocumentFaceAreaRatio:.3,minDocumentFaceWidthRatio:.075,maxDocumentFaceWidthRatio:.4,minDocumentFaceHeightRatio:.1,maxDocumentFaceHeightRatio:.65,minDocumentBoxRatio:.33,maxDocumentTextAngleDifference:16};H({language:z().default(G.language),ocrEngine:Al([`auto`,`tiny`,`small`,`japanese`,`chinese-simplified`,`chinese-traditional`,`cyrillic`,`arabic`]).default(G.ocrEngine),alignment:Ml(`eyes-nose-mouth`).default(G.alignment),maxPitch:V().positive().max(90).default(G.maxPitch),minPitch:V().negative().min(-90).default(G.minPitch),maxYaw:V().positive().max(90).default(G.maxYaw),minYaw:V().negative().min(-90).default(G.minYaw),maxRoll:V().positive().max(90).default(G.maxRoll),minDocumentFaceAreaRatio:V().min(0).max(1).default(G.minDocumentFaceAreaRatio),maxDocumentFaceAreaRatio:V().min(0).max(1).default(G.maxDocumentFaceAreaRatio),minDocumentFaceWidthRatio:V().min(0).max(1).default(G.minDocumentFaceWidthRatio),maxDocumentFaceWidthRatio:V().min(0).max(1).default(G.maxDocumentFaceWidthRatio),minDocumentFaceHeightRatio:V().min(0).max(1).default(G.minDocumentFaceHeightRatio),maxDocumentFaceHeightRatio:V().min(0).max(1).default(G.maxDocumentFaceHeightRatio),minDocumentBoxRatio:V().min(0).max(1).default(G.minDocumentBoxRatio),maxDocumentTextAngleDifference:V().min(0).max(90).default(G.maxDocumentTextAngleDifference)}).refine(e=>e.minDocumentFaceAreaRatio<=e.maxDocumentFaceAreaRatio&&e.minDocumentFaceWidthRatio<=e.maxDocumentFaceWidthRatio&&e.minDocumentFaceHeightRatio<=e.maxDocumentFaceHeightRatio,U.INVALID_OPTIONS);var Su=({data:e,height:t,normalize:n,width:r})=>{let i=new Float32Array(r*t*3),a=r*t;for(let t=0;t<a;t+=1)for(let r=0;r<3;r+=1)i[r*a+t]=n(e[t*4+r]);return i},Cu=({first:e,second:t})=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*r/(e.width*e.height+t.width*t.height-n*r||1)},wu=({detections:e,threshold:t})=>e.toSorted((e,t)=>t.score-e.score).filter((e,n,r)=>!r.slice(0,n).some(n=>Cu({first:n.boundingRect,second:e.boundingRect})>t)),Tu=({face:e,x:t,y:n})=>({...e,boundingRect:{...e.boundingRect,x:e.boundingRect.x+t,y:e.boundingRect.y+n},mesh:{...e.mesh,landmarks:e.mesh.landmarks.map(e=>({...e,x:e.x+t,y:e.y+n}))}}),Eu=({faces:e})=>{let t=[];for(let n of e)t.some(e=>Cu({first:e.boundingRect,second:n.boundingRect})>.3)||t.push(n);return t},Du=({frameSize:e,tileSize:t})=>[...new Set([0,Math.round((e-t)/2),e-t])],Ou=({outputs:e})=>({score_8:e.out0,score_16:e.out1,score_32:e.out2,bbox_8:e.out3,bbox_16:e.out4,bbox_32:e.out5,kps_8:e.out6,kps_16:e.out7,kps_32:e.out8}),ku=({outputs:e,scale:t,threshold:n=.5})=>{let r=[];for(let i of[8,16,32]){let a=e[`score_${i}`]?.data,o=e[`bbox_${i}`]?.data,s=e[`kps_${i}`]?.data;if(!a||!o||!s)continue;let c=640/i;for(let e=0;e<a.length;e+=1){let l=a[e];if(l<n)continue;let u=Math.floor(e/2),d=u%c*i,f=Math.floor(u/c)*i,p=e*4,m=e*10,h=e=>({x:(d+s[m+e*2]*i)/t,y:(f+s[m+e*2+1]*i)/t});r.push({boundingRect:{x:(d-o[p]*i)/t,y:(f-o[p+1]*i)/t,width:(o[p]+o[p+2])*i/t,height:(o[p+1]+o[p+3])*i/t},score:l,keypoints:{leftEye:h(0),rightEye:h(1),nose:h(2),mouthLeft:h(3),mouthRight:h(4)}})}}return wu({detections:r,threshold:.4})},Au=128,ju=.1,Mu=4,Nu=({image:e})=>{let t=65536,n=new Float32Array(t*3);for(let r=0,i=0;r<e.data.length;r+=4,i+=1)n[i]=(e.data[r]??0)/255,n[i+t]=(e.data[r+1]??0)/255,n[i+t*2]=(e.data[r+2]??0)/255;return n},Pu=({polygon:e})=>{let t=e.reduce((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length}),{x:0,y:0}),n=[...e].sort((e,n)=>Math.atan2(e.y-t.y,e.x-t.x)-Math.atan2(n.y-t.y,n.x-t.x)),r=n.reduce((e,t,r)=>t.x+t.y<n[e].x+n[e].y?r:e,0);return n.slice(r).concat(n.slice(0,r))},Fu=({heatmap:e,height:t,width:n})=>{if(e.length!==512*Au)throw Error(U.INVALID_MODEL_OUTPUT);let r=[],i=1;for(let a=0;a<4;a+=1){let o=a*Au*Au,s=-1/0,c=0;for(let t=0;t<16384;t+=1){let n=e[o+t]??-1/0;n>s&&(s=n,c=t)}if(s<ju)throw Error(U.DOCUMENT_NOT_FOUND);i=Math.min(i,s);let l=c%Au,u=Math.floor(c/Au),d=s*.3,f=0,p=0,m=0;for(let t=Math.max(0,u-Mu);t<=Math.min(127,u+Mu);t+=1)for(let n=Math.max(0,l-Mu);n<=Math.min(127,l+Mu);n+=1){let r=e[o+t*Au+n]??0;r<d||(f+=r,p+=r*n,m+=r*t)}r.push({x:(f?p/f:l)*n/Au,y:(f?m/f:u)*t/Au})}if(i<ju)throw Error(U.DOCUMENT_NOT_FOUND);return Pu({polygon:r})},Iu={TD1:`TD1`,TD2:`TD2`,TD3:`TD3`,SWISS_DRIVING_LICENSE:`SWISS_DRIVING_LICENSE`,FRENCH_NATIONAL_ID:`FRENCH_NATIONAL_ID`,FRENCH_DRIVING_LICENSE:`FRENCH_DRIVING_LICENSE`},Lu={AFG:`Afghanistan`,ALB:`Albania`,DZA:`Algeria`,ASM:`American Samoa`,AND:`Andorra`,AGO:`Angola`,AIA:`Anguilla`,ATA:`Antarctica`,ATG:`Antigua and Barbuda`,ARG:`Argentina`,ARM:`Armenia`,ABW:`Aruba`,AUS:`Australia`,AUT:`Austria`,AZE:`Azerbaijan`,BHS:`Bahamas (the)`,BHR:`Bahrain`,BGD:`Bangladesh`,BRB:`Barbados`,BLR:`Belarus`,BEL:`Belgium`,BLZ:`Belize`,BEN:`Benin`,BMU:`Bermuda`,BTN:`Bhutan`,BOL:`Bolivia (Plurinational State of)`,BES:`Bonaire, Sint Eustatius and Saba`,BIH:`Bosnia and Herzegovina`,BWA:`Botswana`,BVT:`Bouvet Island`,BRA:`Brazil`,IOT:`British Indian Ocean Territory (the)`,BRN:`Brunei Darussalam`,BGR:`Bulgaria`,BFA:`Burkina Faso`,BDI:`Burundi`,CPV:`Cabo Verde`,KHM:`Cambodia`,CMR:`Cameroon`,CAN:`Canada`,CYM:`Cayman Islands (the)`,CAF:`Central African Republic (the)`,TCD:`Chad`,CHL:`Chile`,CHN:`China`,CXR:`Christmas Island`,CCK:`Cocos (Keeling) Islands (the)`,COL:`Colombia`,COM:`Comoros (the)`,COD:`Congo (the Democratic Republic of the)`,COG:`Congo (the)`,COK:`Cook Islands (the)`,CRI:`Costa Rica`,HRV:`Croatia`,CUB:`Cuba`,CUW:`Curaçao`,CYP:`Cyprus`,CZE:`Czechia`,CIV:`Côte d'Ivoire`,DNK:`Denmark`,DJI:`Djibouti`,DMA:`Dominica`,DOM:`Dominican Republic (the)`,ECU:`Ecuador`,EGY:`Egypt`,SLV:`El Salvador`,GNQ:`Equatorial Guinea`,ERI:`Eritrea`,EST:`Estonia`,SWZ:`Eswatini`,ETH:`Ethiopia`,FLK:`Falkland Islands (the) [Malvinas]`,FRO:`Faroe Islands (the)`,FJI:`Fiji`,FIN:`Finland`,FRA:`France`,GUF:`French Guiana`,PYF:`French Polynesia`,ATF:`French Southern Territories (the)`,GAB:`Gabon`,GMB:`Gambia (the)`,GEO:`Georgia`,DEU:`Germany`,GHA:`Ghana`,GIB:`Gibraltar`,GRC:`Greece`,GRL:`Greenland`,GRD:`Grenada`,GLP:`Guadeloupe`,GUM:`Guam`,GTM:`Guatemala`,GGY:`Guernsey`,GIN:`Guinea`,GNB:`Guinea-Bissau`,GUY:`Guyana`,HTI:`Haiti`,HMD:`Heard Island and McDonald Islands`,VAT:`Holy See (the)`,HND:`Honduras`,HKG:`Hong Kong`,HUN:`Hungary`,ISL:`Iceland`,IND:`India`,IDN:`Indonesia`,IRN:`Iran (Islamic Republic of)`,IRQ:`Iraq`,IRL:`Ireland`,IMN:`Isle of Man`,ISR:`Israel`,ITA:`Italy`,JAM:`Jamaica`,JPN:`Japan`,JEY:`Jersey`,JOR:`Jordan`,KAZ:`Kazakhstan`,KEN:`Kenya`,KIR:`Kiribati`,PRK:`Korea (the Democratic People's Republic of)`,KOR:`Korea (the Republic of)`,KWT:`Kuwait`,KGZ:`Kyrgyzstan`,LAO:`Lao People's Democratic Republic (the)`,LVA:`Latvia`,LBN:`Lebanon`,LSO:`Lesotho`,LBR:`Liberia`,LBY:`Libya`,LIE:`Liechtenstein`,LTU:`Lithuania`,LUX:`Luxembourg`,MAC:`Macao`,MDG:`Madagascar`,MWI:`Malawi`,MYS:`Malaysia`,MDV:`Maldives`,MLI:`Mali`,MLT:`Malta`,MHL:`Marshall Islands (the)`,MTQ:`Martinique`,MRT:`Mauritania`,MUS:`Mauritius`,MYT:`Mayotte`,MEX:`Mexico`,FSM:`Micronesia (Federated States of)`,MDA:`Moldova (the Republic of)`,MCO:`Monaco`,MNG:`Mongolia`,MNE:`Montenegro`,MSR:`Montserrat`,MAR:`Morocco`,MOZ:`Mozambique`,MMR:`Myanmar`,NAM:`Namibia`,NRU:`Nauru`,NPL:`Nepal`,NLD:`Netherlands (the)`,NCL:`New Caledonia`,NZL:`New Zealand`,NIC:`Nicaragua`,NER:`Niger (the)`,NGA:`Nigeria`,NIU:`Niue`,NFK:`Norfolk Island`,MKD:`North Macedonia`,MNP:`Northern Mariana Islands (the)`,NOR:`Norway`,OMN:`Oman`,PAK:`Pakistan`,PLW:`Palau`,PSE:`Palestine, State of`,PAN:`Panama`,PNG:`Papua New Guinea`,PRY:`Paraguay`,PER:`Peru`,PHL:`Philippines (the)`,PCN:`Pitcairn`,POL:`Poland`,PRT:`Portugal`,PRI:`Puerto Rico`,QAT:`Qatar`,ROU:`Romania`,RUS:`Russian Federation (the)`,RWA:`Rwanda`,REU:`Réunion`,BLM:`Saint Barthélemy`,SHN:`Saint Helena, Ascension and Tristan da Cunha`,KNA:`Saint Kitts and Nevis`,LCA:`Saint Lucia`,MAF:`Saint Martin (French part)`,SPM:`Saint Pierre and Miquelon`,VCT:`Saint Vincent and the Grenadines`,WSM:`Samoa`,SMR:`San Marino`,STP:`Sao Tome and Principe`,SAU:`Saudi Arabia`,SEN:`Senegal`,SRB:`Serbia`,SYC:`Seychelles`,SLE:`Sierra Leone`,SGP:`Singapore`,SXM:`Sint Maarten (Dutch part)`,SVK:`Slovakia`,SVN:`Slovenia`,SLB:`Solomon Islands`,SOM:`Somalia`,ZAF:`South Africa`,SGS:`South Georgia and the South Sandwich Islands`,SSD:`South Sudan`,ESP:`Spain`,LKA:`Sri Lanka`,SDN:`Sudan (the)`,SUR:`Suriname`,SJM:`Svalbard and Jan Mayen`,SWE:`Sweden`,CHE:`Switzerland`,SYR:`Syrian Arab Republic (the)`,TWN:`Taiwan (Province of China)`,TJK:`Tajikistan`,TZA:`Tanzania, the United Republic of`,THA:`Thailand`,TLS:`Timor-Leste`,TGO:`Togo`,TKL:`Tokelau`,TON:`Tonga`,TTO:`Trinidad and Tobago`,TUN:`Tunisia`,TUR:`Turkey`,TKM:`Turkmenistan`,TCA:`Turks and Caicos Islands (the)`,TUV:`Tuvalu`,UGA:`Uganda`,UKR:`Ukraine`,ARE:`United Arab Emirates (the)`,GBR:`United Kingdom of Great Britain and Northern Ireland (the)`,UMI:`United States Minor Outlying Islands (the)`,USA:`United States of America (the)`,URY:`Uruguay`,UZB:`Uzbekistan`,VUT:`Vanuatu`,VEN:`Venezuela (Bolivarian Republic of)`,VNM:`Viet Nam`,VGB:`Virgin Islands (British)`,VIR:`Virgin Islands (U.S.)`,WLF:`Wallis and Futuna`,ESH:`Western Sahara*`,YEM:`Yemen`,ZMB:`Zambia`,ZWE:`Zimbabwe`,ALA:`Åland Islands`,GBD:`British Overseas Territories Citizen`,GBN:`British National (Overseas)`,GBO:`British Overseas Citizen`,GBS:`British Subject`,GBP:`British Protected Person`,RKS:`Republic of Kosovo`,D:`Germany`,XXK:`Kosovo`,EUE:`European Union (EU)`,UNO:`United Nations Organization or one of its officials`,UNA:`United Nations specialized agency or one of its officials`,UNK:`Resident of Kosovo to whom a travel document has been issued by the United Nations Interim Administration Mission in Kosovo (UNMIK)`,XBA:`African Development Bank (ADB)`,XIM:`African Export-Import Bank (AFREXIM bank)`,XCC:`Caribbean Community or one of its emissaries (CARICOM)`,XCE:`Council of Europe`,XCO:`Common Market for Eastern and Southern Africa (COMESA)`,XEC:`Economic Community of West African States (ECOWAS)`,XPO:`International Criminal Police Organization (INTERPOL)`,XES:`Organization of Eastern Caribbean States (OECS)`,XOM:`Sovereign Military Order of Malta or one of its emissaries`,XDC:`Southern African Development Community`,XXA:`Stateless person, as defined in Article 1 of the 1954 Convention Relating to the Status of Stateless Persons`,XXB:`Refugee, as defined in Article 1 of the 1951 Convention Relating to the Status of Refugees as amended by the 1967 Protocol`,XXC:`Refugee, other than as defined under the code XXB above`,XXX:`Person of unspecified nationality, for whom issuing State does not consider it necessary to specify any of the codes XXA, XXB or XXC above, whatever that person’s status may be. This category may include a person who is neither stateless nor a refugee but who is of unknown nationality and legally residing in the State of issue.`,ANT:`Netherlands Antilles`,NTZ:`Neutral Zone`};Object.freeze(Lu);var Ru=[`A`,`B`,`D`];function zu(e){if(e.length!==2)throw Error(`invalid document code: ${e}. must be 2 char length`);let[t,n]=e;return Bu(t,e),Vu(n,e),`${t}${n}`}function Bu(e,t){if(!Ru.includes(e)){let e=new Intl.ListFormat(`en-US`,{style:`short`,type:`disjunction`});throw Error(`invalid document code: ${t}. First character must be ${e.format(Ru)}`)}}function Vu(e,t){let n=Number.parseInt(e,10);if(Number.isNaN(n))throw Error(`invalid document code number: ${t}. Second character must be a number`)}function Hu(e){return e.replaceAll(/<+$/g,``).replaceAll(`<`,` `)}function Uu(e){if(!e.match(/^[A-Z<]+$/))throw Error(`invalid text: ${e}. Must be only alphabetical with <`);return Hu(e)}function Wu(e,t,n=/^[0-9A-Z<]+$/){let r=Hu(e);if(!n.test(e))throw new Gu(`invalid text: ${e}. Must match the following regular expression: ${n.toString()}`,r,t,t+r.length);return r}var Gu=class extends Error{value;start;end;constructor(e,t,n,r){super(e),this.value=t,this.start=n,this.end=r}},Ku={8:`B`,6:`G`,0:`O`,1:`I`,5:`S`,2:`Z`},qu={B:`8`,G:`6`,O:`0`,I:`1`,S:`5`,Z:`2`};function Ju(e){return qu[e]?qu[e]:e}function Yu(e){return Ku[e]?Ku[e]:e}function Xu(e,t){let n=``,r=[],i=e.split(``);for(let[e,a]of i.entries())if(t.type===K.ALPHABETIC){let i=Yu(a);i!==a&&r.push({line:t.line,column:t.start+e,original:a,corrected:i}),n+=i}else if(t.type===K.NUMERIC){let i=Ju(a);i!==a&&r.push({line:t.line,column:t.start+e,original:a,corrected:i}),n+=i}else n+=a;return{correctedText:n,autocorrect:r}}var K={NUMERIC:`NUMERIC`,ALPHABETIC:`ALPHABETIC`,ALPHANUMERIC:`ALPHANUMERIC`};function Zu(e){$u(e,`label`,`string`),e.field!==null&&$u(e,`field`,`string`),$u(e,`line`,`number`),$u(e,`start`,`number`),$u(e,`end`,`number`),$u(e,`parser`,`function`);let t={line:e.line,start:e.start,end:e.end},n=[t];if(Array.isArray(e.related))for(let t of e.related)$u(t,`line`,`number`),$u(t,`start`,`number`),$u(t,`end`,`number`),n.push(t);return{parser:(t,r)=>{let i=Qu(t,e),a=(e.related||[]).map(e=>Qu(t,e)),o={label:e.label,field:e.field,value:null,valid:!1,ranges:n.map(e=>({...e,raw:Qu(t,e)})),line:0,start:0,end:0,autocorrect:[]},s=o.ranges[0];o.line=s.line,o.start=s.start,o.end=s.end;try{let t=e.parser(i,...a);typeof t==`object`?(o.value=t.value,o.valid=t.valid??!0,t.start!==void 0&&(o.start=s.start+t.start),t.end!==void 0&&(o.end=s.start+t.end),t.valid===!1&&t.error&&(o.error=t.error)):(o.value=t,o.valid=!0)}catch(e){o.error=e.message,e instanceof Gu&&(o.value=e.value,o.start=s.start+e.start,o.end=s.start+e.end)}for(let e of r)e.line===o.line&&e.column>=o.start&&e.column<o.end&&o.autocorrect.push(e);return o},autocorrector:n=>({...Xu(Qu(n,e),e),range:t})}}function Qu(e,t){return e[t.line].slice(t.start,t.end)}function $u(e,t,n){if(typeof e[t]!==n)throw TypeError(`${String(t)} must be a ${n}`)}function ed(e){let t=0,n=[7,3,1];for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===60&&(i=0),i>=65&&(i-=55),i>=48&&(i-=48),i*=n[r%3],t+=i}return t%10}function td(e,t){let n=ed(e),r=n===Number(t);return{valid:r,error:r?null:`invalid check digit: ${t}. Must be ${n}`}}function nd(e,...t){return{value:e,...td(t.join(``),e)}}function rd(e){if(!e.match(/^[0-9<]{4,6}$/))throw Error(`invalid date: ${e}`);let t=e.slice(2,4);if(t!==`<<`&&(Number.parseInt(t,10)<1||Number.parseInt(t,10)>12))throw Error(`invalid date month: ${t}`);if(e.length===6){let t=e.slice(4,6);if(t!==`<<`&&(Number.parseInt(t,10)<1||Number.parseInt(t,10)>31))throw Error(`invalid date day: ${t}`)}return e}function id(e,t){return{value:e,...td(t,e)}}function ad(e,t,n){let r,i;if(t===`<`&&n){let t=n.indexOf(`<`);i=e+n.slice(0,t-1),r=i.length+1}else i=Hu(e),r=i.length;return{value:i,start:0,end:r}}function od(e,t,n){if(e===`<`&&n){let e=n.indexOf(`<`),r=n.slice(0,e-1),i=n.charAt(e-1),a={value:i,start:e,end:e+1},o=td(`${t}<${r}`,i);return o.valid||(o=td(`${t}${r}`,i)),{...a,...o}}return{value:e,...td(t,e)}}function sd(e){let t=e.replace(/.*?<{2}/,``),n=Wu(t,e.length-t.length,/^[A-Z<]+<*$/),r=e.length-t.length;return{value:n,start:r,end:r+n.length}}function cd(e){let t=Wu(e.replace(/<{2}.*$/,``),0,/^[A-Z<]*<*$/);return{value:t,start:0,end:t.length}}function ld(e){switch(e){case`M`:return`male`;case`F`:return`female`;case`<`:return`nonspecified`;default:throw Error(`invalid sex: ${e}. Must be M, F or <.`)}}function ud(e){if(e=Hu(e),!Lu[e])throw Error(`invalid state code: ${e}`);return{value:e,start:0,end:e.length}}var dd={label:`Document number`,field:`documentNumber`,parser:ad,type:K.ALPHANUMERIC},fd={label:`Document number check digit`,field:`documentNumberCheckDigit`,parser:od,type:K.NUMERIC},pd={label:`Document code`,field:`documentCode`,type:K.ALPHABETIC},md={label:`Document code`,field:`documentCode`,type:K.ALPHANUMERIC},hd={label:`Nationality`,field:`nationality`,parser:ud,type:K.ALPHABETIC},gd={label:`Sex`,field:`sex`,parser:ld,type:K.ALPHABETIC},_d={label:`Expiration date`,field:`expirationDate`,parser:rd,type:K.NUMERIC},vd={label:`Expiration date check digit`,field:`expirationDateCheckDigit`,parser:id,type:K.NUMERIC},yd={label:`Composite check digit`,field:`compositeCheckDigit`,parser:nd,type:K.NUMERIC},bd={label:`Birth date`,field:`birthDate`,parser:rd,type:K.NUMERIC},xd={label:`Birth date check digit`,field:`birthDateCheckDigit`,parser:id,type:K.NUMERIC},Sd={label:`Issue date`,field:`issueDate`,parser:rd,type:K.NUMERIC},Cd={label:`First name`,field:`firstName`,parser:sd,type:K.ALPHABETIC},wd={label:`Last name`,field:`lastName`,parser:cd,type:K.ALPHABETIC},Td={label:`Issuing state`,field:`issuingState`,parser:ud,type:K.ALPHABETIC};[{...md,line:0,start:0,end:2,parser:zu},{...Td,line:0,start:2,end:5},{...dd,line:0,start:5,end:14},{...fd,line:0,start:14,end:15,related:[{line:0,start:0,end:14}]},{..._d,line:0,start:15,end:21},{...wd,line:0,start:21,end:29,parser:Uu},{...yd,line:0,start:29,end:30,related:[{line:0,start:0,end:29}]}].map(Zu),Iu.FRENCH_DRIVING_LICENSE;function Ed(e){let t=e.charAt(0);if(t!==`A`&&t!==`C`&&t!==`I`)throw Error(`invalid document code: ${e}. First character must be A, C or I`);let n=e.charAt(1);if(n===`V`)throw Error(`invalid document code: ${e}. Second character may not be V`);return n===`<`?{value:t,start:0,end:1}:e}function Dd(e){let t=Wu(e,0);return{value:t,start:0,end:t.length}}[{...pd,line:0,start:0,end:2,parser:Ed},{...Td,line:0,start:2,end:5},{...wd,line:0,start:5,end:30,parser:Uu},{label:`Administrative code`,field:`administrativeCode`,line:0,start:30,end:36,parser:Dd},{...Sd,line:1,start:0,end:4},{label:`Administrative code 2`,field:`administrativeCode2`,line:1,start:4,end:7,parser:Dd},{...dd,line:1,start:7,end:12},{...fd,line:1,start:12,end:13,related:[{line:1,start:0,end:12}]},{...Cd,line:1,start:13,end:27,parser:Uu},{...bd,line:1,start:27,end:33},{...xd,line:1,start:33,end:34,related:[{line:1,start:27,end:33}]},{...gd,line:1,start:34,end:35},{...yd,line:1,start:35,end:36,related:[{line:0,start:0,end:36},{line:1,start:0,end:35}]}].map(Zu),Iu.FRENCH_NATIONAL_ID;function Od(e){if(!e.match(/^[0-9]+$/))throw Error(`invalid number: ${e}`);return e}function kd(e){if(!e.match(/^<*$/))throw Error(`invalid separator: ${e}. Must be composed only of "<"`);return e}function Ad(e){if(e!==`FA`)throw Error(`invalid document code: ${e}. Must be FA`);return e}function jd(e){switch(e){case`D`:case`F`:case`I`:case`R`:return e;default:throw Error(`invalid languageCode code: ${e}. Must be D, F, I or R`)}}function Md(e){let t=e.slice(0,3),n=e.slice(3,6),r=e.charAt(6),i=e.slice(7);if(!t.match(/^[A-Z0-9]{3}$/))throw Error(`invalid document number: ${e}. Must start with three alphanumeric digits`);if(!n.match(/^[0-9]{3}$/))throw Error(`invalid document number: ${e}. Must have numeric digits in positions 4, 5 and 6`);if(i!==`<<`)throw Error(`invalid document number: ${e}. Must end with <<`);return jd(r),{value:e.slice(0,7),start:0,end:7}}function Nd(e){if(e!==`CHE`&&e!==`LIE`)throw Error(`invalid state code: ${e}. Must be CHE or LIE`);return e}[{...dd,line:0,start:0,end:9,parser:Md},{label:`Language code`,field:`languageCode`,line:0,start:6,end:7,parser:jd,type:K.ALPHABETIC},{...pd,line:1,start:0,end:2,parser:Ad},{...Td,line:1,start:2,end:5,parser:Nd},{label:`PIN code`,field:`pinCode`,line:1,start:5,end:14,parser:Od,type:K.NUMERIC},{label:`Version number`,field:`versionNumber`,line:1,start:14,end:17,parser:Od,type:K.NUMERIC},{label:`Separator 1`,field:null,line:1,start:17,end:19,parser:kd},{...bd,line:1,start:19,end:25},{label:`Separator 2`,field:null,line:1,start:25,end:30,parser:kd},{...wd,line:2,start:0,end:30},{...Cd,line:2,start:0,end:30}].map(Zu),Iu.SWISS_DRIVING_LICENSE;function Pd(e){let t=Wu(e,0);return{value:t,start:0,end:t.length}}[{...pd,line:0,start:0,end:2,parser:Ed},{...Td,line:0,start:2,end:5},{...dd,line:0,start:5,end:14,related:[{line:0,start:14,end:15},{line:0,start:15,end:30}]},{...fd,line:0,start:14,end:15,related:[{line:0,start:5,end:14},{line:0,start:15,end:30}]},{label:`Optional field 1`,field:`optional1`,line:0,start:15,end:30,related:[],parser:Pd},{...bd,start:0,end:6,line:1},{...xd,line:1,start:6,end:7,related:[{line:1,start:0,end:6}]},{...gd,line:1,start:7,end:8},{..._d,line:1,start:8,end:14},{...vd,line:1,start:14,end:15,related:[{line:1,start:8,end:14}]},{...hd,line:1,start:15,end:18},{label:`Optional field 2`,field:`optional2`,line:1,start:18,end:29,parser:Dd},{...yd,line:1,start:29,end:30,related:[{line:0,start:5,end:30},{line:1,start:0,end:7},{line:1,start:8,end:15},{line:1,start:18,end:29}]},{...wd,line:2,start:0,end:30},{...Cd,line:2,start:0,end:30}].map(Zu),Iu.TD1,[{...pd,line:0,start:0,end:2,parser:Ed},{...Td,line:0,start:2,end:5},{...wd,line:0,start:5,end:36},{...Cd,line:0,start:5,end:36},{...dd,line:1,start:0,end:9,related:[{line:1,start:9,end:10},{line:1,start:28,end:35}]},{...fd,line:1,start:9,end:10,related:[{line:1,start:0,end:9},{line:1,start:28,end:35}]},{...hd,line:1,start:10,end:13},{...bd,line:1,start:13,end:19},{...xd,line:1,start:19,end:20,related:[{line:1,start:13,end:19}]},{...gd,line:1,start:20,end:21},{..._d,line:1,start:21,end:27},{...vd,line:1,start:27,end:28,related:[{line:1,start:21,end:27}]},{label:`Optional field`,field:`optional`,line:1,start:28,end:35,parser:Dd},{...yd,line:1,start:35,end:36,related:[{line:1,start:0,end:10},{line:1,start:13,end:20},{line:1,start:21,end:35}]}].map(Zu),Iu.TD2;function Fd(e){let t=e.charAt(0);if(t!==`P`)throw Error(`invalid document code: ${e}. First character must be P`);let n=e.charAt(1);if(!n.match(/[A-Z<]/))throw Error(`invalid document code: ${e}. Second character must be a letter or <`);return n===`<`?{value:t,start:0,end:1}:e}function Id(e){let t=Wu(e,0,/^[A-Z0-9<]+<*$/);return{value:t,start:0,end:t.length}}function Ld(e,t){return Hu(t)===``?e!==`<`&&e!==`0`?{value:e,valid:!1,error:`invalid check digit ${e}: must be 0 or <`}:e:{value:e,...td(t,e)}}[{...pd,line:0,start:0,end:2,parser:Fd},{...Td,line:0,start:2,end:5},{...wd,line:0,start:5,end:44},{...Cd,line:0,start:5,end:44},{...dd,line:1,start:0,end:9},{...fd,line:1,start:9,end:10,related:[{line:1,start:0,end:9}]},{...hd,line:1,start:10,end:13},{...bd,line:1,start:13,end:19},{...xd,line:1,start:19,end:20,related:[{line:1,start:13,end:19}]},{...gd,line:1,start:20,end:21},{..._d,line:1,start:21,end:27},{...vd,line:1,start:27,end:28,related:[{line:1,start:21,end:27}]},{label:`Personal number`,field:`personalNumber`,line:1,start:28,end:42,parser:Id},{label:`Personal number check digit`,field:`personalNumberCheckDigit`,line:1,start:42,end:43,related:[{line:1,start:28,end:42}],parser:Ld},{...yd,line:1,start:43,end:44,related:[{line:1,start:0,end:10},{line:1,start:13,end:20},{line:1,start:21,end:43}]}].map(Zu),Iu.TD3;var Rd=({polygon:e,sourceOrientation:t=0})=>{let n=e.reduce((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length}),{x:0,y:0}),r=[...e].sort((e,t)=>Math.atan2(e.y-n.y,e.x-n.x)-Math.atan2(t.y-n.y,t.x-n.x)),i=(r.reduce((e,t,n)=>t.x+t.y<r[e].x+r[e].y?n:e,0)+t/90)%4;return r.slice(i).concat(r.slice(0,i))},zd=({polygon:e})=>{let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,width:Math.max(...t)-r,height:Math.max(...n)-i}},Bd=({face:e,polygon:t})=>{if(!e)return!1;let n={x:e.boundingRect.x+e.boundingRect.width/2,y:e.boundingRect.y+e.boundingRect.height/2},r=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let a=t[e],o=t[i];a.y>n.y!=o.y>n.y&&n.x<(o.x-a.x)*(n.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r},Vd=z().regex(/^data:image\/jpeg;base64,(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).meta({format:`data-url`,contentEncoding:`base64`,contentMediaType:`image/jpeg`}),Hd=[`faceStraight`,`faceUp`,`faceLeft`,`faceRight`,`faceSmile`],Ud={faceDown:{pitch:20},faceLeft:{yaw:30},faceRight:{yaw:-30},faceTiltLeft:{roll:15},faceTiltRight:{roll:-15},faceUp:{pitch:-20}},Wd=Al(Hd),Gd=z().min(1).max(255),Kd=Al([`enroll`,`unlock`,`forget`]),qd=Al([`enroll`,`unlock`]),Jd=Al([`pending`,`started`,`failed`,`completed`]);H({token:z().min(32).max(128),userId:Gd.optional()}).extend({poses:bl(Wd).min(1).max(Hd.length),faces:bl(Vd).min(1).max(Hd.length)});var Yd=bl(V().finite()).length(512).refine(e=>Math.abs(Math.hypot(...e)-1)<.001);Ol(Wd,Yd).and(H({faceStraight:Yd}));var Xd=H({pose:Wd,matched:ml(),score:V().min(-1).max(1)}),Zd=bl(Wd).min(1).max(Hd.length).refine(e=>e[0]===`faceStraight`&&new Set(e).size===e.length);H({operation:qd,userId:Gd.optional(),poses:Zd.optional()}).refine(e=>e.operation===`enroll`||e.userId!==void 0&&e.poses===void 0),H({userId:Gd}).strict();var Qd=H({userId:Gd});Qd.extend({operation:Kd,poses:bl(Wd).max(Hd.length),expiresAt:z()});var $d=Qd.extend({matched:ml(),matches:bl(Xd).max(2),reason:ru.nullable()});H({vectors:bl(H({pose:Wd,vector:Yd})).max(Hd.length),reason:ru.nullable()}),H({search:z().default(``)}),$d.extend({complete:ml(),token:z().optional()}),Qd.extend({token:z(),operationId:z().uuid()}),H({operationId:z().uuid(),operation:Kd,userId:Gd,status:Jd}),H({origin:z().nullable(),ip:z().nullable(),user_agent:z().nullable(),language:z().nullable()});var ef=({blendshapes:e})=>{let t=e.eyeBlinkLeft??0,n=e.eyeBlinkRight??0;return t>=.5&&n<=.35&&t>=n+.15},tf=({axis:e,target:t,tolerance:n,value:r})=>r>=t-n&&r<=t+n?null:e===`yaw`?t>0?r<t?`FACEKEY_TURN_HEAD_LEFT`:`FACEKEY_TURN_HEAD_LESS`:r>t?`FACEKEY_TURN_HEAD_RIGHT`:`FACEKEY_TURN_HEAD_LESS`:e===`pitch`?t>0?r<t?`FACEKEY_LOWER_HEAD`:`FACEKEY_LOWER_HEAD_LESS`:r>t?`FACEKEY_RAISE_HEAD`:`FACEKEY_RAISE_HEAD_LESS`:t>0?r<t?`FACEKEY_TILT_HEAD_LEFT`:`FACEKEY_TILT_HEAD_LESS`:r>t?`FACEKEY_TILT_HEAD_RIGHT`:`FACEKEY_TILT_HEAD_LESS`,nf=({pitch:e,yaw:t,roll:n,options:r})=>n<-r.maxRoll?`FACEKEY_TILT_HEAD_LEFT`:n>r.maxRoll?`FACEKEY_TILT_HEAD_RIGHT`:t<r.minYaw?`FACEKEY_TURN_HEAD_LEFT`:t>r.maxYaw?`FACEKEY_TURN_HEAD_RIGHT`:e<r.minPitch?`FACEKEY_LOWER_HEAD`:e>r.maxPitch?`FACEKEY_RAISE_HEAD`:null,rf=({blendshapes:e,pitch:t,yaw:n,roll:r,pose:i,options:a})=>{if(i===`faceSmile`)return nf({pitch:t,yaw:n,roll:r,options:a})||((e.mouthSmileLeft??0)>=.5&&(e.mouthSmileRight??0)>=.5?null:`FACEKEY_SMILE_REQUIRED`);if(i===`faceWinkLeft`)return nf({pitch:t,yaw:n,roll:r,options:a})||(ef({blendshapes:e,pose:i})?null:`FACEKEY_WINK_LEFT_REQUIRED`);let o=Ud[i];if(!o)return nf({pitch:t,yaw:n,roll:r,options:a});if(o.roll===void 0){if(r<-a.maxRoll)return`FACEKEY_TILT_HEAD_LEFT`;if(r>a.maxRoll)return`FACEKEY_TILT_HEAD_RIGHT`}if(o.yaw===void 0){if(n<a.minYaw)return`FACEKEY_TURN_HEAD_LEFT`;if(n>a.maxYaw)return`FACEKEY_TURN_HEAD_RIGHT`}if(o.pitch===void 0){if(t<a.minPitch)return`FACEKEY_LOWER_HEAD`;if(t>a.maxPitch)return`FACEKEY_RAISE_HEAD`}let s=a.tolerance??15;return o.roll===void 0?o.yaw===void 0?o.pitch===void 0?null:tf({axis:`pitch`,target:o.pitch,tolerance:s,value:t}):tf({axis:`yaw`,target:o.yaw,tolerance:s,value:n}):o.roll>0&&r<=a.maxRoll?`FACEKEY_TILT_HEAD_LEFT`:o.roll<0&&r>=-a.maxRoll?`FACEKEY_TILT_HEAD_RIGHT`:tf({axis:`roll`,target:o.roll,tolerance:s,value:r})},af=.6,of=({first:e,second:t})=>{if(e.length!==t.length||e.length===0)throw Error(U.INVALID_MODEL_OUTPUT);let n=e.reduce((e,n,r)=>e+n*t[r],0);return Math.max(-1,Math.min(1,n))},sf=({score:e,threshold:t=af})=>({matched:e>t,score:Math.round(e*100)/100}),cf=({first:e,second:t})=>Math.max(of({first:e.rgb,second:t.rgb}),of({first:e.grayscale,second:t.grayscale})),lf=({homography:e,point:t})=>{let n=e[6]*t.x+e[7]*t.y+e[8];return{x:(e[0]*t.x+e[1]*t.y+e[2])/n,y:(e[3]*t.x+e[4]*t.y+e[5])/n}},uf=({canvas:e})=>{e.width=1,e.height=1},df=({category:e,duration:t,key:n})=>{},ff=({outputs:e})=>{for(let t of new Set(Object.values(e)))t.dispose()},pf=async({label:e,session:t,feeds:n})=>{let r=performance.now();try{return await t.run(n)}catch(e){throw Error(iu({error:e,fallback:U.INFERENCE_FAILED}),{cause:e})}finally{for(let e of new Set(Object.values(n)))e.dispose();df({category:`inference`,duration:performance.now()-r,key:e})}},mf=224,hf=256,gf=[0,90,180,270],_f=[.485,.456,.406],vf=[.229,.224,.225],yf=({runtime:e})=>{let t=async()=>{await e.session({filename:`do.ort`})},n=({frame:t,boundingRect:n={x:0,y:0,width:t.width,height:t.height}})=>{let r=Math.max(0,Math.floor(n.x)),i=Math.max(0,Math.floor(n.y)),a=Math.min(t.width,Math.ceil(n.x+n.width))-r,o=Math.min(t.height,Math.ceil(n.y+n.height))-i;if(a<=0||o<=0)throw Error(U.IMAGE_PROCESSING_FAILED);let s=hf/Math.min(a,o),c=Math.round(a*s),l=Math.round(o*s),u=e.createCanvas(mf,mf),d=u.getContext(`2d`,{willReadFrequently:!0});if(!d)throw Error(U.IMAGE_PROCESSING_FAILED);d.drawImage(t,r,i,a,o,-Math.floor((c-mf)/2),-Math.floor((l-mf)/2),c,l);let{data:f}=d.getImageData(0,0,mf,mf);uf({canvas:u});let p=50176,m=new Float32Array(p*3);for(let e=0;e<3;e+=1)for(let t=0;t<p;t+=1)m[e*p+t]=(f[t*4+e]/255-_f[e])/vf[e];return m};return{detectDocumentOrientation:async({frame:t,boundingRect:r})=>{let i=await e.session({filename:`do.ort`}),a=n({frame:t,boundingRect:r}),o=await pf({label:`document.orientation`,session:i,feeds:{x:e.tensor(`float32`,a,[1,3,mf,mf])}});try{let e=o.fetch_name_0?.data;if(!(e instanceof Float32Array)||e.length!==4||e.some(e=>!Number.isFinite(e)||e<0||e>1))throw Error(U.INVALID_MODEL_OUTPUT);let t={0:e[0],90:e[1],180:e[2],270:e[3]},n=gf.reduce((e,n)=>t[n]>t[e]?n:e);return{rotation:n,confidence:t[n],scores:t}}finally{ff({outputs:o})}},loadDocumentOrientationDetector:t}},bf=({runtime:e})=>{let{detectDocumentOrientation:t,loadDocumentOrientationDetector:n}=yf({runtime:e}),r=`dd.ort`,i=.15,a=.75,o=.03,s=.8,c=({from:e,to:t})=>Math.hypot(t.x-e.x,t.y-e.y),l=({origin:e,first:t,second:n})=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),u=({polygon:e})=>{let t=0;for(let n=0;n<e.length;n+=1){let r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return Math.abs(t/2)},d=async({frame:t,sourceOrientation:n=0})=>{let i=e.createCanvas(256,256),a=i.getContext(`2d`);if(!a)throw Error(U.IMAGE_PROCESSING_FAILED);a.translate(128,128),a.rotate(-n*Math.PI/180),a.drawImage(t,-128,-128,256,256);let o=a.getImageData(0,0,256,256);uf({canvas:i});let s=Nu({image:{data:o.data,height:256,width:256}}),c=await pf({label:`document.box`,session:await e.session({filename:r}),feeds:{img:e.tensor(`float32`,s,[1,3,256,256])}});try{let e=c.heatmap?.data;if(!(e instanceof Float32Array))throw Error(U.INVALID_MODEL_OUTPUT);try{let r=n%180?t.height:t.width;return{confidence:null,polygon:Fu({heatmap:e,height:n%180?t.width:t.height,width:r})}}catch(e){if(e instanceof Error&&e.message===U.DOCUMENT_NOT_FOUND)return null;throw e}}finally{ff({outputs:c})}},f=async({frame:e})=>{let n=await d({frame:e}),r=null;if(n){let i=zd({polygon:n.polygon});i.width>0&&i.height>0&&(r=await t({frame:e,boundingRect:i}),r.rotation&&(n=await d({frame:e,sourceOrientation:r.rotation})))}let i=r!==null&&r.rotation%180!=0;return{detected:n,orientation:r,width:i?e.height:e.width,height:i?e.width:e.height}},p=({detection:e,frame:t,orientation:n})=>{let r=Rd({polygon:e.polygon.map(({x:e,y:r})=>n?.rotation===90?{x:t.width-1-r,y:e}:n?.rotation===180?{x:t.width-1-e,y:t.height-1-r}:n?.rotation===270?{x:r,y:t.height-1-e}:{x:e,y:r})});return{polygon:r,boundingRect:zd({polygon:r}),...n?{orientation:n}:{}}},m=({frame:t})=>{let n=Math.min(1,480/Math.max(t.width,t.height)),r=e.createCanvas(Math.max(1,Math.round(t.width*n)),Math.max(1,Math.round(t.height*n))),i=r.getContext(`2d`,{willReadFrequently:!0});if(!i)throw Error(U.IMAGE_PROCESSING_FAILED);return i.drawImage(t,0,0,r.width,r.height),{canvas:r,scale:n}},h=({data:e})=>{let t=new Uint8Array(e.length/4);for(let n=0;n<t.length;n+=1){let r=n*4;t[n]=Math.round(e[r]*.299+e[r+1]*.587+e[r+2]*.114)}return t},g=({pixels:e,width:t,height:n})=>{let r=0,i=0,a=0;for(let o=1;o<n-1;o+=1)for(let n=1;n<t-1;n+=1){let s=e[o*t+n]*8-(e[(o-1)*t+n]+e[(o+1)*t+n]+e[o*t+n-1]+e[o*t+n+1]+e[(o-1)*t+n-1]+e[(o-1)*t+n+1]+e[(o+1)*t+n-1]+e[(o+1)*t+n+1]);i+=s,a+=s*s,r+=1}if(!r)return 0;let o=i/r;return Math.max(0,a/r-o*o)},_=({previous:e,current:t,next:n})=>{let r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,o=n.y-t.y,s=Math.hypot(r,i)*Math.hypot(a,o);return s?Math.acos(Math.max(-1,Math.min(1,(r*a+i*o)/s)))*180/Math.PI:0},v=({first:e,second:t})=>{let n=Math.hypot(e.x,e.y),r=Math.hypot(t.x,t.y);if(!n||!r)return 90;let i=Math.abs(e.x*t.y-e.y*t.x)/(n*r);return Math.asin(Math.min(1,i))*180/Math.PI},y=({first:e,second:t})=>Math.min(e,t)/Math.max(e,t),b=({polygon:e})=>{if(e.length!==4||e.some(e=>!Number.isFinite(e.x)||!Number.isFinite(e.y)))return!1;let t=e.map((t,n)=>c({from:t,to:e[(n+1)%e.length]}));if(t.some(e=>e<=0))return!1;let n=e.map((t,n)=>l({origin:t,first:e[(n+1)%e.length],second:e[(n+2)%e.length]}));if(!n.every(e=>e>0)&&!n.every(e=>e<0))return!1;let r=e.map((t,n)=>{let r=e[(n+1)%e.length];return{x:r.x-t.x,y:r.y-t.y}}),i=v({first:r[0],second:r[2]})<=36&&v({first:r[1],second:r[3]})<=36,a=y({first:t[0],second:t[2]})>=s&&y({first:t[1],second:t[3]})>=s;return i&&a},x=({height:e,minDocumentBoxRatio:t,polygon:n,width:r})=>{if(n.length!==4)return{detection:null,rejection:`polygon_invalid`};if(!b({polygon:n}))return{detection:null,rejection:`geometry`};let i=r,s=e;if(n.map((e,t)=>_({previous:n[(t-1+n.length)%n.length],current:e,next:n[(t+1)%n.length]})).some(e=>e<35||e>145))return{detection:null,rejection:`corner_angle`};let l=[c({from:n[0],to:n[1]}),c({from:n[2],to:n[3]})],d=[c({from:n[1],to:n[2]}),c({from:n[3],to:n[0]})],f=(l[0]+l[1])/2,p=(d[0]+d[1])/2,m=Math.max(f,p)/Math.min(f,p),h=u({polygon:n})/(i*s);if(m<1.25||m>2.4)return{detection:null,rejection:`aspect_ratio`};if(h<t)return{detection:null,rejection:`coverage_low`};if(h>.99)return{detection:null,rejection:`coverage_high`};let g=n.some(e=>e.x<i*o||e.y<s*o||e.x>i*.97||e.y>s*.97);if(h>a&&g)return{detection:null,rejection:`edge_proximity`};let v=n.some(e=>e.y<s*o)&&n.some(e=>e.y>s*.97)||n.some(e=>e.x<i*o)&&n.some(e=>e.x>i*.97);if(i>s&&v&&h<a)return{detection:null,rejection:`opposite_edges`};let y=n,x=y.map(e=>e.x),S=y.map(e=>e.y),C=Math.min(...x),w=Math.min(...S),T=Math.max(...x),ee=Math.max(...S);return{detection:{polygon:y,boundingRect:{x:C,y:w,width:T-C,height:ee-w}},rejection:null}},S=async()=>{await e.session({filename:r})},C=async({frame:e,minDocumentBoxRatio:t=i})=>{let{canvas:n}=m({frame:e}),r=n.getContext(`2d`,{willReadFrequently:!0});if(!r)throw Error(U.IMAGE_PROCESSING_FAILED);let a=r.getImageData(0,0,n.width,n.height),o=n.width,s=n.height;uf({canvas:n});let c=h({data:a.data}),l=g({pixels:c,width:o,height:s}),{detected:u,orientation:d,width:_,height:v}=await f({frame:e}),y=u?x({height:v,minDocumentBoxRatio:t,polygon:u.polygon,width:_}):{detection:null,rejection:null},b={};return y.rejection&&(b[y.rejection]=1),{detection:y.detection?p({detection:y.detection,frame:e,orientation:d}):null,diagnostics:{accepted:+!!y.detection,confidence:u?.confidence??null,rejected:b},isBlurry:l<1e3,sharpness:l}};return{loadDocumentBoxDetector:S,detectDocumentOrientation:t,loadDocumentOrientationDetector:n,analyzeDocument:C,detectDocument:async e=>(await C({frame:e})).detection,detectDocumentBox:async e=>{let t=await d({frame:e});if(!t)return null;let n=x({height:e.height,minDocumentBoxRatio:i,polygon:t.polygon,width:e.width});return n.detection?p({detection:n.detection,frame:e,orientation:null}):null}}},xf={high:`fdh.ort`,standard:`fd.ort`,low:`fdl.ort`},Sf=({detection:e,frame:t})=>{let n=Math.max(e.boundingRect.width,e.boundingRect.height)*1.1,r=Math.max(1,Math.min(Math.ceil(n),t.width,t.height)),i=e.boundingRect.x+e.boundingRect.width/2,a=e.boundingRect.y+e.boundingRect.height/2;return{size:r,x:Math.max(0,Math.min(t.width-r,Math.round(i-r/2))),y:Math.max(0,Math.min(t.height-r,Math.round(a-r/2)))}},Cf=({runtime:e,imageFromImageBitmap:t})=>{let n=`_neutral.browDownLeft.browDownRight.browInnerUp.browOuterUpLeft.browOuterUpRight.cheekPuff.cheekSquintLeft.cheekSquintRight.eyeBlinkLeft.eyeBlinkRight.eyeLookDownLeft.eyeLookDownRight.eyeLookInLeft.eyeLookInRight.eyeLookOutLeft.eyeLookOutRight.eyeLookUpLeft.eyeLookUpRight.eyeSquintLeft.eyeSquintRight.eyeWideLeft.eyeWideRight.jawForward.jawLeft.jawOpen.jawRight.mouthClose.mouthDimpleLeft.mouthDimpleRight.mouthFrownLeft.mouthFrownRight.mouthFunnel.mouthLeft.mouthLowerDownLeft.mouthLowerDownRight.mouthPressLeft.mouthPressRight.mouthPucker.mouthRight.mouthRollLower.mouthRollUpper.mouthShrugLower.mouthShrugUpper.mouthSmileLeft.mouthSmileRight.mouthStretchLeft.mouthStretchRight.mouthUpperUpLeft.mouthUpperUpRight.noseSneerLeft.noseSneerRight`.split(`.`),r=[0,1,4,5,6,7,8,10,13,14,17,21,33,37,39,40,46,52,53,54,55,58,61,63,65,66,67,70,78,80,81,82,84,87,88,91,93,95,103,105,107,109,127,132,133,136,144,145,146,148,149,150,152,153,154,155,157,158,159,160,161,162,163,168,172,173,176,178,181,185,191,195,197,234,246,249,251,263,267,269,270,276,282,283,284,285,288,291,293,295,296,297,300,308,310,311,312,314,317,318,321,323,324,332,334,336,338,356,361,362,365,373,374,375,377,378,379,380,381,382,384,385,386,387,388,389,390,397,398,400,402,405,409,415,454,466,468,469,470,471,472,473,474,475,476,477],i=`standard`,a=({frame:e,height:n,width:r})=>t({frame:e,height:n,width:r}).data,o=({outputs:e,scale:t,threshold:n})=>{let r=[];for(let i of[8,16,32]){let a=e[`score_${i}`]??e[`cls_${i}`],o=e[`bbox_${i}`],s=e[`kps_${i}`],c=e[`obj_${i}`];if(!a||!o||!s)continue;let l=a.data,u=c?.data,d=o.data,f=s.data,p=640/i;for(let e=0;e<l.length;e+=1){let a=l[e]*(u?u[e]:1);if(a<n)continue;let o=Math.floor(e/2),s=(o%p+.5)*i,c=(Math.floor(o/p)+.5)*i,m=e*4,h=e*10,g=e=>({x:(s+f[h+e*2]*i)/t,y:(c+f[h+e*2+1]*i)/t});r.push({boundingRect:{x:(s-d[m]*i)/t,y:(c-d[m+1]*i)/t,width:(d[m]+d[m+2])*i/t,height:(d[m+1]+d[m+3])*i/t},score:a,keypoints:{leftEye:g(0),rightEye:g(1),nose:g(2),mouthLeft:g(3),mouthRight:g(4)}})}}return wu({detections:r,threshold:.4})},s=async({frame:t,faceDetector:n})=>{let r=640/Math.max(t.width,t.height),i=Math.round(t.width*r),s=Math.round(t.height*r),c=Su({data:a({frame:t,height:s,width:i}),height:s,width:i,normalize:e=>(e-127.5)/128}),l=new Float32Array(1228800);for(let e=0;e<3;e+=1)for(let t=0;t<s;t+=1)l.set(c.subarray(e*i*s+t*i,e*i*s+(t+1)*i),e*640*640+t*640);let u=await e.session({filename:xf[n]}),d=await pf({label:`face.detector`,session:u,feeds:{[u.inputNames[0]]:e.tensor(`float32`,l,[1,3,640,640])}});try{return n===`standard`?ku({outputs:Ou({outputs:d}),scale:r,threshold:.5}):o({outputs:d,scale:r,threshold:.5})}finally{ff({outputs:d})}},c=async({frame:t})=>{let n=a({frame:t,height:128,width:128}),r=new Float32Array(49152);for(let e=0;e<49152;e+=1)r[e]=n[Math.floor(e/3)*4+e%3]/127.5-1;let i=await e.session({filename:xf.low}),o=await pf({label:`face.detector`,session:i,feeds:{[i.inputNames[0]]:e.tensor(`float32`,r,[1,128,128,3])}});try{let e=o.regressors.data,n=o.classificators.data,r=[],i=[];for(let{count:e,copies:t}of[{count:16,copies:2},{count:8,copies:6}])for(let n=0;n<e;n+=1)for(let r=0;r<e;r+=1)for(let a=0;a<t;a+=1)i.push({x:(r+.5)/e,y:(n+.5)/e});for(let a=0;a<n.length;a+=1){let o=1/(1+Math.exp(-n[a]));if(o<.5)continue;let s=a*16,c=i[a];if(!c)continue;let l=n=>({x:(e[s+5+n*2]+c.x*128)*(t.width/128),y:(e[s+4+n*2]+c.y*128)*(t.height/128)}),u=e[s+3]*(t.width/128),d=e[s+2]*(t.height/128),f=(e[s+1]+c.x*128)*(t.width/128),p=(e[s]+c.y*128)*(t.height/128);r.push({boundingRect:{x:f-u/2,y:p-d/2,width:u,height:d},score:o,keypoints:{leftEye:l(0),rightEye:l(1),nose:l(2),mouthLeft:l(3),mouthRight:l(4)}})}return wu({detections:r,threshold:.3})}finally{ff({outputs:o})}},l=async({blendshapes:i=!0,detection:a,frame:o})=>{let{size:s,x:c,y:l}=Sf({detection:a,frame:o}),u=t({frame:o,height:256,width:256,sourceRect:{x:c,y:l,width:s,height:s}}).data,d=await e.session({filename:`fl.ort`}),f=await pf({label:`face.landmarks`,session:d,feeds:{[d.inputNames[0]]:e.tensor(`float32`,Su({data:u,height:256,width:256,normalize:e=>e/255}),[1,3,256,256])}});try{if(f.score.data[0]<.5)return null;let t=f.landmarks.data,u=Array.from({length:478},(e,n)=>({x:c+t[n*3]*s/256,y:l+t[n*3+1]*s/256,z:t[n*3+2]*s/256})),d=u[33],p=u[263],m=u[1],h=(m.y-(d.y+p.y)/2)/Math.abs(p.x-d.x)*100,g=(m.x-(d.x+p.x)/2)/Math.abs(p.x-d.x)*100,_=new Float32Array(n.length);if(i){let t=new Float32Array(292);for(let e=0;e<r.length;e+=1){let n=u[r[e]];t[e*2]=n.x,t[e*2+1]=n.y}let n=await e.session({filename:`fe.ort`}),i=await pf({label:`face.blendshape`,session:n,feeds:{[n.inputNames[0]]:e.tensor(`float32`,t,[1,146,2])}});try{_=i[n.outputNames[0]].data}finally{ff({outputs:i})}}return{blendshapes:Object.fromEntries(n.map((e,t)=>[e,_[t]??0])),pitch:h-54,yaw:g-5,roll:Math.atan2(p.y-d.y,p.x-d.x)*180/Math.PI,boundingRect:a.boundingRect,mesh:{height:o.height,landmarks:u,width:o.width}}}finally{ff({outputs:f})}},u=async({faceDetector:t=`standard`}={})=>{i=t,await Promise.all([e.session({filename:xf[t]}),e.session({filename:`fl.ort`}),e.session({filename:`fe.ort`})])},d=async({blendshapes:e=!0,frame:t})=>{let n=i===`low`?await c({frame:t}):await s({frame:t,faceDetector:i});return(await Promise.all(n.map(n=>l({blendshapes:e,detection:n,frame:t})))).filter(e=>e!==null)},f=async e=>(await d({frame:e}))[0]??null,p=async({blendshapes:t=!0,frame:n,tileHeight:r,tileWidth:i})=>{let a=[];for(let o of Du({frameSize:n.height,tileSize:r}))for(let s of Du({frameSize:n.width,tileSize:i})){let c=await e.createImageBitmap(n,s,o,i,r);try{let e=await d({blendshapes:t,frame:c});a.push(...e.map(e=>Tu({face:e,x:s,y:o})))}finally{c.close()}}return a},m=async({blendshapes:e=!0,frame:t})=>await p({blendshapes:e,frame:t,tileHeight:Math.ceil(t.height/2),tileWidth:Math.ceil(t.width/2)}),h=async({frame:e})=>{let t=await d({blendshapes:!1,frame:e}),n=await p({blendshapes:!1,frame:e,tileHeight:Math.ceil(e.height*.4),tileWidth:Math.ceil(e.width*.4)});return Eu({faces:[...t,...n]})},g=({detection:e,x:t,y:n})=>({...e,boundingRect:{...e.boundingRect,x:e.boundingRect.x+t,y:e.boundingRect.y+n},keypoints:Object.fromEntries(Object.entries(e.keypoints).map(([e,r])=>[e,{x:r.x+t,y:r.y+n}]))}),_=async({frame:t,tileHeight:n,tileWidth:r})=>{let i=[];for(let a of Du({frameSize:t.height,tileSize:n}))for(let o of Du({frameSize:t.width,tileSize:r})){let s=await e.createImageBitmap(t,o,a,r,n);try{let e=await c({frame:s});i.push(...e.map(e=>g({detection:e,x:o,y:a})))}finally{s.close()}}return i},v=async({frame:e})=>{let t=await c({frame:e}),n=await _({frame:e,tileHeight:Math.ceil(e.height*.4),tileWidth:Math.ceil(e.width*.4)});return wu({detections:[...t,...n],threshold:.3})},y=async(e,t={})=>{let n=await d({blendshapes:t.blendshapes,frame:e});if(i!==`low`)return n;let r=await m({blendshapes:t.blendshapes,frame:e});return Eu({faces:[...n,...r]})},b=({detection:e,face:t})=>Bd({face:t,polygon:e.polygon});return{loadFaceDetector:u,detectFace:f,detectPictureFaces:y,faceIsInsideDocument:b,detectDocumentFaces:async({detection:t,frame:n})=>{let r=await e.createImageBitmap(n,0,0,Math.ceil(n.width/2),n.height),a;try{a=(i===`low`?await h({frame:r}):await y(r,{blendshapes:!1})).map(e=>({...e,mesh:{...e.mesh,height:n.height,width:n.width}}))}finally{r.close()}return{faces:a.filter(e=>b({detection:t,face:e})).sort((e,t)=>t.boundingRect.width*t.boundingRect.height-e.boundingRect.width*e.boundingRect.height),hasPictureFace:a.length>0,pictureFaces:a}},detectDocumentFacePresence:async({detection:t,frame:n})=>{let r=await e.createImageBitmap(n,0,0,Math.ceil(n.width/2),n.height);try{return(i===`low`?await v({frame:r}):await s({frame:r,faceDetector:i})).some(e=>b({detection:t,face:e}))}finally{r.close()}}}},wf=({runtime:e})=>{let{detectDocumentOrientation:t}=yf({runtime:e}),n={left:[33,133],right:[263,362]},r=({matrix:e,values:t})=>{let n=e.map((e,n)=>[...e,t[n]]);for(let e=0;e<n.length;e+=1){let t=e;for(let r=e+1;r<n.length;r+=1)Math.abs(n[r][e])>Math.abs(n[t][e])&&(t=r);if(Math.abs(n[t][e])<1e-8)return null;[n[e],n[t]]=[n[t],n[e]];let r=n[e][e];for(let t=e;t<=n.length;t+=1)n[e][t]/=r;for(let t=0;t<n.length;t+=1){if(t===e)continue;let r=n[t][e];for(let i=e;i<=n.length;i+=1)n[t][i]-=r*n[e][i]}}return n.map(e=>e[n.length])},i=({from:e,to:t})=>{let n=[],i=[];for(let[r,a]of e.entries()){let e=t[r];n.push([a.x,a.y,1,0,0,0,-e.x*a.x,-e.x*a.y]),i.push(e.x),n.push([0,0,0,a.x,a.y,1,-e.y*a.x,-e.y*a.y]),i.push(e.y)}let a=r({matrix:n,values:i});return a?[...a,1]:null},a=lf,o=({frame:t,polygon:n,rotation:r=0})=>{let a=zd({polygon:n}),o=Math.max(0,Math.floor(a.x)),s=Math.max(0,Math.floor(a.y)),c=Math.max(1,Math.min(t.width-o,Math.ceil(a.width))),l=Math.max(1,Math.min(t.height-s,Math.ceil(a.height))),u=r%180?l:c,d=r%180?c:l,f=e.createCanvas(u,d),p=f.getContext(`2d`);if(!p)throw Error(U.IMAGE_PROCESSING_FAILED);r===90?(p.translate(0,d),p.rotate(-Math.PI/2)):r===180?(p.translate(u,d),p.rotate(Math.PI)):r===270&&(p.translate(u,0),p.rotate(Math.PI/2)),p.drawImage(t,o,s,c,l,0,0,c,l);let m=o+c,h=s+l,g=i({from:[{x:0,y:0},{x:u,y:0},{x:u,y:d},{x:0,y:d}],to:r===90?[{x:m,y:s},{x:m,y:h},{x:o,y:h},{x:o,y:s}]:r===180?[{x:m,y:h},{x:o,y:h},{x:o,y:s},{x:m,y:s}]:r===270?[{x:o,y:h},{x:o,y:s},{x:m,y:s},{x:m,y:h}]:[{x:o,y:s},{x:m,y:s},{x:m,y:h},{x:o,y:h}]});return g?{frame:f.transferToImageBitmap(),height:d,sourceHeight:t.height,sourceWidth:t.width,toSource:g,width:u}:null},s=async({frame:e,polygon:n,orientation:r})=>{if(n.length!==4)return null;let i=r??await t({frame:e,boundingRect:zd({polygon:n})}),a=o({frame:e,polygon:n,rotation:i.rotation});return a?{...a,orientation:i}:null},c=({document:e,face:t})=>{let n=t.mesh.landmarks.map(({x:t,y:n,z:r})=>({...a({homography:e.toSource,point:{x:t,y:n}}),z:r})),r=[{x:t.boundingRect.x,y:t.boundingRect.y},{x:t.boundingRect.x+t.boundingRect.width,y:t.boundingRect.y},{x:t.boundingRect.x+t.boundingRect.width,y:t.boundingRect.y+t.boundingRect.height},{x:t.boundingRect.x,y:t.boundingRect.y+t.boundingRect.height}].map(t=>a({homography:e.toSource,point:t})),i=r.map(({x:e})=>e),o=r.map(({y:e})=>e),s={x:Math.min(...i),y:Math.min(...o),width:Math.max(...i)-Math.min(...i),height:Math.max(...o)-Math.min(...o)};return{...t,boundingRect:s,mesh:{...t.mesh,height:e.sourceHeight,landmarks:n,width:e.sourceWidth}}},l=({face:e})=>{let t=e.mesh.landmarks,r=n.left.map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t})),i=n.right.map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t})),a=[13,14].map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t}));return r.length!==2||i.length!==2||a.length!==2?null:{boundingRect:e.boundingRect,mouth:{x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},leftEye:{x:(r[0].x+r[1].x)/2,y:(r[0].y+r[1].y)/2},rightEye:{x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2}}},u=({face:e,lines:t,maxAngleDifference:n})=>{let r=Math.atan2(e.rightEye.y-e.leftEye.y,e.rightEye.x-e.leftEye.x)*180/Math.PI,i=0;for(let a of t){let t=Math.abs(a.angle-r)%180,o=Math.min(t,180-t),s=a.box;!(s.y>=e.boundingRect.y&&s.y+s.height<=e.boundingRect.y+e.boundingRect.height)||o>n||s.x>e.boundingRect.x+e.boundingRect.width&&(i+=1)}return i};return{transformPoint:a,orientDocumentFrame:s,restoreRectifiedFace:c,rectifiedDocumentFace:l,documentAlignment:({face:e,lines:t,maxAngleDifference:n,maxFaceAreaRatio:r,maxFaceHeightRatio:i,maxFaceWidthRatio:a,minFaceAreaRatio:o,minFaceHeightRatio:s,minFaceWidthRatio:c,documentSize:l})=>{if(!e)return{faceAdjacentTextLineCount:0,angleDifference:null,eyesAngle:null,faceAreaRatio:0,faceAreaValid:!1,faceDimensionsValid:!1,faceHeightRatio:0,faceWidthRatio:0,textAngle:null,textParallel:!1,textSide:`unknown`};let d=e.boundingRect.width*e.boundingRect.height/(l.width*l.height),f=d>=o&&d<=r,p=e.boundingRect.width/l.width,m=e.boundingRect.height/l.height,h=p>=c&&p<=a&&m>=s&&m<=i,g=Math.atan2(e.rightEye.y-e.leftEye.y,e.rightEye.x-e.leftEye.x)*180/Math.PI,_=t.filter(t=>{let n=t.box;return n.y>=e.boundingRect.y&&n.y+n.height<=e.boundingRect.y+e.boundingRect.height&&n.x>e.boundingRect.x+e.boundingRect.width}),v=_.length?_.reduce((e,t)=>e+t.angle,0)/_.length:null,y=v===null?null:Math.abs(v-g)%180,b=y===null?null:Math.min(y,180-y),x=b!==null&&b<=n;return{faceAdjacentTextLineCount:u({face:e,lines:t,maxAngleDifference:n}),angleDifference:b,eyesAngle:g,faceAreaRatio:d,faceAreaValid:f,faceDimensionsValid:h,faceHeightRatio:m,faceWidthRatio:p,textAngle:v,textParallel:x,textSide:_.length?`right`:`unknown`}}}},Tf=({runtime:e})=>({frame:t,height:n=t.height,width:r=t.width,sourceRect:i})=>{let a=e.createCanvas(r,n);try{let e=a.getContext(`2d`,{willReadFrequently:!0});if(!e)throw Error(U.IMAGE_PROCESSING_FAILED);return i?e.drawImage(t,i.x,i.y,i.width,i.height,0,0,r,n):e.drawImage(t,0,0,r,n),{data:e.getImageData(0,0,r,n).data,height:n,width:r}}finally{uf({canvas:a})}},Ef={standard:{filename:`fm.ort`,layout:`nhwc`},high:{filename:`fmh.ort`,layout:`nhwc`},ultra:{filename:`fmu.ort`,layout:`nchw`}},Df=({runtime:e,orientDocumentFrame:t,detectDocument:n,faceDetection:r,detectFace:i,detectPictureFaces:a,faceMatcher:o=`ultra`})=>{let s=Tf({runtime:e}),c=[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],l={"eyes-nose-mouth":{landmarks:[[33,133],[263,362],[1],[61],[291]],target:[[38.2946,51.6963],[73.5318,51.5014],[56.0252,71.7366],[41.5493,92.3655],[70.7299,92.2041]]}},u=({points:e})=>[e.reduce((e,[t])=>e+t,0)/e.length,e.reduce((e,[,t])=>e+t,0)/e.length],d=({source:e,target:t})=>{if(e.length<2||e.length!==t.length)return null;let[n,r]=u({points:e}),[i,a]=u({points:t}),o=0,s=0,c=0;for(let[l,[u,d]]of e.entries()){let[e,f]=t[l],p=u-n,m=d-r,h=e-i,g=f-a;o+=p*p+m*m,s+=p*h+m*g,c+=p*g-m*h}if(o<1e-8)return null;let l=s/o,d=c/o;return l*l+d*d<1e-8?null:[l,-d,i-l*n+d*r,d,l,a-d*n-l*r]},f=({height:e,minimumArea:t,polygon:n,width:r})=>{if(Math.abs(n.reduce((e,t,r)=>{let i=n[(r+1)%n.length];return e+t[0]*i[1]-i[0]*t[1]},0))/2<t)return null;let i=new Float32Array(r*e),a=Math.max(0,Math.ceil(Math.min(...n.map(([,e])=>e))-.5)),o=Math.min(e,Math.ceil(Math.max(...n.map(([,e])=>e))-.5));for(let e=a;e<o;e+=1){let t=[],a=e+.5;for(let e=0,r=n.length-1;e<n.length;r=e++){let[i,o]=n[r],[s,c]=n[e];o>a!=c>a&&t.push((s-i)*(a-o)/(c-o)+i)}t.sort((e,t)=>e-t);for(let n=0;n+1<t.length;n+=2){let a=Math.min(r,Math.max(0,Math.ceil(t[n]-.5))),o=Math.max(0,Math.min(r,Math.ceil(t[n+1]-.5)));i.fill(1,e*r+a,e*r+o)}}return i},p=({face:e,grayscale:t})=>{let{image:n,weights:r}=e,i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=1){let t=r[e];if(!t)continue;let c=e*4,l=n[c]*.299+n[c+1]*.587+n[c+2]*.114;i+=l*t,a+=l*l*t,o+=t,(l<8||l>247)&&(s+=t)}if(o<r.length*.1)return null;let c=i/o;if(c<25||c>230||s/o>.4)return null;let l=Math.sqrt(Math.max(1,a/o-c*c)),u=Math.min(1.8,Math.max(.55,58/(127.5/c*l)))*(127.5/c),d=new Uint8ClampedArray(n.length);for(let e=0;e<r.length;e+=1){let i=e*4,a=r[e],o=n[i]*.299+n[i+1]*.587+n[i+2]*.114,s=(o-c)*u+127.5,l=s/Math.max(o,1);for(let e=0;e<3;e+=1)d[i+e]=Math.max(0,Math.min(255,t?s:n[i+e]*l))*a+127.5*(1-a);d[i+3]=255}return d},m=({alignment:t,face:n,frame:r})=>{let i=c.map(e=>{let t=n.mesh.landmarks[e];return[t.x,t.y]});if(i.some(([e,t])=>!Number.isFinite(e)||!Number.isFinite(t)||e<0||t<0||e>=r.width||t>=r.height))return null;let a=e.createCanvas(112,112);try{let e=a.getContext(`2d`,{willReadFrequently:!0});if(!e)throw Error(U.IMAGE_PROCESSING_FAILED);let o=l[t],s=o.landmarks.map(e=>{let t=e.map(e=>{let t=n.mesh.landmarks[e];return[t.x,t.y]});return u({points:t})}),c=d({source:s,target:o.target});if(!c||!c.every(Number.isFinite))return null;e.fillStyle=`rgb(128, 128, 128)`,e.fillRect(0,0,112,112),e.setTransform(c[0],c[3],c[1],c[4],c[2],c[5]),e.drawImage(r,0,0),e.setTransform(1,0,0,1,0,0);let m=i.map(([e,t])=>[c[0]*e+c[1]*t+c[2],c[3]*e+c[4]*t+c[5]]),h=f({height:112,minimumArea:1254.4,polygon:m,width:112});if(!h)return null;let g={image:e.getImageData(0,0,112,112).data,weights:h},_=p({face:g,grayscale:!1});if(!_)return null;let v=p({face:g,grayscale:!0});return v?{...g,normalized:{rgb:_,greyscale:v}}:null}finally{uf({canvas:a})}},h=async({faceMatcher:t=o}={})=>await e.session({filename:Ef[t].filename}),g=({layout:e,normalized:t})=>{let n=12544,r=new Float32Array(n*3);for(let i=0;i<n;i+=1){let a=i*4;for(let o=0;o<3;o+=1){let s=(t[a+o]-127.5)/127.5,c=e===`nhwc`?i*3+o:o*n+i;r[c]=s}}return r},_=async({normalized:t})=>{let{layout:n}=Ef[o],r=g({layout:n,normalized:t}),i=n===`nhwc`?[1,112,112,3]:[1,3,112,112],a=await h(),s=await pf({label:`face.embedding`,session:a,feeds:{[a.inputNames[0]]:e.tensor(`float32`,r,i)}});try{let e=s[a.outputNames[0]].data;if(!(e instanceof Float32Array))throw Error(U.INVALID_MODEL_OUTPUT);let t=e,n=Math.hypot(...t);if(t.length!==512||!t.every(Number.isFinite)||!Number.isFinite(n)||n<1e-8)throw Error(U.INVALID_MODEL_OUTPUT);return Array.from(t,e=>e/n)}finally{ff({outputs:s})}},v=async({blob:t})=>{try{return await e.createImageBitmap(t)}catch(e){throw Error(U.IMAGE_DECODE_FAILED,{cause:e})}},y=async({normalized:e})=>{try{return await _({normalized:e})}catch(e){if(e instanceof Error&&e.message===U.INVALID_MODEL_OUTPUT)return null;throw e}},b=async({face:e})=>{let t=await y({normalized:e.normalized.rgb});if(!t)return null;let n=await y({normalized:e.normalized.greyscale});return n?{grayscale:n,rgb:t}:null},x=async({face:e})=>await y({normalized:e.normalized.greyscale}),S=async()=>{let e=new Uint8ClampedArray(50176).fill(127);if(!await b({face:{normalized:{rgb:e,greyscale:e}}}))throw Error(U.INVALID_MODEL_OUTPUT)},C=async({pixels:t})=>{let n=e.createCanvas(112,112);try{let e=n.getContext(`2d`);if(!e)throw Error(U.IMAGE_PROCESSING_FAILED);let r=e.createImageData(112,112);r.data.set(t),e.putImageData(r,0,0);let i=await n.convertToBlob({type:`image/jpeg`,quality:1});if(i.type!==`image/jpeg`)throw Error(U.IMAGE_ENCODE_FAILED);return i}finally{uf({canvas:n})}},w=async({face:e})=>{let t=await b({face:e});if(!t)return null;let[n,r]=await Promise.all([C({pixels:e.normalized.rgb}),C({pixels:e.normalized.greyscale})]);return{embeddings:t,images:{rgb:n,greyscale:r}}},T=async({alignment:e,face:t,frame:n})=>{let r=m({alignment:e,face:t,frame:n});return r?await b({face:r}):null},ee=async({alignment:e,frame:t})=>{let n=await i(t);if(!n)throw Error(U.FACE_NOT_FOUND);let r=await T({alignment:e,face:n,frame:t});if(!r)throw Error(U.FACE_NOT_USABLE);return r},te=async({alignment:e,frame:t})=>{let n=await a(t,{forMatch:!0}),r=[];for(let i of n){let n=await T({alignment:e,face:i,frame:t});n&&r.push(n)}return r},ne=async({alignment:e,frame:i})=>{let a=await n(i);if(!a)throw Error(U.DOCUMENT_NOT_FOUND);let o=await t({frame:i,polygon:a.polygon,orientation:a.orientation});if(!o)throw Error(U.DOCUMENT_NOT_FOUND);try{let t={boundingRect:{height:o.height,width:o.width,x:0,y:0},polygon:[{x:0,y:0},{x:o.width,y:0},{x:o.width,y:o.height},{x:0,y:o.height}]},{faces:n}=await r.detectDocumentFaces({detection:t,frame:o.frame});if(!n.length)throw Error(U.DOCUMENT_FACE_NOT_FOUND);for(let t of n){let n=await T({alignment:e,face:t,frame:o.frame});if(n)return n}}finally{o.frame.close()}throw Error(U.FACE_NOT_USABLE)};return{prepareFace:m,loadFaceMatch:h,warmupFaceMatch:S,imageBitmap:v,readImage:s,preparedFaceEmbeddings:b,preparedFaceGrayscaleEmbedding:x,preparedFaceArtifacts:w,matchFaceWithDocument:async({document:e,documentFaceEmbeddings:t,referenceFaceEmbeddings:n,options:r,reference:i})=>{let a=null,o=null;try{let s=t;s||=(o=await v({blob:e}),await ne({alignment:r.alignment,frame:o,language:r.language,ocrEngine:r.ocrEngine}));let c=n;return c||=(a=await v({blob:i}),await ee({alignment:r.alignment,frame:a})),sf({score:cf({first:c,second:s}),threshold:r.threshold})}finally{a&&a.close(),o&&o.close()}},matchPictureWithFaces:async({options:e,picture:t,references:n,referenceFaceEmbeddings:r})=>{let i=await v({blob:t}),a=[];try{if(!r)for(let e of n){let t=await v({blob:e});a.push(t)}let t=await te({alignment:e.alignment,frame:i});if(!t.length)throw Error(U.NO_USABLE_CANDIDATES);let o=r?[...r]:[];for(let t of a)try{let n=await ee({alignment:e.alignment,frame:t});o.push(n)}catch(e){if(!(e instanceof Error)||e.message!==U.FACE_NOT_FOUND&&e.message!==U.FACE_NOT_USABLE)throw e}let s=-1/0;for(let e of o)for(let n of t){let t=cf({first:n,second:e});s=Math.max(s,t)}if(!Number.isFinite(s))throw Error(U.NO_USABLE_REFERENCES);return sf({score:s,threshold:e.threshold})}finally{i.close();for(let e of a)e.close()}}}},Of=n({InferenceSession:()=>Ep,TRACE:()=>_p,TRACE_EVENT_BEGIN:()=>xp,TRACE_EVENT_END:()=>Sp,TRACE_FUNC_BEGIN:()=>yp,TRACE_FUNC_END:()=>bp,Tensor:()=>hp,default:()=>Sh,env:()=>Y,registerBackend:()=>zf}),kf=Object.defineProperty,Af=Object.getOwnPropertyDescriptor,jf=Object.getOwnPropertyNames,Mf=Object.prototype.hasOwnProperty,Nf=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),q=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},Pf=(e,t)=>{for(var n in t)kf(e,n,{get:t[n],enumerable:!0})},Ff=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of jf(t))!Mf.call(e,i)&&i!==n&&kf(e,i,{get:()=>t[i],enumerable:!(r=Af(t,i))||r.enumerable});return e},If=e=>Ff(kf({},`__esModule`,{value:!0}),e),Lf,Rf,zf,Bf,Vf,Hf=q(()=>{"use strict";Lf=new Map,Rf=[],zf=(e,t,n)=>{if(t&&typeof t.init==`function`&&typeof t.createInferenceSessionHandler==`function`){let r=Lf.get(e);if(r===void 0)Lf.set(e,{backend:t,priority:n});else{if(r.priority>n)return;if(r.priority===n&&r.backend!==t)throw Error(`cannot register backend "${e}" using priority ${n}`)}if(n>=0){let t=Rf.indexOf(e);t!==-1&&Rf.splice(t,1);for(let t=0;t<Rf.length;t++)if(Lf.get(Rf[t]).priority<=n){Rf.splice(t,0,e);return}Rf.push(e)}}else throw TypeError(`not a valid backend`)},Bf=async e=>{let t=Lf.get(e);if(!t)return`backend not found.`;if(t.initialized)return t.backend;if(t.aborted)return t.error;{let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init(e)),await t.initPromise,t.initialized=!0,t.backend}catch(e){return n||(t.error=`${e}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},Vf=async e=>{let t=e.executionProviders||[],n=t.map(e=>typeof e==`string`?e:e.name),r=n.length===0?Rf:n,i,a=[],o=new Set;for(let e of r){let t=await Bf(e);typeof t==`string`?a.push({name:e,err:t}):(i||=t,i===t&&o.add(e))}if(!i)throw Error(`no available backend found. ERR: ${a.map(e=>`[${e.name}] ${e.err}`).join(`, `)}`);for(let{name:e,err:t}of a)n.includes(e)&&console.warn(`removing requested execution provider "${e}" from session options because it is not available: ${t}`);let s=t.filter(e=>o.has(typeof e==`string`?e:e.name));return[i,new Proxy(e,{get:(e,t)=>t===`executionProviders`?s:Reflect.get(e,t)})]}}),Uf=q(()=>{"use strict";Hf()}),Wf,Gf=q(()=>{"use strict";Wf=`1.30.0`}),Kf,J,qf=q(()=>{"use strict";Gf(),Kf=`warning`,J={wasm:{},webgl:{},webgpu:{},versions:{common:Wf},set logLevel(e){if(e!==void 0){if(typeof e!=`string`||[`verbose`,`info`,`warning`,`error`,`fatal`].indexOf(e)===-1)throw Error(`Unsupported logging level: ${e}`);Kf=e}},get logLevel(){return Kf}},Object.defineProperty(J,"logLevel",{enumerable:!0})}),Y,Jf=q(()=>{"use strict";qf(),Y=J}),Yf,Xf,Zf=q(()=>{"use strict";Yf=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`):new OffscreenCanvas(1,1);n.width=e.dims[3],n.height=e.dims[2];let r=n.getContext(`2d`);if(r!=null){let i,a;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[3]):(i=e.dims[3],a=e.dims[2]);let o=t?.format===void 0?`RGB`:t.format,s=t?.norm,c,l;s===void 0||s.mean===void 0?c=[255,255,255,255]:typeof s.mean==`number`?c=[s.mean,s.mean,s.mean,s.mean]:(c=[s.mean[0],s.mean[1],s.mean[2],0],s.mean[3]!==void 0&&(c[3]=s.mean[3])),s===void 0||s.bias===void 0?l=[0,0,0,0]:typeof s.bias==`number`?l=[s.bias,s.bias,s.bias,s.bias]:(l=[s.bias[0],s.bias[1],s.bias[2],0],s.bias[3]!==void 0&&(l[3]=s.bias[3]));let u=a*i,d=0,f=u,p=u*2,m=-1;o===`RGBA`?(d=0,f=u,p=u*2,m=u*3):o===`RGB`?(d=0,f=u,p=u*2):o===`RBG`&&(d=0,p=u,f=u*2);for(let t=0;t<a;t++)for(let n=0;n<i;n++){let i=(e.data[d++]-l[0])*c[0],a=(e.data[f++]-l[1])*c[1],o=(e.data[p++]-l[2])*c[2],s=m===-1?255:(e.data[m++]-l[3])*c[3];r.fillStyle=`rgba(`+i+`,`+a+`,`+o+`,`+s+`)`,r.fillRect(n,t,1,1)}if(`toDataURL`in n)return n.toDataURL();throw Error(`toDataURL is not supported`)}throw Error(`Can not access image data`)},Xf=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):new OffscreenCanvas(1,1).getContext(`2d`),r;if(n!=null){let i,a,o;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[1],o=e.dims[3]):(i=e.dims[3],a=e.dims[2],o=e.dims[1]);let s=t!==void 0&&t.format!==void 0?t.format:`RGB`,c=t?.norm,l,u;c===void 0||c.mean===void 0?l=[255,255,255,255]:typeof c.mean==`number`?l=[c.mean,c.mean,c.mean,c.mean]:(l=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(l[3]=c.mean[3])),c===void 0||c.bias===void 0?u=[0,0,0,0]:typeof c.bias==`number`?u=[c.bias,c.bias,c.bias,c.bias]:(u=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(u[3]=c.bias[3]));let d=a*i;if(t!==void 0&&(t.format!==void 0&&o===4&&t.format!==`RGBA`||o===3&&t.format!==`RGB`&&t.format!==`BGR`))throw Error(`Tensor format doesn't match input tensor dims`);let f=0,p=1,m=2,h=3,g=0,_=d,v=d*2,y=-1;s===`RGBA`?(g=0,_=d,v=d*2,y=d*3):s===`RGB`?(g=0,_=d,v=d*2):s===`RBG`&&(g=0,v=d,_=d*2),r=n.createImageData(i,a);for(let t=0;t<a*i;f+=4,p+=4,m+=4,h+=4,t++)r.data[f]=(e.data[g++]-u[0])*l[0],r.data[p]=(e.data[_++]-u[1])*l[1],r.data[m]=(e.data[v++]-u[2])*l[2],r.data[h]=y===-1?255:(e.data[y++]-u[3])*l[3]}else throw Error(`Can not access image data`);return r}}),Qf,$f,ep,tp,np,rp,ip=q(()=>{"use strict";mp(),Qf=(e,t)=>{if(e===void 0)throw Error(`Image buffer must be defined`);if(t.height===void 0||t.width===void 0)throw Error(`Image height and width must be defined`);if(t.tensorLayout===`NHWC`)throw Error(`NHWC Tensor layout is not supported yet`);let{height:n,width:r}=t,i=t.norm??{mean:255,bias:0},a,o;a=typeof i.mean==`number`?[i.mean,i.mean,i.mean,i.mean]:[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],o=typeof i.bias==`number`?[i.bias,i.bias,i.bias,i.bias]:[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let s=t.format===void 0?`RGBA`:t.format,c=t.tensorFormat!==void 0&&t.tensorFormat!==void 0?t.tensorFormat:`RGB`,l=n*r,u=c===`RGBA`?new Float32Array(l*4):new Float32Array(l*3),d=4,f=0,p=1,m=2,h=3,g=0,_=l,v=l*2,y=-1;s===`RGB`&&(d=3,f=0,p=1,m=2,h=-1),c===`RGBA`?y=l*3:c===`RBG`?(g=0,v=l,_=l*2):c===`BGR`&&(v=0,_=l,g=l*2);for(let t=0;t<l;t++,f+=d,m+=d,p+=d,h+=d)u[g++]=(e[f]+o[0])/a[0],u[_++]=(e[p]+o[1])/a[1],u[v++]=(e[m]+o[2])/a[2],y!==-1&&h!==-1&&(u[y++]=(e[h]+o[3])/a[3]);return c===`RGBA`?new pp(`float32`,u,[1,4,n,r]):new pp(`float32`,u,[1,3,n,r])},$f=async(e,t)=>{let n=typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement,r=typeof ImageData<`u`&&e instanceof ImageData,i=typeof ImageBitmap<`u`&&e instanceof ImageBitmap,a=typeof e==`string`,o,s=t??{},c=()=>{if(typeof document<`u`)return document.createElement(`canvas`);if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(1,1);throw Error(`Canvas is not supported`)},l=e=>typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas?e.getContext(`2d`):null;if(n){let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let n=e.height,i=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(n=t.resizedHeight,i=t.resizedWidth),t!==void 0){if(s=t,t.tensorFormat!==void 0)throw Error(`Image input config format must be RGBA for HTMLImageElement`);s.tensorFormat=`RGBA`,s.height=n,s.width=i}else s.tensorFormat=`RGBA`,s.height=n,s.width=i;r.drawImage(e,0,0),o=r.getImageData(0,0,i,n).data}else throw Error(`Can not access image data`)}else if(r){let n,r;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(n=t.resizedHeight,r=t.resizedWidth):(n=e.height,r=e.width),t!==void 0&&(s=t),s.format=`RGBA`,s.height=n,s.width=r,t!==void 0){let t=c();t.width=r,t.height=n;let i=l(t);if(i!=null)i.putImageData(e,0,0),o=i.getImageData(0,0,r,n).data;else throw Error(`Can not access image data`)}else o=e.data}else if(i){if(t===void 0)throw Error(`Please provide image config with format for Imagebitmap`);let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let t=e.height,n=e.width;return r.drawImage(e,0,0,n,t),o=r.getImageData(0,0,n,t).data,s.height=t,s.width=n,Qf(o,s)}throw Error(`Can not access image data`)}else{if(a)return new Promise((t,n)=>{let r=c(),i=l(r);if(!e||!i)return n();let a=new Image;a.crossOrigin=`Anonymous`,a.src=e,a.onload=()=>{r.width=a.width,r.height=a.height,i.drawImage(a,0,0,r.width,r.height);let e=i.getImageData(0,0,r.width,r.height);s.height=r.height,s.width=r.width,t(Qf(e.data,s))}});throw Error(`Input data provided is not supported - aborted tensor creation`)}if(o!==void 0)return Qf(o,s);throw Error(`Input data provided is not supported - aborted tensor creation`)},ep=(e,t)=>{let{width:n,height:r,download:i,dispose:a}=t;return new pp({location:`texture`,type:`float32`,texture:e,dims:[1,r,n,4],download:i,dispose:a})},tp=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new pp({location:`gpu-buffer`,type:n??`float32`,gpuBuffer:e,dims:r,download:i,dispose:a})},np=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new pp({location:`ml-tensor`,type:n??`float32`,mlTensor:e,dims:r,download:i,dispose:a})},rp=(e,t,n)=>new pp({location:`cpu-pinned`,type:e,data:t,dims:n??[t.length]})}),ap,op,sp,cp,lp=q(()=>{"use strict";ap=new Map([[`float32`,Float32Array],[`uint8`,Uint8Array],[`int8`,Int8Array],[`uint16`,Uint16Array],[`int16`,Int16Array],[`int32`,Int32Array],[`bool`,Uint8Array],[`float64`,Float64Array],[`uint32`,Uint32Array],[`int4`,Uint8Array],[`uint4`,Uint8Array]]),op=new Map([[Float32Array,`float32`],[Uint8Array,`uint8`],[Int8Array,`int8`],[Uint16Array,`uint16`],[Int16Array,`int16`],[Int32Array,`int32`],[Float64Array,`float64`],[Uint32Array,`uint32`]]),sp=!1,cp=()=>{if(!sp){sp=!0;let e=typeof BigInt64Array<`u`&&BigInt64Array.from,t=typeof BigUint64Array<`u`&&BigUint64Array.from,n=globalThis.Float16Array,r=typeof n<`u`&&n.from;e&&(ap.set(`int64`,BigInt64Array),op.set(BigInt64Array,`int64`)),t&&(ap.set(`uint64`,BigUint64Array),op.set(BigUint64Array,`uint64`)),r?(ap.set(`float16`,n),op.set(n,`float16`)):ap.set(`float16`,Uint16Array)}}}),up,dp,fp=q(()=>{"use strict";mp(),up=e=>{let t=1;for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`number`||!Number.isSafeInteger(r))throw TypeError(`dims[${n}] must be an integer, got: ${r}`);if(r<0)throw RangeError(`dims[${n}] must be a non-negative integer, got: ${r}`);t*=r}return t},dp=(e,t)=>{switch(e.location){case`cpu`:return new pp(e.type,e.data,t);case`cpu-pinned`:return new pp({location:`cpu-pinned`,data:e.data,type:e.type,dims:t});case`texture`:return new pp({location:`texture`,texture:e.texture,type:e.type,dims:t});case`gpu-buffer`:return new pp({location:`gpu-buffer`,gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case`ml-tensor`:return new pp({location:`ml-tensor`,mlTensor:e.mlTensor,type:e.type,dims:t});default:throw Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),pp,mp=q(()=>{"use strict";Zf(),ip(),lp(),fp(),pp=class{constructor(e,t,n){cp();let r,i;if(typeof e==`object`&&`location`in e)switch(this.dataLocation=e.location,r=e.type,i=e.dims,e.location){case`cpu-pinned`:{let t=ap.get(r);if(!t)throw TypeError(`unsupported type "${r}" to create tensor from pinned buffer`);if(!(e.data instanceof t))throw TypeError(`buffer should be of type ${t.name}`);this.cpuData=e.data;break}case`texture`:if(r!==`float32`)throw TypeError(`unsupported type "${r}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break;case`gpu-buffer`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break;case`ml-tensor`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint64`&&r!==`int8`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break;default:throw Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,o;if(typeof e==`string`){if(r=e,o=n,e===`string`){if(!Array.isArray(t))throw TypeError(`A string tensor's data must be a string array.`);a=t}else{let n=ap.get(e);if(n===void 0)throw TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e===`float16`&&n===Uint16Array||e===`uint4`||e===`int4`)throw TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${n.name} as data.`);a=e===`uint64`||e===`int64`?n.from(t,BigInt):n.from(t)}else if(t instanceof n)a=t;else if(t instanceof Uint8ClampedArray){if(e===`uint8`)a=Uint8Array.from(t);else throw TypeError(`A Uint8ClampedArray tensor's data must be type of uint8`)}else if(e===`float16`&&t instanceof Uint16Array&&n!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw TypeError(`A ${r} tensor's data must be type of ${n}`)}}else if(o=t,Array.isArray(e)){if(e.length===0)throw TypeError(`Tensor type cannot be inferred from an empty array.`);let t=typeof e[0];if(t===`string`)r=`string`,a=e;else if(t===`boolean`)r=`bool`,a=Uint8Array.from(e);else throw TypeError(`Invalid element type of data array: ${t}.`)}else if(e instanceof Uint8ClampedArray)r=`uint8`,a=Uint8Array.from(e);else{let t=op.get(e.constructor);if(t===void 0)throw TypeError(`Unsupported type for tensor data: ${e.constructor}.`);r=t,a=e}if(o===void 0)o=[a.length];else if(!Array.isArray(o))throw TypeError(`A tensor's dims must be a number array`);i=o,this.cpuData=a,this.dataLocation=`cpu`}let a=up(i);if(this.cpuData&&a!==this.cpuData.length&&(r!==`uint4`&&r!==`int4`||Math.ceil(a/2)!==this.cpuData.length))throw Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=r,this.dims=i,this.size=a}static async fromImage(e,t){return $f(e,t)}static fromTexture(e,t){return ep(e,t)}static fromGpuBuffer(e,t){return tp(e,t)}static fromMLTensor(e,t){return np(e,t)}static fromPinnedBuffer(e,t,n){return rp(e,t,n)}toDataURL(e){return Yf(this,e)}toImageData(e){return Xf(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw Error(`The data is not stored as a WebGL texture.`);return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw Error(`The data is not stored as a WebGPU buffer.`);return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw Error(`The data is not stored as a WebNN MLTensor.`);return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case`cpu`:case`cpu-pinned`:return this.data;case`texture`:case`gpu-buffer`:case`ml-tensor`:if(!this.downloader)throw Error(`The current tensor is not created with a specified data downloader.`);if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation=`cpu`,this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}default:throw Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);this.disposer&&=(this.disposer(),void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation=`none`}ensureValid(){if(this.dataLocation===`none`)throw Error(`The tensor is disposed.`)}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw Error(`Cannot reshape a tensor that owns GPU resource.`);return dp(this,e)}}}),hp,gp=q(()=>{"use strict";mp(),hp=pp}),_p,vp,yp,bp,xp,Sp,Cp=q(()=>{"use strict";qf(),_p=(e,t)=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.timeStamp(`${e}::ORT::${t}`)},vp=(e,t)=>{let n=Error().stack?.split(/\r\n|\r|\n/g)||[],r=!1;for(let i=0;i<n.length;i++){if(r&&!n[i].includes(`TRACE_FUNC`)){let r=`FUNC_${e}::${n[i].trim().split(` `)[1]}`;t&&(r+=`::${t}`),_p(`CPU`,r);return}n[i].includes(`TRACE_FUNC`)&&(r=!0)}},yp=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||vp(`BEGIN`,e)},bp=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||vp(`END`,e)},xp=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.time(`ORT::${e}`)},Sp=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.timeEnd(`ORT::${e}`)}}),wp,Tp=q(()=>{"use strict";Hf(),gp(),Cp(),wp=class e{constructor(e){this.handler=e}async run(e,t,n){yp(),xp(`InferenceSession.run`);let r={},i={};if(typeof e!=`object`||!e||e instanceof hp||Array.isArray(e))throw TypeError(`'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.`);let a=!0;if(typeof t==`object`){if(t===null)throw TypeError(`Unexpected argument[1]: cannot be null.`);if(t instanceof hp)throw TypeError(`'fetches' cannot be a Tensor`);if(Array.isArray(t)){if(t.length===0)throw TypeError(`'fetches' cannot be an empty array.`);a=!1;for(let e of t){if(typeof e!=`string`)throw TypeError(`'fetches' must be a string array or an object.`);if(this.outputNames.indexOf(e)===-1)throw RangeError(`'fetches' contains invalid output name: ${e}.`);r[e]=null}if(typeof n==`object`&&n)i=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else{let e=!1,o=Object.getOwnPropertyNames(t);for(let n of this.outputNames)if(o.indexOf(n)!==-1){let i=t[n];(i===null||i instanceof hp)&&(e=!0,a=!1,r[n]=i)}if(e){if(typeof n==`object`&&n)i=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else i=t}}else if(typeof t<`u`)throw TypeError(`Unexpected argument[1]: must be 'fetches' or 'options'.`);for(let t of this.inputNames)if(typeof e[t]>`u`)throw Error(`input '${t}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)r[e]=null;let o=await this.handler.run(e,r,i),s={};for(let e in o)if(Object.hasOwnProperty.call(o,e)){let t=o[e];s[e]=t instanceof hp?t:new hp(t.type,t.data,t.dims)}return Sp(`InferenceSession.run`),bp(),s}async release(){return this.handler.dispose()}static async create(t,n,r,i){yp(),xp(`InferenceSession.create`);let a,o={};if(typeof t==`string`){if(a=t,typeof n==`object`&&n)o=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else if(t instanceof Uint8Array){if(a=t,typeof n==`object`&&n)o=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer){let e=t,s=0,c=t.byteLength;if(typeof n==`object`&&n)o=n;else if(typeof n==`number`){if(s=n,!Number.isSafeInteger(s))throw RangeError(`'byteOffset' must be an integer.`);if(s<0||s>=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(c=t.byteLength-s,typeof r==`number`){if(c=r,!Number.isSafeInteger(c))throw RangeError(`'byteLength' must be an integer.`);if(c<=0||s+c>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-s}].`);if(typeof i==`object`&&i)o=i;else if(typeof i<`u`)throw TypeError(`'options' must be an object.`)}else if(typeof r<`u`)throw TypeError(`'byteLength' must be a number.`)}else if(typeof n<`u`)throw TypeError(`'options' must be an object.`);a=new Uint8Array(e,s,c)}else throw TypeError(`Unexpected argument[0]: must be 'path' or 'buffer'.`);let[s,c]=await Vf(o),l=await s.createInferenceSessionHandler(a,c);return Sp(`InferenceSession.create`),bp(),new e(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Ep,Dp=q(()=>{"use strict";Tp(),Ep=wp}),Op=q(()=>{"use strict";}),kp=q(()=>{"use strict";}),Ap=q(()=>{"use strict";}),jp=q(()=>{"use strict";}),Mp={};Pf(Mp,{InferenceSession:()=>Ep,TRACE:()=>_p,TRACE_EVENT_BEGIN:()=>xp,TRACE_EVENT_END:()=>Sp,TRACE_FUNC_BEGIN:()=>yp,TRACE_FUNC_END:()=>bp,Tensor:()=>hp,env:()=>Y,registerBackend:()=>zf});var Np=q(()=>{"use strict";Uf(),Jf(),Dp(),gp(),Op(),kp(),Cp(),Ap(),jp()}),Pp=q(()=>{"use strict";}),Fp={};Pf(Fp,{default:()=>Rp});var Ip,Lp,Rp,zp=q(()=>{"use strict";Km(),lm(),em(),Ip=`ort-wasm-proxy-worker`,Lp=globalThis.self?.name===Ip,Lp&&(self.onmessage=e=>{let{type:t,in:n}=e.data;try{switch(t){case`init-wasm`:cm(n.wasm).then(()=>{Pm(n).then(()=>{postMessage({type:t})},e=>{postMessage({type:t,err:e})})},e=>{postMessage({type:t,err:e})});break;case`init-ep`:{let{epName:e,env:r}=n;Fm(r,e).then(()=>{postMessage({type:t})},e=>{postMessage({type:t,err:e})});break}case`copy-from`:{let{buffer:e}=n,r=zm(e);postMessage({type:t,out:r});break}case`create`:{let{model:e,options:r}=n;Bm(e,r).then(e=>{postMessage({type:t,out:e})},e=>{postMessage({type:t,err:e})});break}case`release`:Vm(n),postMessage({type:t});break;case`run`:{let{sessionId:e,inputIndices:r,inputs:i,outputIndices:a,options:o}=n;Um(e,r,i,a,Array(a.length).fill(null),o).then(e=>{e.some(e=>e[3]!==`cpu`)?postMessage({type:t,err:`Proxy does not support non-cpu tensor location.`}):postMessage({type:t,out:e},Gm([...i,...e]))},e=>{postMessage({type:t,err:e})});break}case`end-profiling`:Wm(n),postMessage({type:t})}}catch(e){postMessage({type:t,err:e})}}),Rp=Lp?null:e=>new Worker(e??Up,{type:`module`,name:Ip})}),Bp,Vp,Hp,Up,Wp,Gp,Kp,qp,Jp,Yp,Xp,Zp,Qp,$p,em=q(()=>{"use strict";Pp(),Bp=typeof location>`u`?void 0:location.origin,Vp={}.url>`file:`&&{}.url<`file;`,Hp=()=>Vp?new URL(new URL(`ort.wasm.min.mjs`,{}.url).href,Bp).href:{}.url,Up=Hp(),Wp=()=>{if(Up&&!Up.startsWith(`blob:`))return Up.substring(0,Up.lastIndexOf(`/`)+1)},Gp=(e,t)=>{try{let n=t??Up;return(n?new URL(e,n):new URL(e)).origin===Bp}catch{return!1}},Kp=(e,t)=>{let n=t??Up;try{return(n?new URL(e,n):new URL(e)).href}catch{return}},qp=(e,t)=>`${t??`./`}${e}`,Jp=async e=>{let t=await(await fetch(e,{credentials:`same-origin`})).blob();return URL.createObjectURL(t)},Yp=async e=>(await import(e)).default,Xp=(zp(),If(Fp)).default,Zp=async()=>{if(!Up)throw Error(`Failed to load proxy worker: cannot determine the script source URL.`);if(Gp(Up))return[void 0,Xp()];let e=await Jp(Up);return[e,Xp(e)]},Qp=void 0,$p=async(e,t,n,r)=>{let i=Qp&&!(e||t);if(i){if(Up)i=Gp(Up)||r&&!n;else if(r&&!n)i=!0;else throw Error(`cannot determine the script source URL.`)}if(i)return[void 0,Qp];{let r=`ort-wasm-simd-threaded.mjs`,i=e??Kp(r,t),a=n&&i&&!Gp(i,t),o=a?await Jp(i):i??qp(r,t);return[a?o:void 0,await Yp(o)]}}}),tm,nm,rm,im,am,om,sm,cm,X,lm=q(()=>{"use strict";em(),nm=!1,rm=!1,im=!1,am=()=>{if(typeof SharedArrayBuffer>`u`)return!1;try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},om=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},sm=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},cm=async e=>{if(nm)return Promise.resolve();if(rm)throw Error(`multiple calls to 'initializeWebAssembly()' detected.`);if(im)throw Error(`previous call to 'initializeWebAssembly()' failed.`);rm=!0;let t=e.initTimeout,n=e.numThreads;if(e.simd!==!1){if(e.simd===`relaxed`){if(!sm())throw Error(`Relaxed WebAssembly SIMD is not supported in the current environment.`)}else if(!om())throw Error(`WebAssembly SIMD is not supported in the current environment.`)}let r=am();n>1&&!r&&(typeof self<`u`&&!self.crossOriginIsolated&&console.warn(`env.wasm.numThreads is set to `+n+`, but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info.`),console.warn(`WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading.`),e.numThreads=n=1);let i=e.wasmPaths,a=typeof i==`string`?i:void 0,o=i?.mjs,s=o?.href??o,c=i?.wasm,l=c?.href??c,u=e.wasmBinary,[d,f]=await $p(s,a,n>1,!!u||!!l),p=!1,m=[];if(t>0&&m.push(new Promise(e=>{setTimeout(()=>{p=!0,e()},t)})),m.push(new Promise((e,t)=>{let r={numThreads:n};if(u)r.wasmBinary=u,r.locateFile=e=>e;else if(l||a)r.locateFile=e=>l??a+e;else if(s&&s.indexOf(`blob:`)!==0)r.locateFile=e=>new URL(e,s).href;else if(d){let e=Wp();e&&(r.locateFile=t=>e+t)}f(r).then(t=>{rm=!1,nm=!0,tm=t,e(),d&&URL.revokeObjectURL(d)},e=>{rm=!1,im=!0,t(e)})})),await Promise.race(m),p)throw Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},X=()=>{if(nm&&tm)return tm;throw Error(`WebAssembly is not initialized yet.`)}}),um,dm,Z,fm=q(()=>{"use strict";lm(),um=(e,t)=>{let n=X(),r=n.lengthBytesUTF8(e)+1,i=n._malloc(r);return n.stringToUTF8(e,i,r),t.push(i),i},dm=(e,t,n,r)=>{if(typeof e==`object`&&e){if(n.has(e))throw Error(`Circular reference in options`);n.add(e)}Object.entries(e).forEach(([e,i])=>{let a=t?t+e:e;if(typeof i==`object`)dm(i,a+`.`,n,r);else if(typeof i==`string`||typeof i==`number`)r(a,i.toString());else if(typeof i==`boolean`)r(a,i?`1`:`0`);else throw Error(`Can't handle extra config type: ${typeof i}`)})},Z=e=>{let t=X(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetLastError(r,r+n);let i=Number(t.getValue(r,n===4?`i32`:`i64`)),a=t.getValue(r+n,`*`),o=a?t.UTF8ToString(a):``;throw Error(`${e} ERROR_CODE: ${i}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(n)}}}),pm,mm=q(()=>{"use strict";lm(),fm(),pm=e=>{let t=X(),n=0,r=[],i=e||{};try{if(e?.logSeverityLevel===void 0)i.logSeverityLevel=2;else if(typeof e.logSeverityLevel!=`number`||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)i.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!=`number`||!Number.isInteger(e.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(i.terminate=!1);let a=0;return e?.tag!==void 0&&(a=um(e.tag,r)),n=t._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,a),n===0&&Z(`Can't create run options.`),e?.extra!==void 0&&dm(e.extra,``,new WeakSet,(e,i)=>{let a=um(e,r),o=um(i,r);t._OrtAddRunConfigEntry(n,a,o)!==0&&Z(`Can't set a run config entry: ${e} - ${i}.`)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseRunOptions(n),r.forEach(e=>t._free(e)),e}}}),hm,gm,_m,vm,ym,bm,xm=q(()=>{"use strict";lm(),fm(),hm=e=>{switch(e){case`disabled`:return 0;case`basic`:return 1;case`extended`:return 2;case`layout`:return 3;case`all`:return 99;default:throw Error(`unsupported graph optimization level: ${e}`)}},gm=e=>{switch(e){case`sequential`:return 0;case`parallel`:return 1;default:throw Error(`unsupported execution mode: ${e}`)}},_m=e=>{e.extra||={},e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||=`1`,e.executionProviders&&e.executionProviders.some(e=>(typeof e==`string`?e:e.name)===`webgpu`)&&(e.enableMemPattern=!1)},vm=(e,t,n,r)=>{let i=um(t,r),a=um(n,r);X()._OrtAddSessionConfigEntry(e,i,a)!==0&&Z(`Can't set a session config entry: ${t} - ${n}.`)},ym=async(e,t,n)=>{let r=t.executionProviders;for(let t of r){let r=typeof t==`string`?t:t.name,i=[];switch(r){case`webnn`:if(r=`WEBNN`,vm(e,`session.disable_quant_qdq`,`1`,n),vm(e,`session.disable_qdq_constant_folding`,`1`,n),typeof t!=`string`){let r=t?.deviceType;r&&vm(e,`deviceType`,r,n)}break;case`webgpu`:if(r=`JS`,typeof t!=`string`){let r=t;if(r?.preferredLayout){if(r.preferredLayout!==`NCHW`&&r.preferredLayout!==`NHWC`)throw Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${r.preferredLayout}`);vm(e,`preferredLayout`,r.preferredLayout,n)}}break;case`wasm`:case`cpu`:continue;default:throw Error(`not supported execution provider: ${r}`)}let a=um(r,n),o=i.length,s=0,c=0;if(o>0){s=X()._malloc(o*X().PTR_SIZE),n.push(s),c=X()._malloc(o*X().PTR_SIZE),n.push(c);for(let e=0;e<o;e++)X().setValue(s+e*X().PTR_SIZE,i[e][0],`*`),X().setValue(c+e*X().PTR_SIZE,i[e][1],`*`)}await X()._OrtAppendExecutionProvider(e,a,s,c,o)!==0&&Z(`Can't append execution provider: ${r}.`)}},bm=async e=>{let t=X(),n=0,r=[],i=e||{};_m(i);try{let e=hm(i.graphOptimizationLevel??`all`),a=gm(i.executionMode??`sequential`),o=typeof i.logId==`string`?um(i.logId,r):0,s=i.logSeverityLevel??2;if(!Number.isInteger(s)||s<0||s>4)throw Error(`log severity level is not valid: ${s}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw Error(`log verbosity level is not valid: ${c}`);let l=typeof i.optimizedModelFilePath==`string`?um(i.optimizedModelFilePath,r):0;if(n=t._OrtCreateSessionOptions(e,!!i.enableCpuMemArena,!!i.enableMemPattern,a,!!i.enableProfiling,0,o,s,c,l),n===0&&Z(`Can't create session options.`),i.executionProviders&&await ym(n,i,r),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!=`boolean`)throw Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);vm(n,`enableGraphCapture`,i.enableGraphCapture.toString(),r)}if(i.freeDimensionOverrides)for(let[e,a]of Object.entries(i.freeDimensionOverrides)){if(typeof e!=`string`)throw Error(`free dimension override name must be a string: ${e}`);if(typeof a!=`number`||!Number.isInteger(a)||a<0)throw Error(`free dimension override value must be a non-negative integer: ${a}`);let i=um(e,r);t._OrtAddFreeDimensionOverride(n,i,a)!==0&&Z(`Can't set a free dimension override: ${e} - ${a}.`)}return i.extra!==void 0&&dm(i.extra,``,new WeakSet,(e,t)=>{vm(n,e,t,r)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseSessionOptions(n)!==0&&Z(`Can't release session options.`),r.forEach(e=>t._free(e)),e}}}),Sm,Cm,wm,Tm,Em,Dm,Om,km,Am=q(()=>{"use strict";Sm=e=>{switch(e){case`int8`:return 3;case`uint8`:return 2;case`bool`:return 9;case`int16`:return 5;case`uint16`:return 4;case`int32`:return 6;case`uint32`:return 12;case`float16`:return 10;case`float32`:return 1;case`float64`:return 11;case`string`:return 8;case`int64`:return 7;case`uint64`:return 13;case`int4`:return 22;case`uint4`:return 21;default:throw Error(`unsupported data type: ${e}`)}},Cm=e=>{switch(e){case 3:return`int8`;case 2:return`uint8`;case 9:return`bool`;case 5:return`int16`;case 4:return`uint16`;case 6:return`int32`;case 12:return`uint32`;case 10:return`float16`;case 1:return`float32`;case 11:return`float64`;case 8:return`string`;case 7:return`int64`;case 13:return`uint64`;case 22:return`int4`;case 21:return`uint4`;default:throw Error(`unsupported data type: ${e}`)}},wm=(e,t)=>{let n=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],r=typeof t==`number`?t:t.reduce((e,t)=>e*t,1);return n>0?Math.ceil(r*n):void 0},Tm=e=>{switch(e){case`float16`:return typeof Float16Array<`u`?Float16Array:Uint16Array;case`float32`:return Float32Array;case`uint8`:return Uint8Array;case`int8`:return Int8Array;case`uint16`:return Uint16Array;case`int16`:return Int16Array;case`int32`:return Int32Array;case`bool`:return Uint8Array;case`float64`:return Float64Array;case`uint32`:return Uint32Array;case`int64`:return BigInt64Array;case`uint64`:return BigUint64Array;default:throw Error(`unsupported type: ${e}`)}},Em=e=>{switch(e){case`verbose`:return 0;case`info`:return 1;case`warning`:return 2;case`error`:return 3;case`fatal`:return 4;default:throw Error(`unsupported logging level: ${e}`)}},Dm=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,Om=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint64`||e===`int8`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,km=e=>{switch(e){case`none`:return 0;case`cpu`:return 1;case`cpu-pinned`:return 2;case`texture`:return 3;case`gpu-buffer`:return 4;case`ml-tensor`:return 5;default:throw Error(`unsupported data location: ${e}`)}}}),jm,Mm=q(()=>{"use strict";Pp(),jm=async e=>{if(typeof e==`string`){let t=await fetch(e);if(!t.ok)throw Error(`failed to load external data file: ${e}`);let n=t.headers.get(`Content-Length`),r=n?parseInt(n,10):0;if(r<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw Error(`failed to load external data file: ${e}, no response body.`);let n=t.body.getReader(),i;try{i=new ArrayBuffer(r)}catch(e){if(e instanceof RangeError){let e=Math.ceil(r/65536);i=new WebAssembly.Memory({initial:e,maximum:e}).buffer}else throw e}let a=0;for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=t.byteLength;new Uint8Array(i,a,r).set(t),a+=r}return new Uint8Array(i,0,r)}}return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),Nm,Pm,Fm,Im,Lm,Rm,zm,Bm,Vm,Hm,Um,Wm,Gm,Km=q(()=>{"use strict";Np(),mm(),xm(),Am(),lm(),fm(),Mm(),Nm=(e,t)=>{X()._OrtInit(e,t)!==0&&Z(`Can't initialize onnxruntime.`)},Pm=async e=>{Nm(e.wasm.numThreads,Em(e.logLevel))},Fm=async(e,t)=>{X().asyncInit?.();let n=e.webgpu.adapter;if(t===`webgpu`){if(typeof navigator>`u`||!navigator.gpu)throw Error(`WebGPU is not supported in current environment`);if(n){if(typeof n.limits!=`object`||typeof n.features!=`object`||typeof n.requestDevice!=`function`)throw Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let t=e.webgpu.powerPreference;if(t!==void 0&&t!==`low-power`&&t!==`high-performance`)throw Error(`Invalid powerPreference setting: "${t}"`);let r=e.webgpu.forceFallbackAdapter;if(r!==void 0&&typeof r!=`boolean`)throw Error(`Invalid forceFallbackAdapter setting: "${r}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:t,forceFallbackAdapter:r}),!n)throw Error(`Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.`)}}if(t===`webnn`&&(typeof navigator>`u`||!navigator.ml))throw Error(`WebNN is not supported in current environment`)},Im=new Map,Lm=e=>{let t=X(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetInputOutputCount(e,r,r+n)!==0&&Z(`Can't get session input/output count.`);let i=n===4?`i32`:`i64`;return[Number(t.getValue(r,i)),Number(t.getValue(r+n,i))]}finally{t.stackRestore(n)}},Rm=(e,t)=>{let n=X(),r=n.stackSave(),i=0;try{let r=n.PTR_SIZE,a=n.stackAlloc(2*r);n._OrtGetInputOutputMetadata(e,t,a,a+r)!==0&&Z(`Can't get session input/output metadata.`);let o=Number(n.getValue(a,`*`));i=Number(n.getValue(a+r,`*`));let s=n.HEAP32[i/4];if(s===0)return[o,0];let c=n.HEAPU32[i/4+1],l=[];for(let e=0;e<c;e++){let t=Number(n.getValue(i+8+e*r,`*`));l.push(t===0?Number(n.getValue(i+8+(e+c)*r,`*`)):n.UTF8ToString(t))}return[o,s,l]}finally{n.stackRestore(r),i!==0&&n._OrtFree(i)}},zm=e=>{let t=X(),n=t._malloc(e.byteLength);if(n===0)throw Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return t.HEAPU8.set(e,n),[n,e.byteLength]},Bm=async(e,t)=>{let n,r,i=X();Array.isArray(e)?[n,r]=e:e.buffer===i.HEAPU8.buffer?[n,r]=[e.byteOffset,e.byteLength]:[n,r]=zm(e);let a=0,o=0,s=[],c=[],l=[];try{if([o,s]=await bm(t),t?.externalData&&i.mountExternalData){let e=[];for(let n of t.externalData){let t=typeof n==`string`?n:n.path,r=typeof n==`string`?n:n.data;e.push(jm(r).then(e=>{i.mountExternalData(t,e)}))}await Promise.all(e)}for(let e of t?.executionProviders??[])if((typeof e==`string`?e:e.name)===`webnn`){if(i.shouldTransferToMLTensor=!1,typeof e!=`string`){let t=e,n=t?.context,r=t?.gpuDevice,a=t?.deviceType,o=t?.powerPreference;i.currentContext=n||(r?await i.webnnCreateMLContext(r):await i.webnnCreateMLContext({deviceType:a,powerPreference:o}))}else i.currentContext=await i.webnnCreateMLContext();break}a=await i._OrtCreateSession(n,r,o),i.webgpuOnCreateSession?.(a),a===0&&Z(`Can't create a session.`),i.jsepOnCreateSession?.(),i.currentContext&&(i.webnnRegisterMLContext(a,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[e,u]=Lm(a),d=!!t?.enableGraphCapture,f=[],p=[],m=[],h=[];for(let t=0;t<e;t++){let[e,n,r]=Rm(a,t);e===0&&Z(`Can't get an input name.`),c.push(e);let o=i.UTF8ToString(e);f.push(o),m.push(n===0?{name:o,isTensor:!1}:{name:o,isTensor:!0,type:Cm(n),shape:r})}for(let t=0;t<u;t++){let[n,r,o]=Rm(a,t+e);n===0&&Z(`Can't get an output name.`),l.push(n);let s=i.UTF8ToString(n);p.push(s),h.push(r===0?{name:s,isTensor:!1}:{name:s,isTensor:!0,type:Cm(r),shape:o})}return Im.set(a,[a,c,l,null,d,!1]),[a,f,p,m,h]}catch(e){throw c.forEach(e=>i._OrtFree(e)),l.forEach(e=>i._OrtFree(e)),a!==0&&i._OrtReleaseSession(a)!==0&&Z(`Can't release session.`),e}finally{i._free(n),o!==0&&i._OrtReleaseSessionOptions(o)!==0&&Z(`Can't release session options.`),s.forEach(e=>i._free(e)),i.unmountExternalData?.()}},Vm=e=>{let t=X(),n=Im.get(e);if(!n)throw Error(`cannot release session. invalid session id: ${e}`);let[r,i,a,o,s]=n;o&&(s&&t._OrtClearBoundOutputs(o.handle)!==0&&Z(`Can't clear bound outputs.`),t._OrtReleaseBinding(o.handle)!==0&&Z(`Can't release IO binding.`)),t.jsepOnReleaseSession?.(e),t.webnnOnReleaseSession?.(e),t.webgpuOnReleaseSession?.(e),i.forEach(e=>t._OrtFree(e)),a.forEach(e=>t._OrtFree(e)),t._OrtReleaseSession(r)!==0&&Z(`Can't release session.`),Im.delete(e)},Hm=async(e,t,n,r,i,a,o=!1)=>{if(!e){t.push(0);return}let s=X(),c=s.PTR_SIZE,l=e[0],u=e[1],d=e[3],f=d,p,m;if(l===`string`&&(d===`gpu-buffer`||d===`ml-tensor`))throw Error(`String tensor is not supported on GPU.`);if(o&&d!==`gpu-buffer`)throw Error(`External buffer must be provided for input/output index ${a} when enableGraphCapture is true.`);if(d===`gpu-buffer`){let t=e[2].gpuBuffer;m=wm(Sm(l),u);{let e=s.jsepRegisterBuffer;if(!e)throw Error(`Tensor location "gpu-buffer" is not supported without using WebGPU.`);p=e(r,a,t,m)}}else if(d===`ml-tensor`){let t=e[2].mlTensor;m=wm(Sm(l),u);let n=s.webnnRegisterMLTensor;if(!n)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);p=n(r,t,Sm(l),u)}else{let t=e[2];if(Array.isArray(t)){m=c*t.length,p=s._malloc(m),n.push(p);for(let e=0;e<t.length;e++){if(typeof t[e]!=`string`)throw TypeError(`tensor data at index ${e} is not a string`);s.setValue(p+e*c,um(t[e],n),`*`)}}else{let e=s.webnnIsGraphInput,a=s.webnnIsGraphOutput;if(l!==`string`&&e&&a){let o=s.UTF8ToString(i);if(e(r,o)||a(r,o)){let e=Sm(l);m=wm(e,u),f=`ml-tensor`;let n=s.webnnCreateTemporaryTensor,i=s.webnnUploadTensor;if(!n||!i)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);let a=await n(r,e,u);i(a,new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),p=a}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}}let h=s.stackSave(),g=s.stackAlloc(4*u.length);try{u.forEach((e,t)=>s.setValue(g+t*c,e,c===4?`i32`:`i64`));let e=s._OrtCreateTensor(Sm(l),p,m,g,u.length,km(f));e===0&&Z(`Can't create tensor for input/output. session=${r}, index=${a}.`),t.push(e)}finally{s.stackRestore(h)}},Um=async(e,t,n,r,i,a)=>{let o=X(),s=o.PTR_SIZE,c=Im.get(e);if(!c)throw Error(`cannot run inference. invalid session id: ${e}`);let l=c[0],u=c[1],d=c[2],f=c[3],p=c[4];c[5];let m=t.length,h=r.length,g=0,_=[],v=[],y=[],b=[],x=[],S=o.stackSave(),C=o.stackAlloc(m*s),w=o.stackAlloc(m*s),T=o.stackAlloc(h*s),ee=o.stackAlloc(h*s);try{[g,_]=pm(a),xp(`wasm prepareInputOutputTensor`);for(let r=0;r<m;r++)await Hm(n[r],v,b,e,u[t[r]],t[r],p);for(let t=0;t<h;t++)await Hm(i[t],y,b,e,d[r[t]],m+r[t],p);Sp(`wasm prepareInputOutputTensor`);for(let e=0;e<m;e++)o.setValue(C+e*s,v[e],`*`),o.setValue(w+e*s,u[t[e]],`*`);for(let e=0;e<h;e++)o.setValue(T+e*s,y[e],`*`),o.setValue(ee+e*s,d[r[e]],`*`);o.jsepOnRunStart?.(l),o.webnnOnRunStart?.(l);let c;c=await o._OrtRun(l,w,C,m,ee,h,T,g),c!==0&&Z(`failed to call OrtRun().`);let S=[],te=[];xp(`wasm ProcessOutputTensor`);for(let t=0;t<h;t++){let n=Number(o.getValue(T+t*s,`*`));if(n===y[t]||x.includes(y[t])){S.push(i[t]),n!==y[t]&&o._OrtReleaseTensor(n)!==0&&Z(`Can't release tensor.`);continue}let a=o.stackSave(),c=o.stackAlloc(4*s),l=!1,u,d=0;try{o._OrtGetTensorData(n,c,c+s,c+2*s,c+3*s)!==0&&Z(`Can't access output tensor data on index ${t}.`);let i=s===4?`i32`:`i64`,a=Number(o.getValue(c,i));d=o.getValue(c+s,`*`);let p=o.getValue(c+s*2,`*`),m=Number(o.getValue(c+s*3,i)),h=[];for(let e=0;e<m;e++)h.push(Number(o.getValue(p+e*s,i)));o._OrtFree(p)!==0&&Z(`Can't free memory for tensor dims.`);let g=h.reduce((e,t)=>e*t,1);u=Cm(a);let _=f?.outputPreferredLocations[r[t]];if(u===`string`){if(_===`gpu-buffer`||_===`ml-tensor`)throw Error(`String tensor is not supported on GPU.`);let e=[];for(let t=0;t<g;t++){let n=o.getValue(d+t*s,`*`),r=o.getValue(d+(t+1)*s,`*`),i=t===g-1?void 0:r-n;e.push(o.UTF8ToString(n,i))}S.push([u,h,e,`cpu`])}else if(_===`gpu-buffer`&&g>0){let e=o.jsepGetBuffer;if(!e)throw Error(`preferredLocation "gpu-buffer" is not supported without using WebGPU.`);let t=e(d),r=wm(a,g);if(r===void 0||!Dm(u))throw Error(`Unsupported data type: ${u}`);l=!0,S.push([u,h,{gpuBuffer:t,download:o.jsepCreateDownloader(t,r,u),dispose:()=>{o._OrtReleaseTensor(n)!==0&&Z(`Can't release tensor.`)}},`gpu-buffer`])}else if(_===`ml-tensor`&&g>0){let t=o.webnnEnsureTensor,r=o.webnnIsGraphInputOutputTypeSupported;if(!t||!r)throw Error(`preferredLocation "ml-tensor" is not supported without using WebNN.`);if(wm(a,g)===void 0||!Om(u))throw Error(`Unsupported data type: ${u}`);if(!r(e,u,!1))throw Error(`preferredLocation "ml-tensor" for ${u} output is not supported by current WebNN Context.`);let i=await t(e,d,a,h,!1);l=!0,S.push([u,h,{mlTensor:i,download:o.webnnCreateMLTensorDownloader(d,u),dispose:()=>{o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n)}},`ml-tensor`])}else if(_===`ml-tensor-cpu-output`&&g>0){let e=o.webnnCreateMLTensorDownloader(d,u)(),t=S.length;l=!0,te.push((async()=>{let r=[t,await e];return o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n),r})()),S.push([u,h,[],`cpu`])}else{let e=new(Tm(u))(g);new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o.HEAPU8.subarray(d,d+e.byteLength)),S.push([u,h,e,`cpu`])}}finally{o.stackRestore(a),u===`string`&&d&&o._free(d),l||o._OrtReleaseTensor(n)}}f&&!p&&(o._OrtClearBoundOutputs(f.handle)!==0&&Z(`Can't clear bound outputs.`),Im.set(e,[l,u,d,f,p,!1]));for(let[e,t]of await Promise.all(te))S[e][2]=t;return Sp(`wasm ProcessOutputTensor`),S}finally{o.webnnOnRunEnd?.(l),o.stackRestore(S),v.forEach(e=>o._OrtReleaseTensor(e)),y.forEach(e=>o._OrtReleaseTensor(e)),b.forEach(e=>o._free(e)),g!==0&&o._OrtReleaseRunOptions(g),_.forEach(e=>o._free(e))}},Wm=e=>{let t=X(),n=Im.get(e);if(!n)throw Error(`invalid session id`);let r=n[0],i=t._OrtEndProfiling(r);i===0&&Z(`Can't get an profile file name.`),t._OrtFree(i)},Gm=e=>{let t=[];for(let n of e){let e=n[2];!Array.isArray(e)&&`buffer`in e&&t.push(e.buffer)}return t}}),qm,Jm,Ym,Xm,Zm,Qm,$m,eh,th,nh,rh,ih,ah,oh,sh,ch,lh,uh,dh=q(()=>{"use strict";Np(),Km(),lm(),em(),qm=()=>!!Y.wasm.proxy&&typeof document<`u`,Ym=!1,Xm=!1,Zm=!1,eh=new Map,th=(e,t)=>{let n=eh.get(e);n?n.push(t):eh.set(e,[t])},nh=()=>{if(Ym||!Xm||Zm||!Jm)throw Error(`worker not ready`)},rh=e=>{switch(e.data.type){case`init-wasm`:Ym=!1,e.data.err?(Zm=!0,$m[1](e.data.err)):(Xm=!0,$m[0]()),Qm&&=(URL.revokeObjectURL(Qm),void 0);break;case`init-ep`:case`copy-from`:case`create`:case`release`:case`run`:case`end-profiling`:{let t=eh.get(e.data.type);e.data.err?t.shift()[1](e.data.err):t.shift()[0](e.data.out);break}}},ih=async()=>{if(!Xm){if(Ym)throw Error(`multiple calls to 'initWasm()' detected.`);if(Zm)throw Error(`previous call to 'initWasm()' failed.`);if(Ym=!0,qm())return new Promise((e,t)=>{Jm?.terminate(),Zp().then(([n,r])=>{try{Jm=r,Jm.onerror=e=>t(e),Jm.onmessage=rh,$m=[e,t];let i={type:`init-wasm`,in:Y};if(!i.in.wasm.wasmPaths&&n){let e=Wp();e&&(i.in.wasm.wasmPaths=e)}Jm.postMessage(i),Qm=n}catch(e){t(e)}},t)});try{await cm(Y.wasm),await Pm(Y),Xm=!0}catch(e){throw Zm=!0,e}finally{Ym=!1}}},ah=async e=>{if(qm())return nh(),new Promise((t,n)=>{th(`init-ep`,[t,n]);let r={type:`init-ep`,in:{epName:e,env:Y}};Jm.postMessage(r)});await Fm(Y,e)},oh=async e=>qm()?(nh(),new Promise((t,n)=>{th(`copy-from`,[t,n]);let r={type:`copy-from`,in:{buffer:e}};Jm.postMessage(r,[e.buffer])})):zm(e),sh=async(e,t)=>{if(qm()){if(t?.preferredOutputLocation)throw Error(`session option "preferredOutputLocation" is not supported for proxy.`);return nh(),new Promise((n,r)=>{th(`create`,[n,r]);let i={type:`create`,in:{model:e,options:{...t}}},a=[];e instanceof Uint8Array&&a.push(e.buffer),Jm.postMessage(i,a)})}return Bm(e,t)},ch=async e=>{if(qm())return nh(),new Promise((t,n)=>{th(`release`,[t,n]);let r={type:`release`,in:e};Jm.postMessage(r)});Vm(e)},lh=async(e,t,n,r,i,a)=>{if(qm()){if(n.some(e=>e[3]!==`cpu`))throw Error(`input tensor on GPU is not supported for proxy.`);if(i.some(e=>e))throw Error(`pre-allocated output tensor is not supported for proxy.`);return nh(),new Promise((i,o)=>{th(`run`,[i,o]);let s=n,c={type:`run`,in:{sessionId:e,inputIndices:t,inputs:s,outputIndices:r,options:a}};Jm.postMessage(c,Gm(s))})}return Um(e,t,n,r,i,a)},uh=async e=>{if(qm())return nh(),new Promise((t,n)=>{th(`end-profiling`,[t,n]);let r={type:`end-profiling`,in:e};Jm.postMessage(r)});Wm(e)}}),fh,ph,mh,hh=q(()=>{"use strict";Np(),dh(),Am(),Pp(),Mm(),fh=(e,t)=>{switch(e.location){case`cpu`:return[e.type,e.dims,e.data,`cpu`];case`gpu-buffer`:return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},`gpu-buffer`];case`ml-tensor`:return[e.type,e.dims,{mlTensor:e.mlTensor},`ml-tensor`];default:throw Error(`invalid data location: ${e.location} for ${t()}`)}},ph=e=>{switch(e[3]){case`cpu`:return new hp(e[0],e[2],e[1]);case`gpu-buffer`:{let t=e[0];if(!Dm(t))throw Error(`not supported data type: ${t} for deserializing GPU tensor`);let{gpuBuffer:n,download:r,dispose:i}=e[2];return hp.fromGpuBuffer(n,{dataType:t,dims:e[1],download:r,dispose:i})}case`ml-tensor`:{let t=e[0];if(!Om(t))throw Error(`not supported data type: ${t} for deserializing MLTensor tensor`);let{mlTensor:n,download:r,dispose:i}=e[2];return hp.fromMLTensor(n,{dataType:t,dims:e[1],download:r,dispose:i})}default:throw Error(`invalid data location: ${e[3]}`)}},mh=class{async fetchModelAndCopyToWasmMemory(e){return oh(await jm(e))}async loadModel(e,t){yp();let n;n=typeof e==`string`?await this.fetchModelAndCopyToWasmMemory(e):e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await sh(n,t),bp()}async dispose(){return ch(this.sessionId)}async run(e,t,n){yp();let r=[],i=[];Object.entries(e).forEach(e=>{let t=e[0],n=e[1],a=this.inputNames.indexOf(t);if(a===-1)throw Error(`invalid input '${t}'`);r.push(n),i.push(a)});let a=[],o=[];Object.entries(t).forEach(e=>{let t=e[0],n=e[1],r=this.outputNames.indexOf(t);if(r===-1)throw Error(`invalid output '${t}'`);a.push(n),o.push(r)});let s=r.map((e,t)=>fh(e,()=>`input "${this.inputNames[i[t]]}"`)),c=a.map((e,t)=>e?fh(e,()=>`output "${this.outputNames[o[t]]}"`):null),l=await lh(this.sessionId,i,s,o,c,n),u={};for(let e=0;e<l.length;e++)u[this.outputNames[o[e]]]=a[e]??ph(l[e]);return bp(),u}startProfiling(){}endProfiling(){uh(this.sessionId)}}}),gh={};Pf(gh,{OnnxruntimeWebAssemblyBackend:()=>vh,initializeFlags:()=>_h,wasmBackend:()=>yh});var _h,vh,yh,bh=q(()=>{"use strict";Np(),dh(),hh(),_h=()=>{(typeof Y.wasm.initTimeout!=`number`||Y.wasm.initTimeout<0)&&(Y.wasm.initTimeout=0);let e=Y.wasm.simd;if(typeof e!=`boolean`&&e!==void 0&&e!==`fixed`&&e!==`relaxed`&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),Y.wasm.simd=!1),typeof Y.wasm.proxy!=`boolean`&&(Y.wasm.proxy=!1),typeof Y.wasm.trace!=`boolean`&&(Y.wasm.trace=!1),typeof Y.wasm.numThreads!=`number`||!Number.isInteger(Y.wasm.numThreads)||Y.wasm.numThreads<=0){if(typeof self<`u`&&!self.crossOriginIsolated)Y.wasm.numThreads=1;else{let e=typeof navigator>`u`?Nf(`node:os`).cpus().length:navigator.hardwareConcurrency;Y.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}}},vh=class{async init(e){_h(),await ih(),await ah(e)}async createInferenceSessionHandler(e,t){let n=new mh;return await n.loadModel(e,t),n}},yh=new vh});Np(),Np(),Np();var xh=`1.30.0`,Sh=Mp;{let e=(bh(),If(gh)).wasmBackend;zf(`cpu`,e,10),zf(`wasm`,e,10)}Object.defineProperty(Y.versions,"web",{value:xh,enumerable:!0});var Ch=new Map,wh=!1,Th,Eh=Of,Dh=()=>[`wasm`],Oh=()=>globalThis.crossOriginIsolated&&!!globalThis.SharedArrayBuffer,kh=async()=>(wh||=(Eh.env.wasm.numThreads=+!Oh(),Eh.env.wasm.wasmPaths={mjs:fu({filename:`ort-wasm-simd-threaded.mjs`}),wasm:fu({filename:`ort-wasm-simd-threaded.wasm`})},!0),Eh),Ah=async({filename:e})=>{let t=Ch.get(e);try{return t||(t=(async()=>{let t=await(await kh()).InferenceSession.create(fu({filename:e}),{executionProviders:Dh(),extra:{session:{load_model_format:`ORT`}},graphOptimizationLevel:`disabled`});return{inputNames:t.inputNames,outputNames:t.outputNames,run:async e=>{let n=Th,r=Promise.withResolvers();Th=r.promise,await n;try{return await t.run(e)}finally{r.resolve(),Th===r.promise&&(Th=void 0)}}}})(),Ch.set(e,t)),await t}catch(n){throw t&&Ch.get(e)===t&&Ch.delete(e),Error(U.MODEL_LOAD_FAILED,{cause:n})}},jh=Of,Mh={environment:`browser`,createCanvas:(e,t)=>new OffscreenCanvas(e,t),createImageData:(e,t)=>new ImageData(e,t),createImageBitmap:(async(...e)=>{try{return await createImageBitmap(...e)}catch(e){throw Error(U.IMAGE_DECODE_FAILED,{cause:e})}}),session:Ah,tensor:(e,t,n)=>new jh.Tensor(e,t,n)};Tf({runtime:Mh});var Nh=Tf({runtime:Mh}),Ph=wf({runtime:Mh}),Fh=bf({runtime:Mh}),Ih=Cf({runtime:Mh,imageFromImageBitmap:Nh});Df({runtime:Mh,...Ph,...Fh,...Ih,faceDetection:Ih});var Q,Lh,Rh,zh,Bh=t((()=>{Q={INVALID_PDF:`INVALID_PDF`,PDF_PASSWORD_REQUIRED:`PDF_PASSWORD_REQUIRED`,PDF_LOAD_FAILED:`PDF_LOAD_FAILED`,CLIENT_KEY_REQUIRED:`CLIENT_KEY_REQUIRED`,CAMERA_INTERRUPTED:`CAMERA_INTERRUPTED`,CAMERA_NOT_FOUND:`CAMERA_NOT_FOUND`,CAMERA_PERMISSION_DENIED:`CAMERA_PERMISSION_DENIED`,CAMERA_UNAVAILABLE:`CAMERA_UNAVAILABLE`,CAMERA_UNSUPPORTED:`CAMERA_UNSUPPORTED`,CAPTURES_INCOMPLETE:`CAPTURES_INCOMPLETE`,DOCUMENT_BACK_CONTAINS_FACE:`DOCUMENT_BACK_CONTAINS_FACE`,DOCUMENT_BACK_NOT_DISTINCT:`DOCUMENT_BACK_NOT_DISTINCT`,DOCUMENT_BACK_REQUIRED:`DOCUMENT_BACK_REQUIRED`,DOCUMENT_BLURRY:`DOCUMENT_BLURRY`,DOCUMENT_FACE_GEOMETRY_INVALID:`DOCUMENT_FACE_GEOMETRY_INVALID`,DOCUMENT_FACE_NOT_CONTAINED:`DOCUMENT_FACE_NOT_CONTAINED`,DOCUMENT_FACE_NOT_FOUND:`DOCUMENT_FACE_NOT_FOUND`,DOCUMENT_NOT_FOUND:`DOCUMENT_NOT_FOUND`,DOCUMENT_NOT_RECOGNIZED:`DOCUMENT_NOT_RECOGNIZED`,DOCUMENT_TEXT_ALIGNMENT_INVALID:`DOCUMENT_TEXT_ALIGNMENT_INVALID`,DOCUMENT_TEXT_NOT_READABLE:`DOCUMENT_TEXT_NOT_READABLE`,DOCUMENT_VALIDATION_FAILED:`DOCUMENT_VALIDATION_FAILED`,FACEKEY_TOKEN_INVALID:`FACEKEY_TOKEN_INVALID`,FACEGATE_TOKEN_INVALID:`FACEGATE_TOKEN_INVALID`,FACEGATE_ABORTED:`FACEGATE_ABORTED`,FACEGATE_TIMEOUT:`FACEGATE_TIMEOUT`,FACE_NOT_FOUND:`FACE_NOT_FOUND`,FACE_MISMATCH:`FACE_MISMATCH`,FACE_NOT_USABLE:`FACE_NOT_USABLE`,IMAGE_ENCODE_FAILED:`IMAGE_ENCODE_FAILED`,IMAGE_PROCESSING_FAILED:`IMAGE_PROCESSING_FAILED`,INVALID_IMAGE:`INVALID_IMAGE`,INVALID_MODEL_OUTPUT:`INVALID_MODEL_OUTPUT`,INVALID_OPTIONS:`INVALID_OPTIONS`,INVALID_POSES:`INVALID_POSES`,INVALID_CLIENT_KEY:`INVALID_CLIENT_KEY`,INVALID_SERVICE_RESPONSE:`INVALID_SERVICE_RESPONSE`,MODEL_LOAD_FAILED:`MODEL_LOAD_FAILED`,NETWORK_ERROR:`NETWORK_ERROR`,REQUEST_TOO_LARGE:`REQUEST_TOO_LARGE`,NO_USABLE_CANDIDATES:`NO_USABLE_CANDIDATES`,NO_USABLE_REFERENCES:`NO_USABLE_REFERENCES`,POSE_BACKGROUND_MISMATCH:`POSE_BACKGROUND_MISMATCH`,POSE_IDENTITY_MISMATCH:`POSE_IDENTITY_MISMATCH`,SERVICE_UNAVAILABLE:`SERVICE_UNAVAILABLE`,SDK_NOT_READY:`SDK_NOT_READY`,SDK_CAPABILITY_NOT_CONFIGURED:`SDK_CAPABILITY_NOT_CONFIGURED`,UI_ELEMENT_NOT_FOUND:`UI_ELEMENT_NOT_FOUND`,VERIFICATION_CANCELLED:`VERIFICATION_CANCELLED`,VERIFICATION_SAVE_FAILED:`VERIFICATION_SAVE_FAILED`},Lh=new Set(Object.values(Q)),Rh=e=>typeof e==`string`&&Lh.has(e),zh=({error:e,fallback:t=Q.INVALID_SERVICE_RESPONSE})=>typeof e==`object`&&e&&`code`in e&&Rh(e.code)?e.code:e instanceof Error&&Rh(e.message)?e.message:Rh(e)?e:t})),Vh,Hh,Uh,Wh,Gh,Kh,qh,Jh,Yh,Xh=t((()=>{Bh(),Vh=new WeakMap,Hh=async({video:e,signal:t})=>{t?.throwIfAborted();let n=Promise.withResolvers(),r=e,i=Vh.get(e)??new Set,a=null,o=null,s=!1,c=c=>{s||(s=!0,a!==null&&r.cancelVideoFrameCallback?.(a),o!==null&&cancelAnimationFrame(o),t?.removeEventListener(`abort`,u),i.delete(l),i.size||Vh.delete(e),c?n.reject(c):n.resolve())},l=()=>c(new DOMException(Q.VERIFICATION_CANCELLED,`AbortError`)),u=()=>c(new DOMException(Q.VERIFICATION_CANCELLED,`AbortError`));i.add(l),Vh.set(e,i),t?.addEventListener(`abort`,u,{once:!0}),r.requestVideoFrameCallback?a=r.requestVideoFrameCallback(()=>c()):o=requestAnimationFrame(()=>c()),await n.promise},Uh=()=>{let e=/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent),t=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return e||t},Wh=async()=>{let e=[],t=(t,n)=>{n||e.push(t)};if(t(`navigator.mediaDevices.getUserMedia`,typeof navigator.mediaDevices==`object`&&typeof navigator.mediaDevices.getUserMedia==`function`),t(`navigator.mediaDevices.enumerateDevices`,typeof navigator.mediaDevices==`object`&&typeof navigator.mediaDevices.enumerateDevices==`function`),t(`MediaStream`,typeof MediaStream<`u`),t(`MediaStreamTrack`,typeof MediaStreamTrack<`u`),t(`HTMLVideoElement`,typeof HTMLVideoElement<`u`),t(`createImageBitmap`,typeof createImageBitmap==`function`),t(`OffscreenCanvas`,typeof OffscreenCanvas<`u`),t(`OffscreenCanvas.getContext`,typeof OffscreenCanvas<`u`&&typeof OffscreenCanvas.prototype.getContext==`function`),t(`OffscreenCanvas.convertToBlob`,typeof OffscreenCanvas<`u`&&typeof OffscreenCanvas.prototype.convertToBlob==`function`),t(`WebAssembly`,typeof WebAssembly<`u`),t(`fetch`,typeof fetch==`function`),t(`Blob`,typeof Blob<`u`),t(`File`,typeof File<`u`),t(`URL.createObjectURL`,typeof URL.createObjectURL==`function`),t(`URL.revokeObjectURL`,typeof URL.revokeObjectURL==`function`),!e.includes(`OffscreenCanvas`)&&!e.includes(`OffscreenCanvas.getContext`)&&!e.includes(`OffscreenCanvas.convertToBlob`))try{let e=new OffscreenCanvas(1,1),n=e.getContext(`2d`);if(t(`OffscreenCanvas 2D context`,n!==null),n&&typeof createImageBitmap==`function`){let n=await e.convertToBlob({type:`image/jpeg`});t(`JPEG encoding`,n.type===`image/jpeg`),n.type===`image/jpeg`&&((await createImageBitmap(n)).close(),t(`JPEG decoding`,!0))}else t(`JPEG encoding`,!1),t(`JPEG decoding`,!1)}catch{e.includes(`JPEG encoding`)||t(`JPEG encoding`,!1),t(`JPEG decoding`,!1)}else t(`JPEG encoding`,!1),t(`JPEG decoding`,!1);return{supported:e.length===0,unsupportedFeatures:e}},Gh=({video:e})=>{for(let t of Vh.get(e)??[])t();let t=e.srcObject;if(t instanceof MediaStream)for(let e of t.getTracks())e.stop();e.srcObject=null},Kh=async({facingMode:e,video:t,signal:n})=>{if(!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!=`function`)throw Error(Q.CAMERA_UNSUPPORTED);let r={facingMode:{ideal:e}};Uh()||(r.width={ideal:1280},r.height={ideal:720});let i=()=>Gh({video:t});n?.addEventListener(`abort`,i,{once:!0});try{let i=await navigator.mediaDevices.getUserMedia({video:r,audio:!1});if(n?.aborted){for(let e of i.getTracks())e.stop();n.throwIfAborted()}t.srcObject=i;let a=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:e})=>e===`videoinput`).length>1?e:`user`;return await t.play(),n?.throwIfAborted(),a}catch(e){if(Gh({video:t}),n?.aborted)throw new DOMException(Q.VERIFICATION_CANCELLED,`AbortError`);let r=e instanceof Error?e.name:``,i=Q.CAMERA_UNAVAILABLE;throw(r===`NotAllowedError`||r===`SecurityError`)&&(i=Q.CAMERA_PERMISSION_DENIED),r===`NotFoundError`&&(i=Q.CAMERA_NOT_FOUND),r===`AbortError`&&(i=Q.CAMERA_INTERRUPTED),Error(i,{cause:e})}finally{n?.removeEventListener(`abort`,i)}},qh=async({canvas:e,quality:t})=>{try{let n=await e.convertToBlob({type:`image/jpeg`,quality:t});if(n.type!==`image/jpeg`)throw Error(Q.IMAGE_ENCODE_FAILED);return n}catch(e){throw Error(Q.IMAGE_ENCODE_FAILED,{cause:e})}},Jh=async({frame:e})=>{let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Error(Q.IMAGE_PROCESSING_FAILED);return n.drawImage(e,0,0),await qh({canvas:t})},Yh=async({image:e})=>{let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return`data:image/jpeg;base64,${btoa(n)}`}}));Xh();var Zh=({pitch:e,pose:t,requireEyeLevelCamera:n=!0,options:r})=>{if(!n||t!==`faceStraight`)return null;let i=Math.max(-8,r.minPitch),a=Math.min(8,r.maxPitch);return!Number.isFinite(e)||e<i||e>a?`FACE_CAMERA_ALIGNMENT_REQUIRED`:null},Qh=()=>Uh()?`alignPhoneWithFace`:`alignFaceWithWebcam`,$h,eg,tg=t((()=>{$h=({moduleUrl:e})=>{let t=globalThis;t.__VOLTOM_ASSET_BASE_URL__||=new URL(`../`,e).href},eg=({filename:e})=>{let t=globalThis.__VOLTOM_ASSET_BASE_URL__||globalThis.location?.href;if(!t)throw Error(`SDK_ASSET_BASE_URL_UNAVAILABLE`);return new URL(`assets/${e}`,t).href}})),ng,rg,ig,ag,og,sg,cg,lg,ug=t((()=>{tg(),Bh(),ng=[`ar`,`ch`,`de`,`en`,`es`,`fr`,`it`,`ja`,`pt`,`ru`,`zh`],rg=new Map,ig=new Map,ag=async({language:e})=>{if(rg.has(e))return;let t=ig.get(e);t||(t=fetch(eg({filename:`locales/${e}.json`})).then(async e=>{if(!e.ok)throw Error(Q.INVALID_SERVICE_RESPONSE);return await e.json()}),ig.set(e,t));try{rg.set(e,await t)}finally{ig.delete(e)}},og=async({language:e})=>{let t=e??sg();await Promise.all([ag({language:t}),...t===`en`?[]:[ag({language:`en`})]])},sg=()=>{let e=[navigator.language,...navigator.languages];for(let t of e){let e=t.toLowerCase();if(/^zh-(hk|mo|tw)\b/u.test(e))return`ch`;let n=e.split(`-`)[0];if(ng.includes(n))return n}return`en`},cg={[Q.CAMERA_PERMISSION_DENIED]:`cameraPermissionDenied`,[Q.CAMERA_NOT_FOUND]:`cameraNotFound`,[Q.CAMERA_UNAVAILABLE]:`cameraUnavailable`,[Q.CAMERA_UNSUPPORTED]:`cameraUnavailable`,[Q.CAMERA_INTERRUPTED]:`cameraUnavailable`,[Q.NETWORK_ERROR]:`networkError`,[Q.SERVICE_UNAVAILABLE]:`serviceUnavailable`,[Q.MODEL_LOAD_FAILED]:`modelLoadFailed`,[Q.FACE_NOT_FOUND]:`faceNotFound`,[Q.NO_USABLE_CANDIDATES]:`faceNotFound`,[Q.FACE_NOT_USABLE]:`faceNotUsable`,[Q.NO_USABLE_REFERENCES]:`faceNotUsable`,[Q.DOCUMENT_NOT_FOUND]:`frameDocument`,[Q.DOCUMENT_NOT_RECOGNIZED]:`invalidDocument`,[Q.DOCUMENT_TEXT_NOT_READABLE]:`documentNotReadable`,[Q.DOCUMENT_BLURRY]:`documentBlurry`,[Q.DOCUMENT_FACE_NOT_FOUND]:`faceNotVisibleInDocument`,[Q.DOCUMENT_FACE_NOT_CONTAINED]:`documentAlignmentInvalid`,[Q.DOCUMENT_FACE_GEOMETRY_INVALID]:`documentAlignmentInvalid`,[Q.DOCUMENT_TEXT_ALIGNMENT_INVALID]:`documentAlignmentInvalid`,[Q.DOCUMENT_BACK_REQUIRED]:`frameDocumentBack`,[Q.CAPTURES_INCOMPLETE]:`capturesIncomplete`,[Q.DOCUMENT_VALIDATION_FAILED]:`documentValidationFailed`,[Q.INVALID_OPTIONS]:`invalidOptions`,[Q.INVALID_POSES]:`invalidPoses`,[Q.INVALID_SERVICE_RESPONSE]:`invalidServiceResponse`,[Q.POSE_BACKGROUND_MISMATCH]:`poseBackgroundMismatch`,[Q.POSE_IDENTITY_MISMATCH]:`poseIdentityMismatch`,[Q.IMAGE_ENCODE_FAILED]:`imageEncodeFailed`,[Q.IMAGE_PROCESSING_FAILED]:`imageProcessingFailed`,[Q.INVALID_IMAGE]:`invalidImage`,[Q.INVALID_PDF]:`invalidPdf`,[Q.PDF_PASSWORD_REQUIRED]:`pdfPasswordRequired`,[Q.PDF_LOAD_FAILED]:`pdfLoadFailed`,[Q.CLIENT_KEY_REQUIRED]:`clientKeyRequired`,[Q.VERIFICATION_SAVE_FAILED]:`verificationSaveFailed`,[Q.FACEGATE_ABORTED]:`verificationCancelled`,[Q.VERIFICATION_CANCELLED]:`verificationCancelled`},lg=({language:e})=>{let t=e??sg(),n=e=>{let n=rg.get(t),r=rg.get(`en`);return n?.[e]??r?.[e]??e};return{translate:n,translateError:({error:e})=>{let t=zh({error:e}),r=cg[t]??`verificationFailed`;return n(r)}}}}));ug();var dg={facePoses:{faceStraight:{primary:`lookStraight`},faceUp:{primary:`lookUp`},faceDown:{primary:`lookDown`},faceLeft:{primary:`lookLeft`},faceRight:{primary:`lookRight`},faceSmile:{primary:`smile`},faceWinkLeft:{primary:`winkLeft`},faceTiltLeft:{primary:`tiltLeft`},faceTiltRight:{primary:`tiltRight`}},poseRejections:{FACE_ROLL_TILT_LEFT:`tiltLeft`,FACE_ROLL_TILT_RIGHT:`tiltRight`,FACE_ROLL_TILT_LESS:`tiltLess`,FACE_YAW_TURN_LEFT:`lookLeft`,FACE_YAW_TURN_RIGHT:`lookRight`,FACE_YAW_TURN_LESS:`turnLess`,FACE_PITCH_LOOK_UP:`lookUp`,FACE_PITCH_LOOK_DOWN:`lookDown`,FACE_PITCH_RAISE_LESS:`raiseLess`,FACE_PITCH_LOWER_LESS:`lowerLess`,FACE_SMILE_REQUIRED:`smile`,FACE_WINK_LEFT_REQUIRED:`winkLeft`,FACEKEY_LOWER_HEAD:`lookDown`,FACEKEY_LOWER_HEAD_LESS:`lowerLess`,FACEKEY_RAISE_HEAD:`lookUp`,FACEKEY_RAISE_HEAD_LESS:`raiseLess`,FACEKEY_SMILE_REQUIRED:`smile`,FACEKEY_TILT_HEAD_LEFT:`tiltLeft`,FACEKEY_TILT_HEAD_LESS:`tiltLess`,FACEKEY_TILT_HEAD_RIGHT:`tiltRight`,FACEKEY_TURN_HEAD_LEFT:`lookLeft`,FACEKEY_TURN_HEAD_LESS:`turnLess`,FACEKEY_TURN_HEAD_RIGHT:`lookRight`,FACEKEY_WINK_LEFT_REQUIRED:`winkLeft`}},fg=({pose:e})=>{let t=dg.facePoses[e];return{...t,primary:t.primary}},pg=({code:e})=>dg.poseRejections[e],mg=({pose:e})=>{let t=Ud[e];return t?.yaw===void 0?t?.pitch===void 0?t?.roll===void 0?e===`faceStraight`?{axis:`roll`,value:0}:{axis:null,value:null}:{axis:`roll`,value:t.roll}:{axis:`pitch`,value:t.pitch}:{axis:`yaw`,value:t.yaw}},hg=({alignment:e,neutral:t})=>t?{pitch:e.pitch-t.pitch,yaw:e.yaw-t.yaw,roll:e.roll-t.roll}:e,gg=({alignment:e,blendshapes:t,neutral:n,pose:r,options:i})=>{let a=hg({alignment:e,neutral:r===`faceStraight`?null:n}),o=rf({...e,blendshapes:t,pose:r,options:i});o===null&&r===`faceUp`&&n&&(o=rf({...e,pitch:a.pitch,blendshapes:t,pose:r,options:i}));let s=mg({pose:r}),c=s.axis&&s.value!==null?a[s.axis]-s.value:0,l=(i.tolerance??15)+8,u=o===null?`inside`:Math.abs(c)<=l?`approaching`:`outside`;return{pose:r,axis:s.axis,target:s.value,error:c,zone:u,code:o}},_g=({corrective:e,pose:t})=>{let n=fg({pose:t}).primary;return{primary:n,corrective:e&&e!==n?e:null}},vg=({pose:e,code:t})=>_g({pose:e,corrective:t?pg({code:t}):null}),yg=()=>({active:at(!1),phase:at(`idle`),prompt:at(``),completed:at(0),total:at(1),outcome:at(null),captures:at([])});Bh();var bg=e=>{if(typeof e.clientKey!=`string`||e.clientKey.length<8||e.requireEyeLevelCamera!==void 0&&typeof e.requireEyeLevelCamera!=`boolean`)throw Error(Q.INVALID_OPTIONS);return{...e,requireEyeLevelCamera:e.requireEyeLevelCamera??!1}},xg=e=>{if(typeof e.action!=`string`||e.action.length<1||e.action.length>255||typeof e.onPass!=`function`||typeof e.onReject!=`function`)throw Error(Q.INVALID_OPTIONS);return e},Sg=e=>{if(typeof e!=`string`||e.length<32||e.length>128)throw Error(Q.INVALID_SERVICE_RESPONSE);return e},Cg,wg=t((()=>{Cg=`[data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark;--theme-canvas:var(--lightningcss-light,#fafafa)var(--lightningcss-dark,#0b0b0b);--theme-surface:var(--lightningcss-light,#fff)var(--lightningcss-dark,#202020);--theme-surface-subtle:var(--lightningcss-light,#f5f5f5)var(--lightningcss-dark,#2c2c2c);--theme-text:var(--lightningcss-light,#121212)var(--lightningcss-dark,#f7f7f7);--theme-text-muted:var(--lightningcss-light,#626262)var(--lightningcss-dark,#a3a3a3);--theme-text-inverse:var(--lightningcss-light,#fafafa)var(--lightningcss-dark,#0b0b0b);--theme-border:var(--lightningcss-light,#bfbfbf)var(--lightningcss-dark,#606060);--theme-primary:var(--lightningcss-light,#121212)var(--lightningcss-dark,#f7f7f7);--theme-primary-hover:var(--lightningcss-light,#262626)var(--lightningcss-dark,#e5e5e5);--theme-primary-active:var(--lightningcss-light,#404040)var(--lightningcss-dark,#d4d4d4);--theme-focus:var(--lightningcss-light,#525252)var(--lightningcss-dark,#d4d4d4);--theme-cocoa:var(--lightningcss-light,#6b4423)var(--lightningcss-dark,#d29a63);--theme-mint:var(--lightningcss-light,#116b4c)var(--lightningcss-dark,#38efb0);--theme-cyan:var(--lightningcss-light,#0e7490)var(--lightningcss-dark,#22d3ee);--theme-violet:var(--lightningcss-light,#5b21b6)var(--lightningcss-dark,#b69cff);--theme-berry:var(--lightningcss-light,#a21caf)var(--lightningcss-dark,#e879f9);--theme-danger:var(--lightningcss-light,#b42318)var(--lightningcss-dark,#ff6b6b);--theme-danger-surface:var(--lightningcss-light,#fee2e2)var(--lightningcss-dark,#451a19);--theme-success:var(--lightningcss-light,#087443)var(--lightningcss-dark,#4ade80);--theme-success-surface:var(--lightningcss-light,#e7f6ee)var(--lightningcss-dark,#123c2b);--theme-warning:var(--lightningcss-light,#a16207)var(--lightningcss-dark,#ffc93c);--theme-warning-surface:var(--lightningcss-light,#fef3c7)var(--lightningcss-dark,#422006)}@media (prefers-color-scheme:dark){[data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]{--lightningcss-light: ;--lightningcss-dark:initial}}[data-pose-silhouette],[data-pose-arrow]{display:block;overflow:visible}[data-pose-silhouette] [data-pose-head]{fill:none;stroke:var(--theme-border);stroke-width:1.5px;stroke-dasharray:5 5}[data-pose-silhouette] [data-pose-eye]{fill:var(--theme-text-muted);stroke:none}[data-pose-silhouette] [data-pose-mouth],[data-pose-silhouette] [data-pose-eye-closed],[data-pose-motion]{fill:none;stroke:var(--theme-cyan);stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round}[data-pose-motion]{stroke-dasharray:6 6;animation:.9s linear infinite pose-motion}[data-pose-arrowhead]{fill:var(--theme-cyan);stroke:none}[data-pose-arrow] [data-pose-motion]{stroke:var(--theme-mint);stroke-width:4px;stroke-dasharray:none;animation:none}[data-pose-arrow] [data-pose-arrowhead]{fill:var(--theme-mint)}[data-pose-arrow] [data-pose-smile]{fill:none;stroke:var(--theme-mint);stroke-width:4px;stroke-linecap:round}[data-pose-progress][data-variant=bar]{gap:4px;width:100%;display:flex}[data-pose-progress][data-variant=bar] [data-pose-progress-step]{background:var(--theme-border);border-radius:9999px;flex:1;height:4px;transition:background .2s}[data-pose-progress][data-variant=bar] [data-pose-progress-step][data-complete]{background:var(--theme-mint)}[data-pose-progress][data-variant=ring]{display:block;overflow:visible}[data-pose-progress][data-variant=ring] [data-pose-progress-step]{fill:none;stroke:var(--theme-border);stroke-width:2px;stroke-linecap:round;transition:stroke .3s}[data-pose-progress][data-variant=ring] [data-pose-progress-step][data-complete]{stroke:var(--theme-mint)}[data-pose-success]{opacity:0;pointer-events:none}[data-pose-success] circle{fill:var(--theme-success-surface);stroke:var(--theme-mint);stroke-width:2px}[data-pose-success] path{fill:none;stroke:var(--theme-mint);stroke-width:5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1px}[data-pose-success][data-visible]{animation:.42s ease-out both pose-success-appear}[data-pose-success][data-visible] path{animation:.24s ease-out 60ms both pose-success-draw}@keyframes pose-motion{to{stroke-dashoffset:-12px}}@keyframes pose-success-appear{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}@keyframes pose-success-draw{to{stroke-dashoffset:0}}@media (prefers-reduced-motion:reduce){[data-pose-motion]{animation:none}[data-pose-success][data-visible]{opacity:1}[data-pose-success][data-visible] path{stroke-dashoffset:0}}[data-facegate-gate]{z-index:60;background:color-mix(in srgb, var(--theme-canvas) 84%, transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);place-items:center;padding:24px;font-family:ui-sans-serif,system-ui,sans-serif;display:grid;position:fixed;inset:0}[data-facegate-gate] .facegate-stage{place-items:center;display:grid;position:relative}[data-facegate-gate] .facegate-camera{aspect-ratio:1;flex-shrink:0;width:min(60vw,240px,38dvh);position:relative}[data-facegate-gate] .facegate-camera video{object-fit:cover;background:var(--theme-surface-subtle);border-radius:999px;width:100%;height:100%}[data-facegate-gate] .facegate-camera[data-mirrored] video{transform:scaleX(-1)}[data-facegate-gate] .facegate-camera>[data-pose-progress]{width:calc(100% + 28px);height:calc(100% + 28px);position:absolute;inset:-14px;overflow:visible}[data-facegate-gate] .facegate-camera>[data-pose-success]{z-index:2;transform-origin:50%;width:112px;height:112px;margin:auto;position:absolute;inset:0}[data-facegate-gate] .facegate-camera[data-shake]{animation:.48s both facegate-shake}[data-facegate-gate] .facegate-spinner-host{z-index:3;background:color-mix(in srgb, var(--theme-canvas) 70%, transparent);border-radius:999px;place-items:center;display:grid;position:absolute;inset:0}[data-facegate-gate] .facegate-spinner{width:40px;height:40px;color:var(--theme-cocoa);animation:.9s linear infinite facegate-spin}[data-facegate-gate] .facegate-prompt{width:min(80vw,300px);color:var(--theme-text);text-align:center;margin:0;font-size:17px;font-weight:600;position:absolute;top:calc(100% + 30px);left:50%;transform:translate(-50%)}[data-facegate-gate][data-result=pass] [data-pose-progress-step]{stroke:var(--theme-mint)}[data-facegate-gate][data-result=reject] [data-pose-progress-step]{stroke:var(--theme-danger)}@keyframes facegate-shake{0%,to{transform:translate(0)rotate(0)}20%{transform:translate(-6px)rotate(-6deg)}40%{transform:translate(6px)rotate(6deg)}60%{transform:translate(-5px)rotate(-4deg)}80%{transform:translate(5px)rotate(4deg)}}@keyframes facegate-spin{to{transform:rotate(360deg)}}@media (width<=600px){[data-facegate-gate] .facegate-camera{width:min(82vw,300px)}}@media (prefers-reduced-motion:reduce){[data-facegate-gate] .facegate-camera[data-shake],[data-facegate-gate] .facegate-spinner{animation:none}}`}));function $(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Tg,__v:--Eg,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),E.vnode&&E.vnode(l),l}var Tg,Eg,Dg=t((()=>{be(),Tg=Symbol.for(`pv`),Eg=0,Array.isArray})),Og,kg,Ag,jg,Mg,Ng=t((()=>{Dg(),Og=100,kg=2,Ag=({total:e})=>Og/e-(e===1?0:kg),jg=({arc:e,index:t,total:n})=>({dasharray:`${e} ${Og-e}`,offset:`${-t*Og/n}`}),Mg=({className:e,completed:t,label:n,total:r,variant:i=`bar`})=>{if(i===`ring`){let i=Ag({total:r});return $(`svg`,{className:e,"data-pose-progress":``,"data-variant":`ring`,viewBox:`0 0 100 100`,role:`progressbar`,"aria-label":n,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":t,children:$(`g`,{transform:`rotate(-90 50 50)`,children:Array.from({length:r},(e,n)=>{let{dasharray:a,offset:o}=jg({arc:i,index:n,total:r});return $(`circle`,{cx:`50`,cy:`50`,r:`50`,pathLength:Og,ref:e=>{e&&(e.setAttribute(`stroke-dasharray`,a),e.setAttribute(`stroke-dashoffset`,o))},"data-pose-progress-step":``,"data-complete":n<t?``:void 0},n)})})})}return $(`div`,{className:e,"data-pose-progress":``,"data-variant":`bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":t,children:Array.from({length:r},(e,n)=>$(`span`,{"data-pose-progress-step":``,"data-complete":n<t?``:void 0},n))})}})),Pg,Fg=t((()=>{Dg(),Pg=({className:e,visible:t})=>$(`svg`,{className:e,"data-pose-success":``,"data-visible":t?``:void 0,viewBox:`0 0 100 100`,"aria-hidden":`true`,children:[$(`circle`,{cx:`50`,cy:`50`,r:`44`}),$(`path`,{d:`M29 51 43 65 72 36`,pathLength:`1`})]})})),Ig=n({createFaceGateView:()=>zg}),Lg,Rg,zg,Bg=t((()=>{be(),Ge(),wg(),Bh(),Xh(),Ng(),Fg(),Dg(),Lg=()=>$(`svg`,{className:`facegate-spinner`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:$(`path`,{d:`M12 3a9 9 0 1 0 9 9`})}),Rg=({display:e,videoRef:t,options:n,onCancel:r})=>{let{translate:i}=lg({language:n.language});Se(()=>{if(!t.current)throw Error(Q.UI_ELEMENT_NOT_FOUND);let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let a=e.outcome.value,o=e.phase.value===`checking`,s=e.completed.value,c=e.total.value;return $(`div`,{className:`facegate-gate`,"data-facegate-gate":``,"data-result":a===`pass`?`pass`:a?`reject`:``,onClick:e=>{e.target===e.currentTarget&&r()},children:[$(`style`,{"data-facegate-styles":``,children:Cg}),$(`div`,{className:`facegate-stage`,role:`dialog`,"aria-modal":`true`,"aria-label":`Liveness check`,children:[$(`div`,{className:`facegate-camera`,"data-mirrored":``,"data-shake":a===`fail`||a===`error`?``:void 0,children:[$(`video`,{ref:t,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":i(`cameraPreview`)}),$(Mg,{completed:s,label:i(`faceCaptureProgress`),total:c,variant:`ring`}),$(Pg,{visible:a===`pass`}),o?$(`div`,{className:`facegate-spinner-host`,children:$(Lg,{})}):null]}),a?null:$(`p`,{className:`facegate-prompt`,role:`status`,"aria-live":`polite`,children:e.prompt.value})]})]})},zg=({options:e,display:t,onCancel:n})=>{let r=o(),i=null;return{get video(){return r.current},requiredVideo:()=>{if(!r.current)throw Error(Q.INVALID_OPTIONS);return r.current},open:()=>{i||(i=document.createElement(`div`),i.dataset.facegateRoot=``,document.body.append(i),ne($(Rg,{display:t,videoRef:r,options:e,onCancel:n}),i))},close:()=>{if(!i)return;let e=r.current;e&&Gh({video:e}),ne(null,i),i.remove(),i=null}}}}));Bh(),ug(),Xh();var{detectPictureFaces:Vg,loadFaceDetector:Hg}=Ih,Ug=3e4,Wg=e=>new Promise(t=>setTimeout(t,e)),Gg=async({frame:e,neutral:t,pose:n,requireEyeLevelCamera:r})=>{let i=await Vg(e,{blendshapes:!0}),a=i.length===1?i[0]:null;if(!a)return{alignment:null,code:null,prompt:`faceNotFound`,ready:!1};let o={pitch:a.pitch,yaw:a.yaw,roll:a.roll},s=a.boundingRect.height/Math.min(e.width,e.height),c=a.boundingRect.x+a.boundingRect.width/2,l=a.boundingRect.y+a.boundingRect.height/2,u=Math.hypot(c-e.width/2,l-e.height/2)<=Math.min(e.width,e.height)*.12;if(s<.5)return{alignment:o,code:null,prompt:`faceTooSmall`,ready:!1};if(!u)return{alignment:o,code:null,prompt:`centerFace`,ready:!1};let d=Zh({pitch:a.pitch,pose:n,requireEyeLevelCamera:r,options:G});if(d)return{alignment:o,code:d,prompt:Qh(),ready:!1};let f=gg({alignment:o,blendshapes:a.blendshapes,neutral:t,pose:n,options:G});if(f.code){let e=vg({pose:n,code:f.code});return{alignment:o,code:f.code,prompt:e.corrective??e.primary,ready:!1}}return{alignment:o,code:null,prompt:vg({pose:n,code:null}).primary,ready:!0}},Kg=class{options;display=yg();handles=new Set;controller=null;view=null;prepared=!1;running=!1;disposed=!1;constructor(e){this.options=Object.freeze(bg(e))}async caniuse(){return await Wh()}async prepare(){if(this.disposed)throw Error(Q.SDK_NOT_READY);if(!this.prepared){if(await og({language:this.options.language}),await pu({filenames:[`fd.ort`,`fe.ort`,`fl.ort`,`fmu.ort`,`ort-wasm-simd-threaded.mjs`,`ort-wasm-simd-threaded.wasm`]}),this.disposed)throw Error(Q.SDK_NOT_READY);if(await Hg({faceDetector:`standard`}),!this.view){let{createFaceGateView:e}=await Promise.resolve().then(()=>(Bg(),Ig));if(this.disposed)throw Error(Q.SDK_NOT_READY);this.view=e({options:this.options,display:this.display,onCancel:()=>this.stop()})}if(this.disposed)throw Error(Q.SDK_NOT_READY);this.prepared=!0}}arm(e,t){if(this.disposed||!this.prepared)throw Error(Q.SDK_NOT_READY);let n=xg(t),r,i=()=>{this.runGate(r)};return r={control:e,options:n,detach:()=>e.removeEventListener(`click`,i)},e.addEventListener(`click`,i),this.handles.add(r),r}disarm(e){e.detach(),this.handles.delete(e)}async request({path:e,body:t,signal:n}){let r=await fetch(`${(this.options.apiUrl??`https://api.voltom.io`).replace(/\/$/,``)}/facegate/${e}`,{method:`POST`,headers:{authorization:`Bearer ${this.options.clientKey}`,"content-type":`application/json`},body:JSON.stringify(t),signal:n}),i=await r.json().catch(()=>null);if(!r.ok)throw Error(typeof i?.code==`string`?i.code:Q.INVALID_SERVICE_RESPONSE);return i}async capture({video:e,poses:t,signal:n}){let{translate:r}=lg({language:this.options.language}),i=[],a=null;for(let[o,s]of t.entries()){let t=0;for(Je(()=>{this.display.phase.value=`capturing`,this.display.completed.value=o,this.display.prompt.value=r(vg({pose:s,code:null}).primary)});t<3;){await Hh({video:e,signal:n}),n.throwIfAborted();let o=await createImageBitmap(e);try{let e=await Gg({frame:o,neutral:a,pose:s,requireEyeLevelCamera:this.options.requireEyeLevelCamera??!1});if(n.throwIfAborted(),t=e.ready?t+1:0,this.display.prompt.value=r(e.prompt),s===`faceStraight`&&e.ready&&(a=e.alignment),t>=3){let e=await Jh({frame:o});i.push(await Yh({image:e}))}}finally{o.close()}}this.display.completed.value=o+1}return i}async runGate(e){if(this.disposed||this.running)return;this.running=!0;let t=new AbortController;this.controller=t;let n=t.signal,r=e.options,i=()=>t.abort(new DOMException(Q.FACEGATE_ABORTED,`AbortError`)),a=setTimeout(()=>t.abort(new DOMException(Q.FACEGATE_TIMEOUT,`TimeoutError`)),Ug);r.signal?.addEventListener(`abort`,i,{once:!0}),r.signal?.aborted&&t.abort();let o=null;Je(()=>{this.display.active.value=!0,this.display.phase.value=`capturing`,this.display.outcome.value=null,this.display.completed.value=0,this.display.total.value=1,this.display.prompt.value=``}),this.view?.open();try{let e=this.view?.video;if(!e)throw Error(Q.INVALID_OPTIONS);await Kh({facingMode:`user`,video:e,signal:n}),n.throwIfAborted();let t=await Promise.all([r.subjectId?.(),r.context?.()]),i=await this.request({path:`challenge`,body:{action:r.action,subjectId:t[0],context:t[1]},signal:n});o=Sg(i.token),this.display.total.value=i.poses.length;let a=await this.capture({video:e,poses:i.poses,signal:n});n.throwIfAborted(),this.display.phase.value=`checking`,this.display.prompt.value=lg({language:this.options.language}).translate(`checkingFaceMatch`);let s=await this.request({path:`verify`,body:{token:i.token,poses:i.poses,faces:a},signal:n});this.display.outcome.value=s.outcome,this.display.phase.value=s.outcome===`pass`?`pass`:`reject`,this.display.prompt.value=``,await Wg(950),this.view?.close(),s.outcome===`pass`?await r.onPass(i.token):r.onReject({outcome:s.outcome,code:s.code})}catch(e){let t=n.aborted?zh({error:n.reason,fallback:Q.FACEGATE_ABORTED}):zh({error:e,fallback:Q.SERVICE_UNAVAILABLE});if(t!==Q.FACEGATE_ABORTED&&(this.display.outcome.value=`error`,this.display.phase.value=`reject`,this.display.prompt.value=``,await Wg(950)),this.view?.close(),o)try{await this.request({path:`abort`,body:{token:o,code:t},signal:AbortSignal.timeout(1e4)})}catch{}r.onReject({outcome:`error`,code:t})}finally{clearTimeout(a),r.signal?.removeEventListener(`abort`,i);let e=this.view?.video;e&&Gh({video:e}),this.display.active.value=!1,this.controller=null,this.running=!1}}stop(){this.controller&&this.controller.abort(new DOMException(Q.FACEGATE_ABORTED,`AbortError`))}dispose(){if(!this.disposed){this.disposed=!0,this.stop();for(let e of this.handles)e.detach();this.handles.clear(),this.view?.close()}}getState(){return{active:this.display.active.value,phase:this.display.phase.value,prompt:this.display.prompt.value,completed:this.display.completed.value,total:this.display.total.value,outcome:this.display.outcome.value}}};tg();var qg=globalThis.document?.currentScript,Jg=globalThis.HTMLScriptElement&&qg instanceof globalThis.HTMLScriptElement?qg.src:globalThis.location.href,Yg=globalThis;$h({moduleUrl:Jg}),Yg.VoltomFaceGate=Kg})();
56
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ks(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ks(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}function qs(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Js(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Qs.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??qs(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}It(n,r,e.length===1?e[0]:Js(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=qs(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ys(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Qs)if(t in e)return;let n=t.filter(e=>$s.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Js(t);else{let e=n[0],i=$s.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Js([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Vs(e,r))}function Xs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Vs(i,s),Vs(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ks(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ys(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Vs(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,It(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:tc(t,`input`,e.processors),output:tc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Zs(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Zs(r.element,n);if(r.type===`set`)return Zs(r.valueType,n);if(r.type===`lazy`)return Zs(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Zs(r.innerType,n);if(r.type===`intersection`)return Zs(r.left,n)||Zs(r.right,n);if(r.type===`record`||r.type===`map`)return Zs(r.keyType,n)||Zs(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Zs(r.in,n)||Zs(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Zs(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Zs(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Zs(e,n))return!0;return!!(r.rest&&Zs(r.rest,n))}return!1}var Qs,$s,ec,tc,nc=t((()=>{Fo(),zn(),Qs=new Set([`type`,`properties`,`required`,`additionalProperties`]),$s=[`oneOf`,`anyOf`],ec=(e,t={})=>n=>{let r=Hs({...n,processors:t});return I(e,r),Gs(r,e),Xs(r,e)},tc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Hs({...i??{},target:a,io:t,processors:n});return I(e,o),Gs(o,e),Xs(o,e)}}));function rc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)vc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&cc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&cc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&lc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&lc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&dc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&pc(t,i.mime);for(let e of i.patterns??[])fc(t,e);return t}function ic(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ic(t.out):t.type===`catch`?ic(t.innerType):e._zod.optin}function ac(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=ac(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>ac(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i&&(p.type=`string`,a||(p.pattern=(r.includes(`number`)?ti:ei).source)),p}function oc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Ic.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=ac(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}function sc(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Us(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Bc):JSON.parse(o)}var cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc=t((()=>{ai(),co(),nc(),zn(),cc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},lc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},uc=(e,t)=>{cc(e,`minimum`,t),lc(e,`maximum`,t)},dc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},fc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},pc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},mc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},hc=(e,t)=>cc(e,`minimum`,t.minimum),gc=(e,t)=>lc(e,`maximum`,t.maximum),_c=e=>(t,n)=>{mc(t,n.format);let[r,i]=e[n.format];cc(t,`minimum`,r),lc(t,`maximum`,i)},vc={greater_than:(e,t)=>cc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>lc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>dc(e,t.value),number_format:_c(Mn),bigint_format:_c(Nn),min_length:hc,max_length:gc,length_equals:(e,t)=>uc(e,t.length),min_size:hc,max_size:gc,size_equals:(e,t)=>uc(e,t.size),string_format:(e,t)=>{mc(e,t.format),t.pattern&&fc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>pc(e,t.mime)},yc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},bc=new Map([[Oa,qr],[Aa,Jr]]),xc=e=>bc.get(e)??e,Sc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=rc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=yc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(xc);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Cc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=rc(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):Us(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},wc=(e,t,n,r)=>{n.type=`boolean`},Tc=(e,t,n,r)=>{n.not={}},Ec=(e,t,n,r)=>{},Dc=(e,t,n,r)=>{let i=e._zod.def,a=kt(i.entries);a.length===0?n.not={}:(a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a)},Oc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(Us(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Us(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},kc=(e,t,n,r)=>{Us(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ac=(e,t,n,r)=>{Us(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},jc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=rc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I(a.element,t,{...r,path:[...r.path,`items`]})},Mc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Us(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)It(i.properties,e,I(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ic(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Nc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Pc=(e,t,n,r)=>{let i=e._zod.def,a=I(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Fc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>I(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?I(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?ic(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=rc(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)},Ic=new WeakMap,Lc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=rc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=I(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)It(i.patternProperties,xc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=I(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Ic.get(t);n||(n=[],Ic.set(t,n),t.deferred.push(()=>oc(t))),n.push(e)}i.additionalProperties=I(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&ic(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Rc=(e,t,n,r)=>{let i=e._zod.def,a=I(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},zc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Bc=Symbol(),Vc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=sc(i.defaultValue,e,t,n,r);o!==Bc&&(n.default=o)},Hc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=sc(i.defaultValue,e,t,n,r);o!==Bc&&(n._prefault=o)},Uc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Us(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Wc=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I(o,t,r);let s=t.seen.get(e);s.ref=o},Gc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Kc=(e,t,n,r)=>{let i=e._zod.def;I(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType}})),Jc=t((()=>{Jn(),Tr(),ar(),co(),Do(),Ci(),Di(),zn(),ai(),Ao(),Fo(),Ti(),Io(),Bs(),nc(),qc(),nc()})),Yc=t((()=>{Jc()}));function Xc(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Zc,Qc,$c,el=t((()=>{Jc(),zn(),Zc=new WeakSet([Object.prototype,Error.prototype]),Qc=(e,t)=>{ir.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Zc.has(n)||(Zc.add(n),Xc(n,`format`,e=>t=>$n(e,t)),Xc(n,`flatten`,e=>t=>Qn(e,t)),Xc(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,jt,2)}),Xc(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,jt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},$c=M(`ZodError`,Qc,void 0,{Parent:Error})})),tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl=t((()=>{Jc(),el(),tl=lr($c),nl=ur($c),rl=dr($c),il=fr($c),al=_r($c),ol=vr($c),sl=yr($c),cl=br($c),ll=xr($c),ul=Sr($c),dl=Cr($c),fl=wr($c)}));function ml(){qn.localeError||Vn(Oo())}function hl(){qn.memoizer||Vn({memoizer:ho()})}function L(e){return Ro(Ul,e)}function gl(e){return Vo(Xl,e)}function R(e){return ds(pu,e)}function _l(e){return fs(mu,e)}function vl(e){return ps(hu,e)}function yl(){return ms(gu)}function bl(e){return hs(_u,e)}function xl(e,t){return Is(vu,e,t)}function z(e,t){let n={type:`object`,shape:e??{},...A(t)};return new yu(n)}function Sl(e,t){return new bu({type:`union`,options:e,...A(t)})}function Cl(e,t){return new xu({type:`intersection`,left:e,right:t})}function wl(e,t,n){let r=t instanceof P;return new Su({type:`tuple`,items:e,rest:r?t:null,...A(r?n:t)})}function Tl(e,t,n){return!t||!t._zod?new Cu({type:`record`,keyType:L(),valueType:e,...A(t)}):new Cu({type:`record`,keyType:e,valueType:t,...A(n)})}function El(e,t,n){return new Cu({type:`record`,keyType:e,valueType:t,...A(n),partial:!0})}function Dl(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new wu({type:`enum`,entries:n,...A(t)})}function Ol(e,t){return new Tu({type:`literal`,values:Array.isArray(e)?e:[e],...A(t)})}function kl(e){return new Eu({type:`transform`,transform:e})}function Al(e){return new Du({type:`optional`,innerType:e})}function jl(e){return new Ou({type:`optional`,innerType:e})}function Ml(e){return new ku({type:`nullable`,innerType:e})}function Nl(e,t){return new Au({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Jt(t)}})}function Pl(e,t){return new ju({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Jt(t)}})}function Fl(e,t){return new Mu({type:`nonoptional`,innerType:e,...A(t)})}function Il(e,t){return new Nu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Dn(t)})}function Ll(e,t){return new Pu({type:`pipe`,in:e,out:t})}function Rl(e){return new Iu({type:`readonly`,innerType:e})}function zl(e,t={}){return Ls(Lu,e,t)}function Bl(e,t){return Rs(e,t)}function Vl(e,t){return new Fu({type:`pipe`,in:kl(e),out:t})}var B,Hl,Ul,V,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru=t((()=>{Jc(),qc(),nc(),Ao(),Yc(),pl(),B=M(`ZodType`,(e,t)=>(ml(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ut(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Xt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(zl(e,t))},superRefine(e,t){return this.check(Bl(e,t))},overwrite(e){return this.check(As(e))},optional(){return Al(this)},exactOptional(){return jl(this)},nullable(){return Ml(this)},nullish(){return Al(Ml(this))},nonoptional(e){return Fl(this,e)},array(){return xl(this)},or(e){return Sl([this,e])},and(e){return Cl(this,e)},transform(e){return Ll(this,kl(e))},default(e){return Nl(this,e)},prefault(e){return Pl(this,e)},catch(e){return Il(this,e)},pipe(e){return Ll(this,e)},readonly(){return Rl(this)},describe(e){let t=this.clone();return Po.add(t,{description:e}),t},meta(...e){if(e.length===0)return Po.get(this);let t=this.clone();return Po.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Sn(this,`~standard`,{...ki(this),jsonSchema:{input:tc(this,`input`),output:tc(this,`output`)}})},set"~standard"(e){xn(this,`~standard`,e)},parse:function e(t,n){return tl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await nl(this,t,n,{callee:e})},safeParse(e,t){return rl(this,e,t)},async safeParseAsync(e,t){return il(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xn(this,`spa`,e)},validate(e,t){return hr(this,e,t)},validateAsync(e,t){return gr(this,e,t)},encode:function e(t,n){return al(this,t,n,{callee:e})},decode:function e(t,n){return ol(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await sl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await cl(this,t,n,{callee:e})},safeEncode(e,t){return ll(this,e,t)},safeDecode(e,t){return ul(this,e,t)},async safeEncodeAsync(e,t){return dl(this,e,t)},async safeDecodeAsync(e,t){return fl(this,e,t)},toJSONSchema(e){return ec(this,{})(e)},get description(){return Po.get(this)?.description},get _def(){return this._zod.def}}),Hl=M(`_ZodString`,(e,t)=>{oa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sc(e,t,n,r)},Cn({format:e=>rc(e).format??null,minLength:e=>rc(e).minimum??null,maxLength:e=>rc(e).maximum??null},{regex(...e){return this.check(ws(...e))},includes(...e){return this.check(Ds(...e))},startsWith(...e){return this.check(Os(...e))},endsWith(...e){return this.check(ks(...e))},min(...e){return this.check(Ss(...e))},max(...e){return this.check(xs(...e))},length(...e){return this.check(Cs(...e))},nonempty(...e){return this.check(Ss(1,...e))},lowercase(e){return this.check(Ts(e))},uppercase(e){return this.check(Es(e))},trim(){return this.check(Ms())},normalize(...e){return this.check(js(...e))},toLowerCase(){return this.check(Ns())},toUpperCase(){return this.check(Ps())},slugify(){return this.check(Fs())}})),Ul=M(`ZodString`,(e,t)=>{oa.init(e,t),Hl.init(e,t)},{email(e){return this.check(zo(Jl,e))},url(e){return this.check(Go(Zl,e))},jwt(e){return this.check(os(fu,e))},emoji(e){return this.check(Ko(Ql,e))},guid(e){return this.check(Bo(Yl,e))},uuid(e){return this.check(Vo(Xl,e))},uuidv4(e){return this.check(Ho(Xl,e))},uuidv6(e){return this.check(Uo(Xl,e))},uuidv7(e){return this.check(Wo(Xl,e))},nanoid(e){return this.check(qo($l,e))},cuid(e){return this.check(Jo(eu,e))},cuid2(e){return this.check(Yo(tu,e))},ulid(e){return this.check(Xo(nu,e))},base64(e){return this.check(rs(lu,e))},base64url(e){return this.check(is(uu,e))},xid(e){return this.check(Zo(ru,e))},ksuid(e){return this.check(Qo(iu,e))},ipv4(e){return this.check($o(au,e))},ipv6(e){return this.check(es(ou,e))},cidrv4(e){return this.check(ts(su,e))},cidrv6(e){return this.check(ns(cu,e))},e164(e){return this.check(as(du,e))},datetime(e){return this.check(ss(Wl,e))},date(e){return this.check(cs(Gl,e))},time(e){return this.check(ls(Kl,e))},duration(e){return this.check(us(ql,e))}}),V=M(`ZodStringFormat`,(e,t)=>{F.init(e,t),Hl.init(e,t)}),Wl=M(`ZodISODateTime`,(e,t)=>{ya.init(e,t),V.init(e,t)}),Gl=M(`ZodISODate`,(e,t)=>{ba.init(e,t),V.init(e,t)}),Kl=M(`ZodISOTime`,(e,t)=>{xa.init(e,t),V.init(e,t)}),ql=M(`ZodISODuration`,(e,t)=>{Sa.init(e,t),V.init(e,t)}),Jl=M(`ZodEmail`,(e,t)=>{la.init(e,t),V.init(e,t)}),Yl=M(`ZodGUID`,(e,t)=>{sa.init(e,t),V.init(e,t)}),Xl=M(`ZodUUID`,(e,t)=>{ca.init(e,t),V.init(e,t)}),Zl=M(`ZodURL`,(e,t)=>{da.init(e,t),V.init(e,t)}),Ql=M(`ZodEmoji`,(e,t)=>{fa.init(e,t),V.init(e,t)}),$l=M(`ZodNanoID`,(e,t)=>{pa.init(e,t),V.init(e,t)}),eu=M(`ZodCUID`,(e,t)=>{ma.init(e,t),V.init(e,t)}),tu=M(`ZodCUID2`,(e,t)=>{ha.init(e,t),V.init(e,t)}),nu=M(`ZodULID`,(e,t)=>{ga.init(e,t),V.init(e,t)}),ru=M(`ZodXID`,(e,t)=>{_a.init(e,t),V.init(e,t)}),iu=M(`ZodKSUID`,(e,t)=>{va.init(e,t),V.init(e,t)}),au=M(`ZodIPv4`,(e,t)=>{Ca.init(e,t),V.init(e,t)}),ou=M(`ZodIPv6`,(e,t)=>{Ta.init(e,t),V.init(e,t)}),su=M(`ZodCIDRv4`,(e,t)=>{Ea.init(e,t),V.init(e,t)}),cu=M(`ZodCIDRv6`,(e,t)=>{Da.init(e,t),V.init(e,t)}),lu=M(`ZodBase64`,(e,t)=>{ka.init(e,t),V.init(e,t)}),uu=M(`ZodBase64URL`,(e,t)=>{ja.init(e,t),V.init(e,t)}),du=M(`ZodE164`,(e,t)=>{Ma.init(e,t),V.init(e,t)}),fu=M(`ZodJWT`,(e,t)=>{Na.init(e,t),V.init(e,t)}),pu=M(`ZodNumber`,(e,t)=>{Pa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cc(e,t,n,r),e.isFinite=!0},Cn({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=rc(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=rc(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=rc(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>rc(e).format??null},{gt(e,t){return this.check(vs(e,t))},gte(e,t){return this.check(ys(e,t))},min(e,t){return this.check(ys(e,t))},lt(e,t){return this.check(gs(e,t))},lte(e,t){return this.check(_s(e,t))},max(e,t){return this.check(_s(e,t))},int(e){return this.check(_l(e))},safe(e){return this.check(_l(e))},positive(e){return this.check(vs(0,e))},nonnegative(e){return this.check(ys(0,e))},negative(e){return this.check(gs(0,e))},nonpositive(e){return this.check(_s(0,e))},multipleOf(e,t){return this.check(bs(e,t))},step(e,t){return this.check(bs(e,t))},finite(){return this}})),mu=M(`ZodNumberFormat`,(e,t)=>{Fa.init(e,t),pu.init(e,t)}),hu=M(`ZodBoolean`,(e,t)=>{Ia.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wc(e,t,n,r)}),gu=M(`ZodUnknown`,(e,t)=>{La.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ec(e,t,n,r)}),_u=M(`ZodNever`,(e,t)=>{Ra.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Tc(e,t,n,r)}),vu=M(`ZodArray`,(e,t)=>{hl(),Ba.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ss(e,t))},nonempty(e){return this.check(Ss(1,e))},max(e,t){return this.check(xs(e,t))},length(e,t){return this.check(Cs(e,t))},unwrap(){return this.element}}),yu=M(`ZodObject`,(e,t)=>{hl(),Ua.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mc(e,t,n,r),En(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Dl(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ut(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ut(this._zod.def,{catchall:yl()}))},loose(){return this.clone(Ut(this._zod.def,{catchall:yl()}))},strict(){return this.clone(Ut(this._zod.def,{catchall:bl()}))},strip(){return this.clone(Ut(this._zod.def,{catchall:void 0}))},extend(e){return nn(this,e)},safeExtend(e){return an(this,e)},merge(e){return on(this,e)},pick(e){return $t(this,e)},omit(e){return tn(this,e)},partial(...e){return sn(Du,this,e[0])},exactPartial(...e){return sn(Ou,this,e[0],`exactPartial`)},required(...e){return cn(Mu,this,e[0])}}),bu=M(`ZodUnion`,(e,t)=>{Wa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Nc(e,t,n,r),e.options=t.options}),xu=M(`ZodIntersection`,(e,t)=>{Ga.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pc(e,t,n,r)}),Su=M(`ZodTuple`,(e,t)=>{hl(),Ka.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fc(e,t,n,r)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(`.partial() cannot be used on tuple schemas containing refinements`);return this.clone({...e,items:e.items.map(e=>new Du({type:`optional`,innerType:e}))})}}),Cu=M(`ZodRecord`,(e,t)=>{hl(),qa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType}),wu=M(`ZodEnum`,(e,t)=>{Ja.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Dc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wu({...t,checks:[],...A(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wu({...t,checks:[],...A(r),entries:i})}}),Tu=M(`ZodLiteral`,(e,t)=>{Ya.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),Eu=M(`ZodTransform`,(e,t)=>{hl(),Xa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ac(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Kn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(yn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(yn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}}),Du=M(`ZodOptional`,(e,t)=>{Za.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Ou=M(`ZodExactOptional`,(e,t)=>{Qa.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),ku=M(`ZodNullable`,(e,t)=>{$a.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Au=M(`ZodDefault`,(e,t)=>{eo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),ju=M(`ZodPrefault`,(e,t)=>{to.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Mu=M(`ZodNonOptional`,(e,t)=>{no.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Nu=M(`ZodCatch`,(e,t)=>{ro.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),Pu=M(`ZodPipe`,(e,t)=>{io.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e.in=t.in,e.out=t.out}),Fu=M(`ZodPreprocess`,(e,t)=>{Pu.init(e,t),ao.init(e,t)}),Iu=M(`ZodReadonly`,(e,t)=>{oo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.unwrap=()=>e._zod.def.innerType}),Lu=M(`ZodCustom`,(e,t)=>{so.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>kc(e,t,n,r)})})),zu=t((()=>{Jc()}));function Bu(e){return ss(Wl,e)}function Vu(e){return cs(Gl,e)}var Hu=t((()=>{Jc(),Ru()})),Uu=t((()=>{Jc(),Ru(),Yc(),el(),pl(),zu(),qc(),Fo(),zn(),Yc(),Hu(),Ru(),co(),Ao()})),Wu=t((()=>{Uu(),Uu()})),H,Gu,Ku,qu,Ju,Yu,Xu=t((()=>{H={INTENT_TOKEN_INVALID:`INTENT_TOKEN_INVALID`,FACEKEY_ALREADY_ENROLLED:`FACEKEY_ALREADY_ENROLLED`,FACEKEY_NOT_ENROLLED:`FACEKEY_NOT_ENROLLED`,FACEKEY_VERSION_MISMATCH:`FACEKEY_VERSION_MISMATCH`,FACEKEY_KEY_UNAVAILABLE:`FACEKEY_KEY_UNAVAILABLE`,FACEKEY_TEMPLATE_INVALID:`FACEKEY_TEMPLATE_INVALID`,OPERATION_CANCELLED:`OPERATION_CANCELLED`,OPERATION_TIMEOUT:`OPERATION_TIMEOUT`,CLIENT_KEY_REQUIRED:`CLIENT_KEY_REQUIRED`,API_KEY_FORBIDDEN:`API_KEY_FORBIDDEN`,CAMERA_INTERRUPTED:`CAMERA_INTERRUPTED`,CAMERA_NOT_FOUND:`CAMERA_NOT_FOUND`,CAMERA_PERMISSION_DENIED:`CAMERA_PERMISSION_DENIED`,CAMERA_UNAVAILABLE:`CAMERA_UNAVAILABLE`,CAMERA_UNSUPPORTED:`CAMERA_UNSUPPORTED`,CAPTURES_INCOMPLETE:`CAPTURES_INCOMPLETE`,CLIENT_ASSET_NOT_FOUND:`CLIENT_ASSET_NOT_FOUND`,CLIENT_NOT_AVAILABLE:`CLIENT_NOT_AVAILABLE`,CONTACT_RATE_LIMITED:`CONTACT_RATE_LIMITED`,DOCUMENT_BACK_CONTAINS_FACE:`DOCUMENT_BACK_CONTAINS_FACE`,DOCUMENT_BACK_NOT_DISTINCT:`DOCUMENT_BACK_NOT_DISTINCT`,DOCUMENT_BACK_REQUIRED:`DOCUMENT_BACK_REQUIRED`,DOCUMENT_BLURRY:`DOCUMENT_BLURRY`,DOCUMENT_CODE_TYPE_MISMATCH:`DOCUMENT_CODE_TYPE_MISMATCH`,DOCUMENT_FACE_GEOMETRY_INVALID:`DOCUMENT_FACE_GEOMETRY_INVALID`,DOCUMENT_FACE_NOT_CONTAINED:`DOCUMENT_FACE_NOT_CONTAINED`,DOCUMENT_FACE_NOT_FOUND:`DOCUMENT_FACE_NOT_FOUND`,DOCUMENT_NOT_FOUND:`DOCUMENT_NOT_FOUND`,DOCUMENT_NOT_RECOGNIZED:`DOCUMENT_NOT_RECOGNIZED`,DOCUMENT_TEXT_ALIGNMENT_INVALID:`DOCUMENT_TEXT_ALIGNMENT_INVALID`,DOCUMENT_TEXT_NOT_READABLE:`DOCUMENT_TEXT_NOT_READABLE`,DOCUMENT_VALIDATION_FAILED:`DOCUMENT_VALIDATION_FAILED`,EMAIL_ALREADY_REGISTERED:`EMAIL_ALREADY_REGISTERED`,EMAIL_DELIVERY_FAILED:`EMAIL_DELIVERY_FAILED`,EUROPEAN_LICENCE_BACK_MARKER_REQUIRED:`EUROPEAN_LICENCE_BACK_MARKER_REQUIRED`,FACE_AGE_MISMATCH:`FACE_AGE_MISMATCH`,FACE_ALIGNMENT_FAILED:`FACE_ALIGNMENT_FAILED`,FACE_ATTRIBUTES_UNAVAILABLE:`FACE_ATTRIBUTES_UNAVAILABLE`,FACE_GENDER_MISMATCH:`FACE_GENDER_MISMATCH`,FACE_LIGHTING_INVALID:`FACE_LIGHTING_INVALID`,FACE_MISMATCH:`FACE_MISMATCH`,FACE_NOT_FOUND:`FACE_NOT_FOUND`,FACE_NOT_STABLE:`FACE_NOT_STABLE`,FACE_NOT_USABLE:`FACE_NOT_USABLE`,FACE_OUT_OF_FRAME:`FACE_OUT_OF_FRAME`,FACE_POSE_INVALID:`FACE_POSE_INVALID`,FACE_SPOOF_DETECTED:`FACE_SPOOF_DETECTED`,GEO_DATABASE_DOWNLOAD_EMPTY:`GEO_DATABASE_DOWNLOAD_EMPTY`,GEO_DATABASE_DOWNLOAD_FAILED:`GEO_DATABASE_DOWNLOAD_FAILED`,IMAGE_DECODE_FAILED:`IMAGE_DECODE_FAILED`,IMAGE_ENCODE_FAILED:`IMAGE_ENCODE_FAILED`,IMAGE_PROCESSING_FAILED:`IMAGE_PROCESSING_FAILED`,IMAGE_TOO_LARGE:`IMAGE_TOO_LARGE`,INFERENCE_FAILED:`INFERENCE_FAILED`,INFERENCE_QUEUE_FULL:`INFERENCE_QUEUE_FULL`,INFERENCE_TIMEOUT:`INFERENCE_TIMEOUT`,VALIDATION_ERROR:`VALIDATION_ERROR`,RESPONSE_VALIDATION_ERROR:`RESPONSE_VALIDATION_ERROR`,RESOURCE_NOT_FOUND:`RESOURCE_NOT_FOUND`,RESOURCE_NOT_FOUND_IN_VIEW:`RESOURCE_NOT_FOUND_IN_VIEW`,REQUEST_TOO_LARGE:`REQUEST_TOO_LARGE`,INTERNAL_ERROR:`INTERNAL_ERROR`,INVALID_CREDENTIALS:`INVALID_CREDENTIALS`,BILLING_DETAILS_REQUIRED:`BILLING_DETAILS_REQUIRED`,PAYMENT_METHOD_NOT_FOUND:`PAYMENT_METHOD_NOT_FOUND`,PAYMENT_NOT_FOUND:`PAYMENT_NOT_FOUND`,RECOVERY_SENT:`RECOVERY_SENT`,INVALID_DOCUMENT_AAMVA:`INVALID_DOCUMENT_AAMVA`,INVALID_DOCUMENT_MRZ:`INVALID_DOCUMENT_MRZ`,INVALID_FACE_MATCH_INPUT:`INVALID_FACE_MATCH_INPUT`,INVALID_IMAGE:`INVALID_IMAGE`,INVALID_KEY_LABEL:`INVALID_KEY_LABEL`,INVALID_MODEL_OUTPUT:`INVALID_MODEL_OUTPUT`,INVALID_OPTIONS:`INVALID_OPTIONS`,INVALID_PASSPORT_MRZ:`INVALID_PASSPORT_MRZ`,INVALID_POSES:`INVALID_POSES`,INVALID_CLIENT_KEY:`INVALID_CLIENT_KEY`,INVALID_REGISTRATION:`INVALID_REGISTRATION`,INVALID_SERVICE_RESPONSE:`INVALID_SERVICE_RESPONSE`,INVALID_VERIFICATION_FEEDBACK:`INVALID_VERIFICATION_FEEDBACK`,INVALID_VERIFICATION_INPUT:`INVALID_VERIFICATION_INPUT`,KEY_NOT_FOUND:`KEY_NOT_FOUND`,MODEL_LOAD_FAILED:`MODEL_LOAD_FAILED`,MULTIPLE_FACES:`MULTIPLE_FACES`,NETWORK_ERROR:`NETWORK_ERROR`,NO_USABLE_CANDIDATES:`NO_USABLE_CANDIDATES`,NO_USABLE_REFERENCES:`NO_USABLE_REFERENCES`,OCR_DICTIONARY_MISMATCH:`OCR_DICTIONARY_MISMATCH`,OCR_ENVIRONMENT_MISMATCH:`OCR_ENVIRONMENT_MISMATCH`,OCR_LANGUAGE_UNSUPPORTED:`OCR_LANGUAGE_UNSUPPORTED`,OCR_MODEL_UNSUPPORTED:`OCR_MODEL_UNSUPPORTED`,PAYMENT_FAILED:`PAYMENT_FAILED`,BILLING_ACCOUNT_BLOCKED:`BILLING_ACCOUNT_BLOCKED`,ACCOUNT_HAS_UNBILLED_USAGE:`ACCOUNT_HAS_UNBILLED_USAGE`,POSE_IDENTITY_MISMATCH:`POSE_IDENTITY_MISMATCH`,POSE_BACKGROUND_MISMATCH:`POSE_BACKGROUND_MISMATCH`,SERVICE_UNAVAILABLE:`SERVICE_UNAVAILABLE`,SUPERADMIN_REQUIRED:`SUPERADMIN_REQUIRED`,UI_ELEMENT_NOT_FOUND:`UI_ELEMENT_NOT_FOUND`,UNAUTHORIZED:`UNAUTHORIZED`,USER_ACCESS_REQUIRED:`USER_ACCESS_REQUIRED`,USER_NOT_FOUND:`USER_NOT_FOUND`,VERIFICATION_SAVE_FAILED:`VERIFICATION_SAVE_FAILED`,INVALID_PDF:`INVALID_PDF`,PDF_LOAD_FAILED:`PDF_LOAD_FAILED`,PDF_PASSWORD_REQUIRED:`PDF_PASSWORD_REQUIRED`,SDK_CAPABILITY_NOT_CONFIGURED:`SDK_CAPABILITY_NOT_CONFIGURED`,SDK_DISPOSED:`SDK_DISPOSED`,OPERATION_IN_PROGRESS:`OPERATION_IN_PROGRESS`,AUTHORIZATION_FAILED:`AUTHORIZATION_FAILED`},Gu=new Set(Object.values(H)),Ku=e=>typeof e==`string`&&Gu.has(e),qu={FACEKEY_TOKEN_INVALID:H.INTENT_TOKEN_INVALID,FACEGATE_TOKEN_INVALID:H.INTENT_TOKEN_INVALID,FACEGATE_ABORTED:H.OPERATION_CANCELLED,VERIFICATION_CANCELLED:H.OPERATION_CANCELLED,FACEGATE_TIMEOUT:H.OPERATION_TIMEOUT,SDK_NOT_READY:H.SDK_DISPOSED},Ju=e=>typeof e==`string`&&Object.hasOwn(qu,e)?qu[e]:e,Yu=({error:e,fallback:t=H.INTERNAL_ERROR})=>{if(typeof e==`object`&&e&&`code`in e&&Ku(e.code))return e.code;let n=e instanceof Error?e.message:e;return Ku(n)?n:t}})),Zu,Qu,U=t((()=>{Wu(),Xu(),Zu=Vl(Ju,Dl(H)),Qu=z({code:Zu,message:L(),payload:Tl(L(),yl()).optional()})})),$u,ed=t((()=>{$u={"dd.ort":`259d860d37e4d12055a63e17685992265ad7d07e656e7ceb564d6e97464f5066`,"do.ort":`d77468ab16b74fd8268cb9d2179aa7fc7d45a5658d3684128d516b1729fd5776`,"fd.ort":`328a81c28493a21cf65b7be4322b1c16d726c485c59615a916dd2090ae1cedec`,"fdl.ort":`d1367545b14a23ec8f827e00580f06f13467f08bbd7399230f1d44bb423c8e10`,"fdh.ort":`5315c6b22309439a3ba1e853133e3ef7ffd43a8d34910bd35e9eacc3c6cacdd0`,"fl.ort":`fa9272923b5f12d61809ceee5611c698c6527e8603857c108891fa4ec41385bf`,"fe.ort":`d1a3c6d54a24b696e88ee12856624c2ea92b9f014f1c4483eb47788c8a6f1f33`,"flv.ort":`5c7ce2142d6e6477521985a1983de6b796e0425924a5f1c007fe59db8830e07d`,"flw.ort":`cf970d52d521438c0ef60dfd49a9b7297df2c354e6b2a3df495bbf8f04343df3`,"fa.ort":`bd820d7fef3370ebd6cd0a85dbe5ac3ac398b5034d2d18135b77c08767571120`,"fm.ort":`34652e9faf44e8a092aad1613d4c67d6775de3f212f3c68f865059ee2b40876d`,"fmh.ort":`57211303a9ded4edc6d98eefed051e029fe56377beb3be1d790c29adb234681a`,"fmu.ort":`f29c1f06155166bd9aa3c50cdb479d1a224c180d761a2d9c8102b1a759155d9b`,"od.ort":`f47d2359be464ca55c28c9986f1b8bf7ee8b3e9ff86e8ecb25d8b2f8eaa55c9e`,"or.ort":`4c7818163f775a89bddba87569edef3f2964f05855ee600d3a34d02c53715fc7`,"ods.ort":`062ed9d8d3e1dfeca55c15763c850ba701f642199d294f7e14a4ea6110dcc43b`,"ors.ort":`f7b99bfde9d06e8cd6844c26d2a0b3d2bb3b6d0c005f1c8003aa241ff89dc466`,"odm.ort":`0896849bbddb9e447b4ab2dcc3b7e40a76efb97199b7195d85f325340239d0f9`,"orj.ort":`bc9c51ff695f866dfb167219f5e8891e9c420b08fad427fe447e922ee16c3450`,"orcs.ort":`86be3129de7cd6d363d5d69bfe5cda792c188d144deca0f2f26cc83d1da9cc21`,"orct.ort":`9690a26ecf8f8a38dbcf763cd9b8a496fba361339e55bfaddbdd46f4462d4d81`,"orc.ort":`5d3c49fc3b5c376a2f4162156d1c5009d63fa3990d37fb807f33dd3227b3f445`,"ora.ort":`470417d05cd0a99b3345af0b970dd337084c5b79d3562e58f92c2196360f6bda`,"ot.txt":`c5cbe34ef40c29c4df07ed012bf96569cb69a2d2a01a07027e9f13cb832bd9cd`,"ots.txt":`41557512862dfe31970cf22407742b629725461dd84c0d8771bde9c87c2202c8`,"otj.txt":`1dcfcb41eec90576a945b3084f22ade11ced506e24f14879245b071698f308e8`,"otcs.txt":`28b2362ad4ab2dc38769aa72feb535e3a9ddb3fd2a7585a05920e6393b1dc7f7`,"otct.txt":`832551fee1f2fbc97508772d81ebdc8dba12c00de97a35c71c9ddf43ddac1a83`,"otc.txt":`90822a96058eb83f8e637ace75f90cbd36c41253f9dbdfb88fcf5a2bdd50d669`,"ota.txt":`7f92f7dbb9b75a4787a83bfb4f6d14a8ab515525130c9d40a9036f61cf6999e9`}})),td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd=t((()=>{U(),ed(),td=$u,nd=Symbol.for(`voltom.assetCache`),rd=globalThis,id=rd[nd]??{data:new Map,modules:new Map},rd[nd]=id,ad=`https://sdk.voltom.io`,sd=({sdkUrl:e})=>{if(od!==void 0&&od!==e)throw Error(H.INVALID_OPTIONS);od=e},cd=({filename:e})=>{let t=td[e];if(!t&&/\.(onnx|ort|txt)$/.test(e))throw Error(H.MODEL_LOAD_FAILED);let n=t?`models`:`assets`;od??=ad;let r=new URL(`${n}/${e}`,`${od}/`);return t&&r.searchParams.set(`v`,t),r.href},ld=async({filenames:e})=>{let t=[...new Set(e)];await Promise.all(t.map(async e=>{let t=cd({filename:e}),n=id.data.get(t);n||(n=(async()=>{let e=await fetch(t);if(!e.ok)throw Error(H.MODEL_LOAD_FAILED);return new Uint8Array(await e.arrayBuffer())})(),id.data.set(t,n));try{await n}catch(e){throw id.data.get(t)===n&&id.data.delete(t),e}}))},ud=async({filename:e})=>{await ld({filenames:[e]});let t=id.data.get(cd({filename:e}));if(!t)throw Error(H.MODEL_LOAD_FAILED);return await t},dd=async({filename:e,imports:t={}})=>{let n=cd({filename:e}),r=id.modules.get(n);r||(r=(async()=>{let n=await ud({filename:e}),r=new TextDecoder().decode(n);for(let[e,n]of Object.entries(t))r=r.replaceAll(JSON.stringify(e),JSON.stringify(n));return URL.createObjectURL(new Blob([r],{type:`application/javascript`}))})(),id.modules.set(n,r));try{return await r}catch(e){throw id.modules.get(n)===r&&id.modules.delete(n),e}}})),W,pd,md,hd,gd,_d,vd,yd,bd,xd=t((()=>{Wu(),W=L().trim().min(1).nullable(),pd=Vu().nullable(),md=Dl([`MRZ`,`AAMVA`,`OCR`]),hd=Dl([`PASSPORT`,`ID`,`VISA`,`DRV`,`PERMIT`]),gd=Dl([`M`,`F`,`X`]),_d=z({source:md,type:hd.nullable(),issuing_country:W,number:W,issuing_authority:W.default(null),issue_date:pd,expiry_date:pd,optional_data:W}),vd=z({first_name:W,last_name:W,middle_name:W,birth_place:W.default(null),birth_date:pd,sex:gd.nullable(),nationality:W,personal_number:W}),yd=z({full:W,street:W,city:W,state_province:W,postal_code:W}),bd=z({mrz_lines:xl(L().min(1)),aamva_version:W}),z({document:_d,holder:vd,address:yd.nullable(),raw_data:bd})})),G,Sd=t((()=>{Wu(),U(),G={language:`en`,ocrEngine:`auto`,alignment:`eyes-nose-mouth`,maxPitch:8,minPitch:-20,maxYaw:12,minYaw:-12,maxRoll:8,minDocumentFaceAreaRatio:.02,maxDocumentFaceAreaRatio:.3,minDocumentFaceWidthRatio:.075,maxDocumentFaceWidthRatio:.4,minDocumentFaceHeightRatio:.1,maxDocumentFaceHeightRatio:.65,minDocumentBoxRatio:.33,maxDocumentTextAngleDifference:16},z({language:L().default(G.language),ocrEngine:Dl([`auto`,`tiny`,`small`,`japanese`,`chinese-simplified`,`chinese-traditional`,`cyrillic`,`arabic`]).default(G.ocrEngine),alignment:Ol(`eyes-nose-mouth`).default(G.alignment),maxPitch:R().positive().max(90).default(G.maxPitch),minPitch:R().negative().min(-90).default(G.minPitch),maxYaw:R().positive().max(90).default(G.maxYaw),minYaw:R().negative().min(-90).default(G.minYaw),maxRoll:R().positive().max(90).default(G.maxRoll),minDocumentFaceAreaRatio:R().min(0).max(1).default(G.minDocumentFaceAreaRatio),maxDocumentFaceAreaRatio:R().min(0).max(1).default(G.maxDocumentFaceAreaRatio),minDocumentFaceWidthRatio:R().min(0).max(1).default(G.minDocumentFaceWidthRatio),maxDocumentFaceWidthRatio:R().min(0).max(1).default(G.maxDocumentFaceWidthRatio),minDocumentFaceHeightRatio:R().min(0).max(1).default(G.minDocumentFaceHeightRatio),maxDocumentFaceHeightRatio:R().min(0).max(1).default(G.maxDocumentFaceHeightRatio),minDocumentBoxRatio:R().min(0).max(1).default(G.minDocumentBoxRatio),maxDocumentTextAngleDifference:R().min(0).max(90).default(G.maxDocumentTextAngleDifference)}).refine(e=>e.minDocumentFaceAreaRatio<=e.maxDocumentFaceAreaRatio&&e.minDocumentFaceWidthRatio<=e.maxDocumentFaceWidthRatio&&e.minDocumentFaceHeightRatio<=e.maxDocumentFaceHeightRatio,H.INVALID_OPTIONS)})),Cd,wd,Td,Ed,Dd,Od,kd=t((()=>{Cd=({data:e,height:t,normalize:n,width:r})=>{let i=new Float32Array(r*t*3),a=r*t;for(let t=0;t<a;t+=1)for(let r=0;r<3;r+=1)i[r*a+t]=n(e[t*4+r]);return i},wd=({first:e,second:t})=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return n*r/(e.width*e.height+t.width*t.height-n*r||1)},Td=({detections:e,threshold:t})=>e.toSorted((e,t)=>t.score-e.score).filter((e,n,r)=>!r.slice(0,n).some(n=>wd({first:n.boundingRect,second:e.boundingRect})>t)),Ed=({face:e,x:t,y:n})=>({...e,boundingRect:{...e.boundingRect,x:e.boundingRect.x+t,y:e.boundingRect.y+n},mesh:{...e.mesh,landmarks:e.mesh.landmarks.map(e=>({...e,x:e.x+t,y:e.y+n}))}}),Dd=({faces:e})=>{let t=[];for(let n of e)t.some(e=>wd({first:e.boundingRect,second:n.boundingRect})>.3)||t.push(n);return t},Od=({frameSize:e,tileSize:t})=>[...new Set([0,Math.round((e-t)/2),e-t])]})),Ad,jd,Md=t((()=>{kd(),Ad=({outputs:e})=>({score_8:e.out0,score_16:e.out1,score_32:e.out2,bbox_8:e.out3,bbox_16:e.out4,bbox_32:e.out5,kps_8:e.out6,kps_16:e.out7,kps_32:e.out8}),jd=({outputs:e,scale:t,threshold:n=.5})=>{let r=[];for(let i of[8,16,32]){let a=e[`score_${i}`]?.data,o=e[`bbox_${i}`]?.data,s=e[`kps_${i}`]?.data;if(!a||!o||!s)continue;let c=640/i;for(let e=0;e<a.length;e+=1){let l=a[e];if(l<n)continue;let u=Math.floor(e/2),d=u%c*i,f=Math.floor(u/c)*i,p=e*4,m=e*10,h=e=>({x:(d+s[m+e*2]*i)/t,y:(f+s[m+e*2+1]*i)/t});r.push({boundingRect:{x:(d-o[p]*i)/t,y:(f-o[p+1]*i)/t,width:(o[p]+o[p+2])*i/t,height:(o[p+1]+o[p+3])*i/t},score:l,keypoints:{leftEye:h(0),rightEye:h(1),nose:h(2),mouthLeft:h(3),mouthRight:h(4)}})}}return Td({detections:r,threshold:.4})}})),Nd,Pd,Fd,Id,Ld,Rd,zd=t((()=>{U(),Nd=128,Pd=.1,Fd=4,Id=({image:e})=>{let t=65536,n=new Float32Array(t*3);for(let r=0,i=0;r<e.data.length;r+=4,i+=1)n[i]=(e.data[r]??0)/255,n[i+t]=(e.data[r+1]??0)/255,n[i+t*2]=(e.data[r+2]??0)/255;return n},Ld=({polygon:e})=>{let t=e.reduce((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length}),{x:0,y:0}),n=[...e].sort((e,n)=>Math.atan2(e.y-t.y,e.x-t.x)-Math.atan2(n.y-t.y,n.x-t.x)),r=n.reduce((e,t,r)=>t.x+t.y<n[e].x+n[e].y?r:e,0);return n.slice(r).concat(n.slice(0,r))},Rd=({heatmap:e,height:t,width:n})=>{if(e.length!==512*Nd)throw Error(H.INVALID_MODEL_OUTPUT);let r=[],i=1;for(let a=0;a<4;a+=1){let o=a*Nd*Nd,s=-1/0,c=0;for(let t=0;t<16384;t+=1){let n=e[o+t]??-1/0;n>s&&(s=n,c=t)}if(s<Pd)throw Error(H.DOCUMENT_NOT_FOUND);i=Math.min(i,s);let l=c%Nd,u=Math.floor(c/Nd),d=s*.3,f=0,p=0,m=0;for(let t=Math.max(0,u-Fd);t<=Math.min(127,u+Fd);t+=1)for(let n=Math.max(0,l-Fd);n<=Math.min(127,l+Fd);n+=1){let r=e[o+t*Nd+n]??0;r<d||(f+=r,p+=r*n,m+=r*t)}r.push({x:(f?p/f:l)*n/Nd,y:(f?m/f:u)*t/Nd})}if(i<Pd)throw Error(H.DOCUMENT_NOT_FOUND);return Ld({polygon:r})}})),Bd=t((()=>{})),Vd,Hd=t((()=>{Vd={TD1:`TD1`,TD2:`TD2`,TD3:`TD3`,SWISS_DRIVING_LICENSE:`SWISS_DRIVING_LICENSE`,FRENCH_NATIONAL_ID:`FRENCH_NATIONAL_ID`,FRENCH_DRIVING_LICENSE:`FRENCH_DRIVING_LICENSE`}})),Ud,Wd=t((()=>{Ud={AFG:`Afghanistan`,ALB:`Albania`,DZA:`Algeria`,ASM:`American Samoa`,AND:`Andorra`,AGO:`Angola`,AIA:`Anguilla`,ATA:`Antarctica`,ATG:`Antigua and Barbuda`,ARG:`Argentina`,ARM:`Armenia`,ABW:`Aruba`,AUS:`Australia`,AUT:`Austria`,AZE:`Azerbaijan`,BHS:`Bahamas (the)`,BHR:`Bahrain`,BGD:`Bangladesh`,BRB:`Barbados`,BLR:`Belarus`,BEL:`Belgium`,BLZ:`Belize`,BEN:`Benin`,BMU:`Bermuda`,BTN:`Bhutan`,BOL:`Bolivia (Plurinational State of)`,BES:`Bonaire, Sint Eustatius and Saba`,BIH:`Bosnia and Herzegovina`,BWA:`Botswana`,BVT:`Bouvet Island`,BRA:`Brazil`,IOT:`British Indian Ocean Territory (the)`,BRN:`Brunei Darussalam`,BGR:`Bulgaria`,BFA:`Burkina Faso`,BDI:`Burundi`,CPV:`Cabo Verde`,KHM:`Cambodia`,CMR:`Cameroon`,CAN:`Canada`,CYM:`Cayman Islands (the)`,CAF:`Central African Republic (the)`,TCD:`Chad`,CHL:`Chile`,CHN:`China`,CXR:`Christmas Island`,CCK:`Cocos (Keeling) Islands (the)`,COL:`Colombia`,COM:`Comoros (the)`,COD:`Congo (the Democratic Republic of the)`,COG:`Congo (the)`,COK:`Cook Islands (the)`,CRI:`Costa Rica`,HRV:`Croatia`,CUB:`Cuba`,CUW:`Curaçao`,CYP:`Cyprus`,CZE:`Czechia`,CIV:`Côte d'Ivoire`,DNK:`Denmark`,DJI:`Djibouti`,DMA:`Dominica`,DOM:`Dominican Republic (the)`,ECU:`Ecuador`,EGY:`Egypt`,SLV:`El Salvador`,GNQ:`Equatorial Guinea`,ERI:`Eritrea`,EST:`Estonia`,SWZ:`Eswatini`,ETH:`Ethiopia`,FLK:`Falkland Islands (the) [Malvinas]`,FRO:`Faroe Islands (the)`,FJI:`Fiji`,FIN:`Finland`,FRA:`France`,GUF:`French Guiana`,PYF:`French Polynesia`,ATF:`French Southern Territories (the)`,GAB:`Gabon`,GMB:`Gambia (the)`,GEO:`Georgia`,DEU:`Germany`,GHA:`Ghana`,GIB:`Gibraltar`,GRC:`Greece`,GRL:`Greenland`,GRD:`Grenada`,GLP:`Guadeloupe`,GUM:`Guam`,GTM:`Guatemala`,GGY:`Guernsey`,GIN:`Guinea`,GNB:`Guinea-Bissau`,GUY:`Guyana`,HTI:`Haiti`,HMD:`Heard Island and McDonald Islands`,VAT:`Holy See (the)`,HND:`Honduras`,HKG:`Hong Kong`,HUN:`Hungary`,ISL:`Iceland`,IND:`India`,IDN:`Indonesia`,IRN:`Iran (Islamic Republic of)`,IRQ:`Iraq`,IRL:`Ireland`,IMN:`Isle of Man`,ISR:`Israel`,ITA:`Italy`,JAM:`Jamaica`,JPN:`Japan`,JEY:`Jersey`,JOR:`Jordan`,KAZ:`Kazakhstan`,KEN:`Kenya`,KIR:`Kiribati`,PRK:`Korea (the Democratic People's Republic of)`,KOR:`Korea (the Republic of)`,KWT:`Kuwait`,KGZ:`Kyrgyzstan`,LAO:`Lao People's Democratic Republic (the)`,LVA:`Latvia`,LBN:`Lebanon`,LSO:`Lesotho`,LBR:`Liberia`,LBY:`Libya`,LIE:`Liechtenstein`,LTU:`Lithuania`,LUX:`Luxembourg`,MAC:`Macao`,MDG:`Madagascar`,MWI:`Malawi`,MYS:`Malaysia`,MDV:`Maldives`,MLI:`Mali`,MLT:`Malta`,MHL:`Marshall Islands (the)`,MTQ:`Martinique`,MRT:`Mauritania`,MUS:`Mauritius`,MYT:`Mayotte`,MEX:`Mexico`,FSM:`Micronesia (Federated States of)`,MDA:`Moldova (the Republic of)`,MCO:`Monaco`,MNG:`Mongolia`,MNE:`Montenegro`,MSR:`Montserrat`,MAR:`Morocco`,MOZ:`Mozambique`,MMR:`Myanmar`,NAM:`Namibia`,NRU:`Nauru`,NPL:`Nepal`,NLD:`Netherlands (the)`,NCL:`New Caledonia`,NZL:`New Zealand`,NIC:`Nicaragua`,NER:`Niger (the)`,NGA:`Nigeria`,NIU:`Niue`,NFK:`Norfolk Island`,MKD:`North Macedonia`,MNP:`Northern Mariana Islands (the)`,NOR:`Norway`,OMN:`Oman`,PAK:`Pakistan`,PLW:`Palau`,PSE:`Palestine, State of`,PAN:`Panama`,PNG:`Papua New Guinea`,PRY:`Paraguay`,PER:`Peru`,PHL:`Philippines (the)`,PCN:`Pitcairn`,POL:`Poland`,PRT:`Portugal`,PRI:`Puerto Rico`,QAT:`Qatar`,ROU:`Romania`,RUS:`Russian Federation (the)`,RWA:`Rwanda`,REU:`Réunion`,BLM:`Saint Barthélemy`,SHN:`Saint Helena, Ascension and Tristan da Cunha`,KNA:`Saint Kitts and Nevis`,LCA:`Saint Lucia`,MAF:`Saint Martin (French part)`,SPM:`Saint Pierre and Miquelon`,VCT:`Saint Vincent and the Grenadines`,WSM:`Samoa`,SMR:`San Marino`,STP:`Sao Tome and Principe`,SAU:`Saudi Arabia`,SEN:`Senegal`,SRB:`Serbia`,SYC:`Seychelles`,SLE:`Sierra Leone`,SGP:`Singapore`,SXM:`Sint Maarten (Dutch part)`,SVK:`Slovakia`,SVN:`Slovenia`,SLB:`Solomon Islands`,SOM:`Somalia`,ZAF:`South Africa`,SGS:`South Georgia and the South Sandwich Islands`,SSD:`South Sudan`,ESP:`Spain`,LKA:`Sri Lanka`,SDN:`Sudan (the)`,SUR:`Suriname`,SJM:`Svalbard and Jan Mayen`,SWE:`Sweden`,CHE:`Switzerland`,SYR:`Syrian Arab Republic (the)`,TWN:`Taiwan (Province of China)`,TJK:`Tajikistan`,TZA:`Tanzania, the United Republic of`,THA:`Thailand`,TLS:`Timor-Leste`,TGO:`Togo`,TKL:`Tokelau`,TON:`Tonga`,TTO:`Trinidad and Tobago`,TUN:`Tunisia`,TUR:`Turkey`,TKM:`Turkmenistan`,TCA:`Turks and Caicos Islands (the)`,TUV:`Tuvalu`,UGA:`Uganda`,UKR:`Ukraine`,ARE:`United Arab Emirates (the)`,GBR:`United Kingdom of Great Britain and Northern Ireland (the)`,UMI:`United States Minor Outlying Islands (the)`,USA:`United States of America (the)`,URY:`Uruguay`,UZB:`Uzbekistan`,VUT:`Vanuatu`,VEN:`Venezuela (Bolivarian Republic of)`,VNM:`Viet Nam`,VGB:`Virgin Islands (British)`,VIR:`Virgin Islands (U.S.)`,WLF:`Wallis and Futuna`,ESH:`Western Sahara*`,YEM:`Yemen`,ZMB:`Zambia`,ZWE:`Zimbabwe`,ALA:`Åland Islands`,GBD:`British Overseas Territories Citizen`,GBN:`British National (Overseas)`,GBO:`British Overseas Citizen`,GBS:`British Subject`,GBP:`British Protected Person`,RKS:`Republic of Kosovo`,D:`Germany`,XXK:`Kosovo`,EUE:`European Union (EU)`,UNO:`United Nations Organization or one of its officials`,UNA:`United Nations specialized agency or one of its officials`,UNK:`Resident of Kosovo to whom a travel document has been issued by the United Nations Interim Administration Mission in Kosovo (UNMIK)`,XBA:`African Development Bank (ADB)`,XIM:`African Export-Import Bank (AFREXIM bank)`,XCC:`Caribbean Community or one of its emissaries (CARICOM)`,XCE:`Council of Europe`,XCO:`Common Market for Eastern and Southern Africa (COMESA)`,XEC:`Economic Community of West African States (ECOWAS)`,XPO:`International Criminal Police Organization (INTERPOL)`,XES:`Organization of Eastern Caribbean States (OECS)`,XOM:`Sovereign Military Order of Malta or one of its emissaries`,XDC:`Southern African Development Community`,XXA:`Stateless person, as defined in Article 1 of the 1954 Convention Relating to the Status of Stateless Persons`,XXB:`Refugee, as defined in Article 1 of the 1951 Convention Relating to the Status of Refugees as amended by the 1967 Protocol`,XXC:`Refugee, other than as defined under the code XXB above`,XXX:`Person of unspecified nationality, for whom issuing State does not consider it necessary to specify any of the codes XXA, XXB or XXC above, whatever that person’s status may be. This category may include a person who is neither stateless nor a refugee but who is of unknown nationality and legally residing in the State of issue.`,ANT:`Netherlands Antilles`,NTZ:`Neutral Zone`},Object.freeze(Ud)}));function Gd(e){if(e.length!==2)throw Error(`invalid document code: ${e}. must be 2 char length`);let[t,n]=e;return Kd(t,e),qd(n,e),`${t}${n}`}function Kd(e,t){if(!Jd.includes(e)){let e=new Intl.ListFormat(`en-US`,{style:`short`,type:`disjunction`});throw Error(`invalid document code: ${t}. First character must be ${e.format(Jd)}`)}}function qd(e,t){let n=Number.parseInt(e,10);if(Number.isNaN(n))throw Error(`invalid document code number: ${t}. Second character must be a number`)}var Jd,Yd=t((()=>{Jd=[`A`,`B`,`D`]}));function Xd(e){return e.replaceAll(/<+$/g,``).replaceAll(`<`,` `)}var Zd=t((()=>{}));function Qd(e){if(!e.match(/^[A-Z<]+$/))throw Error(`invalid text: ${e}. Must be only alphabetical with <`);return Xd(e)}var $d=t((()=>{Zd()}));function ef(e,t,n=/^[0-9A-Z<]+$/){let r=Xd(e);if(!n.test(e))throw new tf(`invalid text: ${e}. Must match the following regular expression: ${n.toString()}`,r,t,t+r.length);return r}var tf,nf=t((()=>{Zd(),tf=class extends Error{value;start;end;constructor(e,t,n,r){super(e),this.value=t,this.start=n,this.end=r}}}));function rf(e){return cf[e]?cf[e]:e}function af(e){return sf[e]?sf[e]:e}function of(e,t){let n=``,r=[],i=e.split(``);for(let[e,a]of i.entries())if(t.type===K.ALPHABETIC){let i=af(a);i!==a&&r.push({line:t.line,column:t.start+e,original:a,corrected:i}),n+=i}else if(t.type===K.NUMERIC){let i=rf(a);i!==a&&r.push({line:t.line,column:t.start+e,original:a,corrected:i}),n+=i}else n+=a;return{correctedText:n,autocorrect:r}}var sf,cf,lf=t((()=>{pf(),sf={8:`B`,6:`G`,0:`O`,1:`I`,5:`S`,2:`Z`},cf={B:`8`,G:`6`,O:`0`,I:`1`,S:`5`,Z:`2`}}));function uf(e){ff(e,`label`,`string`),e.field!==null&&ff(e,`field`,`string`),ff(e,`line`,`number`),ff(e,`start`,`number`),ff(e,`end`,`number`),ff(e,`parser`,`function`);let t={line:e.line,start:e.start,end:e.end},n=[t];if(Array.isArray(e.related))for(let t of e.related)ff(t,`line`,`number`),ff(t,`start`,`number`),ff(t,`end`,`number`),n.push(t);return{parser:(t,r)=>{let i=df(t,e),a=(e.related||[]).map(e=>df(t,e)),o={label:e.label,field:e.field,value:null,valid:!1,ranges:n.map(e=>({...e,raw:df(t,e)})),line:0,start:0,end:0,autocorrect:[]},s=o.ranges[0];o.line=s.line,o.start=s.start,o.end=s.end;try{let t=e.parser(i,...a);typeof t==`object`?(o.value=t.value,o.valid=t.valid??!0,t.start!==void 0&&(o.start=s.start+t.start),t.end!==void 0&&(o.end=s.start+t.end),t.valid===!1&&t.error&&(o.error=t.error)):(o.value=t,o.valid=!0)}catch(e){o.error=e.message,e instanceof tf&&(o.value=e.value,o.start=s.start+e.start,o.end=s.start+e.end)}for(let e of r)e.line===o.line&&e.column>=o.start&&e.column<o.end&&o.autocorrect.push(e);return o},autocorrector:n=>({...of(df(n,e),e),range:t})}}function df(e,t){return e[t.line].slice(t.start,t.end)}function ff(e,t,n){if(typeof e[t]!==n)throw TypeError(`${String(t)} must be a ${n}`)}var K,pf=t((()=>{nf(),lf(),K={NUMERIC:`NUMERIC`,ALPHABETIC:`ALPHABETIC`,ALPHANUMERIC:`ALPHANUMERIC`}}));function mf(e){let t=0,n=[7,3,1];for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===60&&(i=0),i>=65&&(i-=55),i>=48&&(i-=48),i*=n[r%3],t+=i}return t%10}function hf(e,t){let n=mf(e),r=n===Number(t);return{valid:r,error:r?null:`invalid check digit: ${t}. Must be ${n}`}}var gf=t((()=>{}));function _f(e,...t){return{value:e,...hf(t.join(``),e)}}var vf=t((()=>{gf()}));function yf(e){if(!e.match(/^[0-9<]{4,6}$/))throw Error(`invalid date: ${e}`);let t=e.slice(2,4);if(t!==`<<`&&(Number.parseInt(t,10)<1||Number.parseInt(t,10)>12))throw Error(`invalid date month: ${t}`);if(e.length===6){let t=e.slice(4,6);if(t!==`<<`&&(Number.parseInt(t,10)<1||Number.parseInt(t,10)>31))throw Error(`invalid date day: ${t}`)}return e}var bf=t((()=>{}));function xf(e,t){return{value:e,...hf(t,e)}}var Sf=t((()=>{gf()}));function Cf(e,t,n){let r,i;if(t===`<`&&n){let t=n.indexOf(`<`);i=e+n.slice(0,t-1),r=i.length+1}else i=Xd(e),r=i.length;return{value:i,start:0,end:r}}var wf=t((()=>{Zd()}));function Tf(e,t,n){if(e===`<`&&n){let e=n.indexOf(`<`),r=n.slice(0,e-1),i=n.charAt(e-1),a={value:i,start:e,end:e+1},o=hf(`${t}<${r}`,i);return o.valid||(o=hf(`${t}${r}`,i)),{...a,...o}}return{value:e,...hf(t,e)}}var Ef=t((()=>{gf()}));function Df(e){let t=e.replace(/.*?<{2}/,``),n=ef(t,e.length-t.length,/^[A-Z<]+<*$/),r=e.length-t.length;return{value:n,start:r,end:r+n.length}}var Of=t((()=>{nf()}));function kf(e){let t=ef(e.replace(/<{2}.*$/,``),0,/^[A-Z<]*<*$/);return{value:t,start:0,end:t.length}}var Af=t((()=>{nf()}));function jf(e){switch(e){case`M`:return`male`;case`F`:return`female`;case`<`:return`nonspecified`;default:throw Error(`invalid sex: ${e}. Must be M, F or <.`)}}var Mf=t((()=>{}));function Nf(e){if(e=Xd(e),!Ud[e])throw Error(`invalid state code: ${e}`);return{value:e,start:0,end:e.length}}var Pf=t((()=>{Wd(),Zd()})),Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf=t((()=>{vf(),bf(),Sf(),wf(),Ef(),Of(),Af(),Mf(),Pf(),pf(),Ff={label:`Document number`,field:`documentNumber`,parser:Cf,type:K.ALPHANUMERIC},If={label:`Document number check digit`,field:`documentNumberCheckDigit`,parser:Tf,type:K.NUMERIC},Lf={label:`Document code`,field:`documentCode`,type:K.ALPHABETIC},Rf={label:`Document code`,field:`documentCode`,type:K.ALPHANUMERIC},zf={label:`Nationality`,field:`nationality`,parser:Nf,type:K.ALPHABETIC},Bf={label:`Sex`,field:`sex`,parser:jf,type:K.ALPHABETIC},Vf={label:`Expiration date`,field:`expirationDate`,parser:yf,type:K.NUMERIC},Hf={label:`Expiration date check digit`,field:`expirationDateCheckDigit`,parser:xf,type:K.NUMERIC},Uf={label:`Composite check digit`,field:`compositeCheckDigit`,parser:_f,type:K.NUMERIC},Wf={label:`Birth date`,field:`birthDate`,parser:yf,type:K.NUMERIC},Gf={label:`Birth date check digit`,field:`birthDateCheckDigit`,parser:xf,type:K.NUMERIC},Kf={label:`Issue date`,field:`issueDate`,parser:yf,type:K.NUMERIC},qf={label:`First name`,field:`firstName`,parser:Df,type:K.ALPHABETIC},Jf={label:`Last name`,field:`lastName`,parser:kf,type:K.ALPHABETIC},Yf={label:`Issuing state`,field:`issuingState`,parser:Nf,type:K.ALPHABETIC}})),Zf,Qf=t((()=>{Yd(),$d(),pf(),Xf(),Zf=[{...Rf,line:0,start:0,end:2,parser:Gd},{...Yf,line:0,start:2,end:5},{...Ff,line:0,start:5,end:14},{...If,line:0,start:14,end:15,related:[{line:0,start:0,end:14}]},{...Vf,line:0,start:15,end:21},{...Jf,line:0,start:21,end:29,parser:Qd},{...Uf,line:0,start:29,end:30,related:[{line:0,start:0,end:29}]}],Zf.map(uf)})),$f=t((()=>{Hd(),Qf(),Vd.FRENCH_DRIVING_LICENSE}));function ep(e){let t=e.charAt(0);if(t!==`A`&&t!==`C`&&t!==`I`)throw Error(`invalid document code: ${e}. First character must be A, C or I`);let n=e.charAt(1);if(n===`V`)throw Error(`invalid document code: ${e}. Second character may not be V`);return n===`<`?{value:t,start:0,end:1}:e}var tp=t((()=>{}));function np(e){let t=ef(e,0);return{value:t,start:0,end:t.length}}var rp=t((()=>{nf()})),ip,ap=t((()=>{$d(),tp(),rp(),pf(),Xf(),ip=[{...Lf,line:0,start:0,end:2,parser:ep},{...Yf,line:0,start:2,end:5},{...Jf,line:0,start:5,end:30,parser:Qd},{label:`Administrative code`,field:`administrativeCode`,line:0,start:30,end:36,parser:np},{...Kf,line:1,start:0,end:4},{label:`Administrative code 2`,field:`administrativeCode2`,line:1,start:4,end:7,parser:np},{...Ff,line:1,start:7,end:12},{...If,line:1,start:12,end:13,related:[{line:1,start:0,end:12}]},{...qf,line:1,start:13,end:27,parser:Qd},{...Wf,line:1,start:27,end:33},{...Gf,line:1,start:33,end:34,related:[{line:1,start:27,end:33}]},{...Bf,line:1,start:34,end:35},{...Uf,line:1,start:35,end:36,related:[{line:0,start:0,end:36},{line:1,start:0,end:35}]}],ip.map(uf)})),op=t((()=>{Hd(),ap(),Vd.FRENCH_NATIONAL_ID}));function sp(e){if(!e.match(/^[0-9]+$/))throw Error(`invalid number: ${e}`);return e}var cp=t((()=>{}));function lp(e){if(!e.match(/^<*$/))throw Error(`invalid separator: ${e}. Must be composed only of "<"`);return e}var up=t((()=>{}));function dp(e){if(e!==`FA`)throw Error(`invalid document code: ${e}. Must be FA`);return e}var fp=t((()=>{}));function pp(e){switch(e){case`D`:case`F`:case`I`:case`R`:return e;default:throw Error(`invalid languageCode code: ${e}. Must be D, F, I or R`)}}var mp=t((()=>{}));function hp(e){let t=e.slice(0,3),n=e.slice(3,6),r=e.charAt(6),i=e.slice(7);if(!t.match(/^[A-Z0-9]{3}$/))throw Error(`invalid document number: ${e}. Must start with three alphanumeric digits`);if(!n.match(/^[0-9]{3}$/))throw Error(`invalid document number: ${e}. Must have numeric digits in positions 4, 5 and 6`);if(i!==`<<`)throw Error(`invalid document number: ${e}. Must end with <<`);return pp(r),{value:e.slice(0,7),start:0,end:7}}var gp=t((()=>{mp()}));function _p(e){if(e!==`CHE`&&e!==`LIE`)throw Error(`invalid state code: ${e}. Must be CHE or LIE`);return e}var vp=t((()=>{})),yp,bp=t((()=>{cp(),up(),fp(),gp(),vp(),mp(),pf(),Xf(),yp=[{...Ff,line:0,start:0,end:9,parser:hp},{label:`Language code`,field:`languageCode`,line:0,start:6,end:7,parser:pp,type:K.ALPHABETIC},{...Lf,line:1,start:0,end:2,parser:dp},{...Yf,line:1,start:2,end:5,parser:_p},{label:`PIN code`,field:`pinCode`,line:1,start:5,end:14,parser:sp,type:K.NUMERIC},{label:`Version number`,field:`versionNumber`,line:1,start:14,end:17,parser:sp,type:K.NUMERIC},{label:`Separator 1`,field:null,line:1,start:17,end:19,parser:lp},{...Wf,line:1,start:19,end:25},{label:`Separator 2`,field:null,line:1,start:25,end:30,parser:lp},{...Jf,line:2,start:0,end:30},{...qf,line:2,start:0,end:30}],yp.map(uf)})),xp=t((()=>{Hd(),bp(),Vd.SWISS_DRIVING_LICENSE}));function Sp(e){let t=ef(e,0);return{value:t,start:0,end:t.length}}var Cp=t((()=>{nf()})),wp,Tp=t((()=>{tp(),Cp(),rp(),pf(),Xf(),wp=[{...Lf,line:0,start:0,end:2,parser:ep},{...Yf,line:0,start:2,end:5},{...Ff,line:0,start:5,end:14,related:[{line:0,start:14,end:15},{line:0,start:15,end:30}]},{...If,line:0,start:14,end:15,related:[{line:0,start:5,end:14},{line:0,start:15,end:30}]},{label:`Optional field 1`,field:`optional1`,line:0,start:15,end:30,related:[],parser:Sp},{...Wf,start:0,end:6,line:1},{...Gf,line:1,start:6,end:7,related:[{line:1,start:0,end:6}]},{...Bf,line:1,start:7,end:8},{...Vf,line:1,start:8,end:14},{...Hf,line:1,start:14,end:15,related:[{line:1,start:8,end:14}]},{...zf,line:1,start:15,end:18},{label:`Optional field 2`,field:`optional2`,line:1,start:18,end:29,parser:np},{...Uf,line:1,start:29,end:30,related:[{line:0,start:5,end:30},{line:1,start:0,end:7},{line:1,start:8,end:15},{line:1,start:18,end:29}]},{...Jf,line:2,start:0,end:30},{...qf,line:2,start:0,end:30}],wp.map(uf)})),Ep=t((()=>{Hd(),Tp(),Vd.TD1})),Dp,Op=t((()=>{tp(),rp(),pf(),Xf(),Dp=[{...Lf,line:0,start:0,end:2,parser:ep},{...Yf,line:0,start:2,end:5},{...Jf,line:0,start:5,end:36},{...qf,line:0,start:5,end:36},{...Ff,line:1,start:0,end:9,related:[{line:1,start:9,end:10},{line:1,start:28,end:35}]},{...If,line:1,start:9,end:10,related:[{line:1,start:0,end:9},{line:1,start:28,end:35}]},{...zf,line:1,start:10,end:13},{...Wf,line:1,start:13,end:19},{...Gf,line:1,start:19,end:20,related:[{line:1,start:13,end:19}]},{...Bf,line:1,start:20,end:21},{...Vf,line:1,start:21,end:27},{...Hf,line:1,start:27,end:28,related:[{line:1,start:21,end:27}]},{label:`Optional field`,field:`optional`,line:1,start:28,end:35,parser:np},{...Uf,line:1,start:35,end:36,related:[{line:1,start:0,end:10},{line:1,start:13,end:20},{line:1,start:21,end:35}]}],Dp.map(uf)})),kp=t((()=>{Hd(),Op(),Vd.TD2}));function Ap(e){let t=e.charAt(0);if(t!==`P`)throw Error(`invalid document code: ${e}. First character must be P`);let n=e.charAt(1);if(!n.match(/[A-Z<]/))throw Error(`invalid document code: ${e}. Second character must be a letter or <`);return n===`<`?{value:t,start:0,end:1}:e}var jp=t((()=>{}));function Mp(e){let t=ef(e,0,/^[A-Z0-9<]+<*$/);return{value:t,start:0,end:t.length}}var Np=t((()=>{nf()}));function Pp(e,t){return Xd(t)===``?e!==`<`&&e!==`0`?{value:e,valid:!1,error:`invalid check digit ${e}: must be 0 or <`}:e:{value:e,...hf(t,e)}}var Fp=t((()=>{gf(),Zd()})),Ip,Lp=t((()=>{jp(),Np(),Fp(),pf(),Xf(),Ip=[{...Lf,line:0,start:0,end:2,parser:Ap},{...Yf,line:0,start:2,end:5},{...Jf,line:0,start:5,end:44},{...qf,line:0,start:5,end:44},{...Ff,line:1,start:0,end:9},{...If,line:1,start:9,end:10,related:[{line:1,start:0,end:9}]},{...zf,line:1,start:10,end:13},{...Wf,line:1,start:13,end:19},{...Gf,line:1,start:19,end:20,related:[{line:1,start:13,end:19}]},{...Bf,line:1,start:20,end:21},{...Vf,line:1,start:21,end:27},{...Hf,line:1,start:27,end:28,related:[{line:1,start:21,end:27}]},{label:`Personal number`,field:`personalNumber`,line:1,start:28,end:42,parser:Mp},{label:`Personal number check digit`,field:`personalNumberCheckDigit`,line:1,start:42,end:43,related:[{line:1,start:28,end:42}],parser:Pp},{...Uf,line:1,start:43,end:44,related:[{line:1,start:0,end:10},{line:1,start:13,end:20},{line:1,start:21,end:43}]}],Ip.map(uf)})),Rp=t((()=>{Hd(),Lp(),Vd.TD3})),zp=t((()=>{$f(),op(),xp(),Ep(),kp(),Rp()})),Bp=t((()=>{zp()})),Vp=t((()=>{Bd(),Hd(),Wd(),Bp()})),Hp=t((()=>{Wu()})),Up=t((()=>{Vp(),U(),xd(),Hp()})),Wp,Gp,Kp=t((()=>{Wp=({polygon:e,sourceOrientation:t=0})=>{let n=e.reduce((t,n)=>({x:t.x+n.x/e.length,y:t.y+n.y/e.length}),{x:0,y:0}),r=[...e].sort((e,t)=>Math.atan2(e.y-n.y,e.x-n.x)-Math.atan2(t.y-n.y,t.x-n.x)),i=(r.reduce((e,t,n)=>t.x+t.y<r[e].x+r[e].y?n:e,0)+t/90)%4;return r.slice(i).concat(r.slice(0,i))},Gp=({polygon:e})=>{let t=e.map(e=>e.x),n=e.map(e=>e.y),r=Math.min(...t),i=Math.min(...n);return{x:r,y:i,width:Math.max(...t)-r,height:Math.max(...n)-i}}})),qp=t((()=>{U()})),Jp=t((()=>{U()})),Yp,Xp=t((()=>{Yp=({face:e,polygon:t})=>{if(!e)return!1;let n={x:e.boundingRect.x+e.boundingRect.width/2,y:e.boundingRect.y+e.boundingRect.height/2},r=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let a=t[e],o=t[i];a.y>n.y!=o.y>n.y&&n.x<(o.x-a.x)*(n.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}})),Zp,Qp=t((()=>{Wu(),Zp=L().regex(/^data:image\/jpeg;base64,(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/).meta({format:`data-url`,contentEncoding:`base64`,contentMediaType:`image/jpeg`})})),$p,em,tm=t((()=>{Wu(),$p=[`pass`,`fail`,`error`],em=Dl($p)})),nm,rm,im,am=t((()=>{Wu(),U(),tm(),nm=z({resultId:gl(),token:L().min(32).max(128),action:L().min(1).max(255),expiresAt:Bu({offset:!0})}),rm=Dl([`pending`,`consumed`,`resolved`,`expired`,`failed`]),im=Tl(L(),yl()),z({resultId:gl(),product:Dl([`facegate`,`facekey`,`verify`]),subjectId:L().nullable(),action:L(),status:rm,outcome:em.nullable(),reason:Zu.nullable(),metadata:L().nullable(),documentCode:L().nullable(),createdAt:Bu({offset:!0}),expiresAt:Bu({offset:!0}),consumedAt:Bu({offset:!0}).nullable(),resolvedAt:Bu({offset:!0}).nullable(),result:im.nullable()})})),om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm,Em,Dm,Om,km=t((()=>{Wu(),U(),Qp(),am(),om=[`faceStraight`,`faceUp`,`faceLeft`,`faceRight`,`faceSmile`],sm={faceDown:{pitch:20},faceLeft:{yaw:30},faceRight:{yaw:-30},faceTiltLeft:{roll:15},faceTiltRight:{roll:-15},faceUp:{pitch:-20}},cm=Dl(om),lm=L().min(1).max(255),um=z({id:gl()}),dm=z({id:lm}),fm=Dl([`enroll`,`unlock`,`forget`]),pm=Dl([`enroll`,`unlock`]),mm=Dl([`pending`,`started`,`failed`,`completed`]),hm=z({token:L().min(32).max(128),subjectId:lm.optional()}),gm=hm.extend({poses:xl(cm).min(1).max(om.length),faces:xl(Zp).min(1).max(om.length)}),_m=xl(R().finite()).length(512).refine(e=>Math.abs(Math.hypot(...e)-1)<.001),vm=El(cm,_m).and(z({faceStraight:_m})),ym=z({pose:cm,matched:vl(),score:R().min(-1).max(1)}),bm=xl(cm).min(1).max(om.length).refine(e=>e[0]===`faceStraight`&&new Set(e).size===e.length),xm=z({action:pm,subjectId:lm.optional(),poses:bm.optional()}).refine(e=>e.action===`enroll`||e.subjectId!==void 0&&e.poses===void 0),Sm=z({subjectId:lm}).strict(),Cm=z({subjectId:lm}),wm=nm.extend({subjectId:lm,action:pm,poses:xl(cm).max(om.length)}),Tm=Cm.extend({matched:vl(),matches:xl(ym).max(2),reason:Zu.nullable()}),Em=z({vectors:xl(z({pose:cm,vector:_m})).max(om.length),reason:Zu.nullable(),attributes:z({age:R(),gender:Dl([`female`,`male`]),genderScore:R()}).nullable().optional()}),Dm={id:um,identityId:dm,pose:cm,subjectId:lm,action:fm,tokenAction:pm,status:mm,tokenInput:hm,captureInput:gm,vector:_m,vectors:vm,intentInput:xm,forgetInput:Sm,listInput:z({search:L().default(``)}),identity:Cm,intent:wm,unlock:Tm,analysisResult:Em,intentStatus:z({resultId:L().uuid(),action:fm,subjectId:lm,status:mm})},z({subject_id:L(),created_at:L(),operations_count:R().int()}),Om=z({origin:L().nullable(),ip:L().nullable(),user_agent:L().nullable(),timezone:L().nullable(),country:L().nullable(),region:L().nullable(),city:L().nullable()}),z({subject_id:L(),created_at:L(),operations:xl(z({created_at:L(),action:Dm.action})),registration:Om.nullable(),last_unlock:Om.nullable()}),z({enrollments:R().int(),operations:xl(z({created_at:L(),action:Dm.action,status:Dm.status,country:L().nullable()}))})})),Am,jm,Mm=t((()=>{Am=.2,jm=({blendshapes:e})=>{let t=e.eyeBlinkLeft??0,n=e.eyeBlinkRight??0;return Math.round((t-n)*100)/100>=Am}})),Nm,Pm,Fm,Im,Lm=t((()=>{km(),Mm(),Nm=({axis:e,target:t,tolerance:n,value:r})=>r>=t-n&&r<=t+n?null:e===`yaw`?t>0?r<t?`FACEKEY_TURN_HEAD_LEFT`:`FACEKEY_TURN_HEAD_LESS`:r>t?`FACEKEY_TURN_HEAD_RIGHT`:`FACEKEY_TURN_HEAD_LESS`:e===`pitch`?t>0?r<t?`FACEKEY_LOWER_HEAD`:`FACEKEY_LOWER_HEAD_LESS`:r>t?`FACEKEY_RAISE_HEAD`:`FACEKEY_RAISE_HEAD_LESS`:t>0?r<t?`FACEKEY_TILT_HEAD_LEFT`:`FACEKEY_TILT_HEAD_LESS`:r>t?`FACEKEY_TILT_HEAD_RIGHT`:`FACEKEY_TILT_HEAD_LESS`,Pm=({pitch:e,yaw:t,roll:n,options:r})=>n<-r.maxRoll?`FACEKEY_TILT_HEAD_LEFT`:n>r.maxRoll?`FACEKEY_TILT_HEAD_RIGHT`:t<r.minYaw?`FACEKEY_TURN_HEAD_LEFT`:t>r.maxYaw?`FACEKEY_TURN_HEAD_RIGHT`:e<r.minPitch?`FACEKEY_LOWER_HEAD`:e>r.maxPitch?`FACEKEY_RAISE_HEAD`:null,Fm=({blendshapes:e,pitch:t,yaw:n,roll:r,pose:i,options:a})=>{if(i===`faceSmile`)return Pm({pitch:t,yaw:n,roll:r,options:a})||((e.mouthSmileLeft??0)>=.5&&(e.mouthSmileRight??0)>=.5?null:`FACEKEY_SMILE_REQUIRED`);if(i===`faceWinkLeft`)return Pm({pitch:t,yaw:n,roll:r,options:a})||(jm({blendshapes:e,pose:i})?null:`FACEKEY_WINK_LEFT_REQUIRED`);let o=sm[i];if(!o)return Pm({pitch:t,yaw:n,roll:r,options:a});if(o.roll===void 0){if(r<-a.maxRoll)return`FACEKEY_TILT_HEAD_LEFT`;if(r>a.maxRoll)return`FACEKEY_TILT_HEAD_RIGHT`}if(o.yaw===void 0){if(n<a.minYaw)return`FACEKEY_TURN_HEAD_LEFT`;if(n>a.maxYaw)return`FACEKEY_TURN_HEAD_RIGHT`}if(o.pitch===void 0){if(t<a.minPitch)return`FACEKEY_LOWER_HEAD`;if(t>a.maxPitch)return`FACEKEY_RAISE_HEAD`}let s=a.tolerance??15;return o.roll===void 0?o.yaw===void 0?o.pitch===void 0?null:Nm({axis:`pitch`,target:o.pitch,tolerance:s,value:t}):Nm({axis:`yaw`,target:o.yaw,tolerance:s,value:n}):o.roll>0&&r<=a.maxRoll?`FACEKEY_TILT_HEAD_LEFT`:o.roll<0&&r>=-a.maxRoll?`FACEKEY_TILT_HEAD_RIGHT`:Nm({axis:`roll`,target:o.roll,tolerance:s,value:r})},Im=({alignment:e,target:t})=>{let n=`yaw`;for(let r of[`pitch`,`roll`])Math.abs(e[r]-t[r])>Math.abs(e[n]-t[n])&&(n=r);return Nm({axis:n,value:e[n],target:t[n],tolerance:15})}})),Rm,zm=t((()=>{Rm=.51})),Bm,Vm,Hm,Um=t((()=>{U(),zm(),Bm=({first:e,second:t})=>{if(e.length!==t.length||e.length===0)throw Error(H.INVALID_MODEL_OUTPUT);let n=e.reduce((e,n,r)=>e+n*t[r],0);return Math.max(-1,Math.min(1,n))},Vm=({score:e,threshold:t=Rm})=>({matched:e>t,score:Math.round(e*100)/100}),Hm=({first:e,second:t})=>Math.max(Bm({first:e.rgb,second:t.rgb}),Bm({first:e.grayscale,second:t.grayscale}))})),Wm,Gm=t((()=>{Wm=({homography:e,point:t})=>{let n=e[6]*t.x+e[7]*t.y+e[8];return{x:(e[0]*t.x+e[1]*t.y+e[2])/n,y:(e[3]*t.x+e[4]*t.y+e[5])/n}}})),Km=t((()=>{Lm(),Mm()})),qm=t((()=>{Vp()})),Jm=t((()=>{km()})),Ym=t((()=>{Vp(),Up(),qm()})),Xm=t((()=>{xd(),Sd(),Md(),zd(),Up(),qp(),Jp(),Xp(),kd(),Lm(),Um(),Gm(),Km(),qm(),Jm(),Ym()}));fd(),Xm();var Zm=({canvas:e})=>{e.width=1,e.height=1},Qm=({category:e,duration:t,key:n})=>{};U();var $m=({outputs:e})=>{for(let t of new Set(Object.values(e)))t.dispose()},eh=async({label:e,session:t,feeds:n})=>{let r=performance.now();try{return await t.run(n)}catch(e){throw Error(Yu({error:e,fallback:H.INFERENCE_FAILED}),{cause:e})}finally{for(let e of new Set(Object.values(n)))e.dispose();Qm({category:`inference`,duration:performance.now()-r,key:e})}};U();var th=224,nh=256,rh=[0,90,180,270],ih=[.485,.456,.406],ah=[.229,.224,.225],oh=({runtime:e})=>{let t=async()=>{await e.session({filename:`do.ort`})},n=({frame:t,boundingRect:n={x:0,y:0,width:t.width,height:t.height}})=>{let r=Math.max(0,Math.floor(n.x)),i=Math.max(0,Math.floor(n.y)),a=Math.min(t.width,Math.ceil(n.x+n.width))-r,o=Math.min(t.height,Math.ceil(n.y+n.height))-i;if(a<=0||o<=0)throw Error(H.IMAGE_PROCESSING_FAILED);let s=nh/Math.min(a,o),c=Math.round(a*s),l=Math.round(o*s),u=e.createCanvas(th,th),d=u.getContext(`2d`,{willReadFrequently:!0});if(!d)throw Error(H.IMAGE_PROCESSING_FAILED);d.drawImage(t,r,i,a,o,-Math.floor((c-th)/2),-Math.floor((l-th)/2),c,l);let{data:f}=d.getImageData(0,0,th,th);Zm({canvas:u});let p=50176,m=new Float32Array(p*3);for(let e=0;e<3;e+=1)for(let t=0;t<p;t+=1)m[e*p+t]=(f[t*4+e]/255-ih[e])/ah[e];return m};return{detectDocumentOrientation:async({frame:t,boundingRect:r})=>{let i=await e.session({filename:`do.ort`}),a=n({frame:t,boundingRect:r}),o=await eh({label:`document.orientation`,session:i,feeds:{x:e.tensor(`float32`,a,[1,3,th,th])}});try{let e=o.fetch_name_0?.data;if(!(e instanceof Float32Array)||e.length!==4||e.some(e=>!Number.isFinite(e)||e<0||e>1))throw Error(H.INVALID_MODEL_OUTPUT);let t={0:e[0],90:e[1],180:e[2],270:e[3]},n=rh.reduce((e,n)=>t[n]>t[e]?n:e);return{rotation:n,confidence:t[n],scores:t}}finally{$m({outputs:o})}},loadDocumentOrientationDetector:t}};U(),Kp();var sh=({runtime:e})=>{let{detectDocumentOrientation:t,loadDocumentOrientationDetector:n}=oh({runtime:e}),r=`dd.ort`,i=.15,a=.75,o=.03,s=.8,c=({from:e,to:t})=>Math.hypot(t.x-e.x,t.y-e.y),l=({origin:e,first:t,second:n})=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),u=({polygon:e})=>{let t=0;for(let n=0;n<e.length;n+=1){let r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return Math.abs(t/2)},d=async({frame:t,sourceOrientation:n=0})=>{let i=e.createCanvas(256,256),a=i.getContext(`2d`);if(!a)throw Error(H.IMAGE_PROCESSING_FAILED);a.translate(128,128),a.rotate(-n*Math.PI/180),a.drawImage(t,-128,-128,256,256);let o=a.getImageData(0,0,256,256);Zm({canvas:i});let s=Id({image:{data:o.data,height:256,width:256}}),c=await eh({label:`document.box`,session:await e.session({filename:r}),feeds:{img:e.tensor(`float32`,s,[1,3,256,256])}});try{let e=c.heatmap?.data;if(!(e instanceof Float32Array))throw Error(H.INVALID_MODEL_OUTPUT);try{let r=n%180?t.height:t.width,i=n%180?t.width:t.height;return{confidence:null,polygon:Rd({heatmap:e,height:i,width:r})}}catch(e){if(e instanceof Error&&e.message===H.DOCUMENT_NOT_FOUND)return null;throw e}}finally{$m({outputs:c})}},f=async({frame:e})=>{let n=await d({frame:e}),r=null;if(n){let i=Gp({polygon:n.polygon});i.width>0&&i.height>0&&(r=await t({frame:e,boundingRect:i}),r.rotation&&(n=await d({frame:e,sourceOrientation:r.rotation})))}let i=r!==null&&r.rotation%180!=0;return{detected:n,orientation:r,width:i?e.height:e.width,height:i?e.width:e.height}},p=({detection:e,frame:t,orientation:n})=>{let r=e.polygon.map(({x:e,y:r})=>n?.rotation===90?{x:t.width-1-r,y:e}:n?.rotation===180?{x:t.width-1-e,y:t.height-1-r}:n?.rotation===270?{x:r,y:t.height-1-e}:{x:e,y:r}),i=Wp({polygon:r});return{polygon:i,boundingRect:Gp({polygon:i}),...n?{orientation:n}:{}}},m=({frame:t})=>{let n=Math.min(1,480/Math.max(t.width,t.height)),r=e.createCanvas(Math.max(1,Math.round(t.width*n)),Math.max(1,Math.round(t.height*n))),i=r.getContext(`2d`,{willReadFrequently:!0});if(!i)throw Error(H.IMAGE_PROCESSING_FAILED);return i.drawImage(t,0,0,r.width,r.height),{canvas:r,scale:n}},h=({data:e})=>{let t=new Uint8Array(e.length/4);for(let n=0;n<t.length;n+=1){let r=n*4;t[n]=Math.round(e[r]*.299+e[r+1]*.587+e[r+2]*.114)}return t},g=({pixels:e,width:t,height:n})=>{let r=0,i=0,a=0;for(let o=1;o<n-1;o+=1)for(let n=1;n<t-1;n+=1){let s=e[o*t+n]*8-(e[(o-1)*t+n]+e[(o+1)*t+n]+e[o*t+n-1]+e[o*t+n+1]+e[(o-1)*t+n-1]+e[(o-1)*t+n+1]+e[(o+1)*t+n-1]+e[(o+1)*t+n+1]);i+=s,a+=s*s,r+=1}if(!r)return 0;let o=i/r;return Math.max(0,a/r-o*o)},_=({previous:e,current:t,next:n})=>{let r=e.x-t.x,i=e.y-t.y,a=n.x-t.x,o=n.y-t.y,s=Math.hypot(r,i)*Math.hypot(a,o);return s?Math.acos(Math.max(-1,Math.min(1,(r*a+i*o)/s)))*180/Math.PI:0},v=({first:e,second:t})=>{let n=Math.hypot(e.x,e.y),r=Math.hypot(t.x,t.y);if(!n||!r)return 90;let i=Math.abs(e.x*t.y-e.y*t.x)/(n*r);return Math.asin(Math.min(1,i))*180/Math.PI},y=({first:e,second:t})=>Math.min(e,t)/Math.max(e,t),b=({polygon:e})=>{if(e.length!==4||e.some(e=>!Number.isFinite(e.x)||!Number.isFinite(e.y)))return!1;let t=e.map((t,n)=>c({from:t,to:e[(n+1)%e.length]}));if(t.some(e=>e<=0))return!1;let n=e.map((t,n)=>l({origin:t,first:e[(n+1)%e.length],second:e[(n+2)%e.length]}));if(!n.every(e=>e>0)&&!n.every(e=>e<0))return!1;let r=e.map((t,n)=>{let r=e[(n+1)%e.length];return{x:r.x-t.x,y:r.y-t.y}}),i=v({first:r[0],second:r[2]})<=36&&v({first:r[1],second:r[3]})<=36,a=y({first:t[0],second:t[2]})>=s&&y({first:t[1],second:t[3]})>=s;return i&&a},x=({height:e,minDocumentBoxRatio:t,polygon:n,width:r})=>{if(n.length!==4)return{detection:null,rejection:`polygon_invalid`};if(!b({polygon:n}))return{detection:null,rejection:`geometry`};let i=r,s=e;if(n.map((e,t)=>_({previous:n[(t-1+n.length)%n.length],current:e,next:n[(t+1)%n.length]})).some(e=>e<35||e>145))return{detection:null,rejection:`corner_angle`};let l=[c({from:n[0],to:n[1]}),c({from:n[2],to:n[3]})],d=[c({from:n[1],to:n[2]}),c({from:n[3],to:n[0]})],f=(l[0]+l[1])/2,p=(d[0]+d[1])/2,m=Math.max(f,p)/Math.min(f,p),h=u({polygon:n})/(i*s);if(m<1.25||m>2.4)return{detection:null,rejection:`aspect_ratio`};if(h<t)return{detection:null,rejection:`coverage_low`};if(h>.99)return{detection:null,rejection:`coverage_high`};let g=n.some(e=>e.x<i*o||e.y<s*o||e.x>i*.97||e.y>s*.97);if(h>a&&g)return{detection:null,rejection:`edge_proximity`};let v=n.some(e=>e.y<s*o)&&n.some(e=>e.y>s*.97)||n.some(e=>e.x<i*o)&&n.some(e=>e.x>i*.97);if(i>s&&v&&h<a)return{detection:null,rejection:`opposite_edges`};let y=n,x=y.map(e=>e.x),S=y.map(e=>e.y),C=Math.min(...x),w=Math.min(...S),T=Math.max(...x),ee=Math.max(...S);return{detection:{polygon:y,boundingRect:{x:C,y:w,width:T-C,height:ee-w}},rejection:null}},S=async()=>{await e.session({filename:r})},C=async({frame:e,minDocumentBoxRatio:t=i})=>{let{canvas:n}=m({frame:e}),r=n.getContext(`2d`,{willReadFrequently:!0});if(!r)throw Error(H.IMAGE_PROCESSING_FAILED);let a=r.getImageData(0,0,n.width,n.height),o=n.width,s=n.height;Zm({canvas:n});let c=h({data:a.data}),l=g({pixels:c,width:o,height:s}),{detected:u,orientation:d,width:_,height:v}=await f({frame:e}),y=u?x({height:v,minDocumentBoxRatio:t,polygon:u.polygon,width:_}):{detection:null,rejection:null},b={};return y.rejection&&(b[y.rejection]=1),{detection:y.detection?p({detection:y.detection,frame:e,orientation:d}):null,diagnostics:{accepted:+!!y.detection,confidence:u?.confidence??null,rejected:b},isBlurry:l<1e3,sharpness:l}};return{loadDocumentBoxDetector:S,detectDocumentOrientation:t,loadDocumentOrientationDetector:n,analyzeDocument:C,detectDocument:async e=>(await C({frame:e})).detection,detectDocumentBox:async e=>{let t=await d({frame:e});if(!t)return null;let n=x({height:e.height,minDocumentBoxRatio:i,polygon:t.polygon,width:e.width});return n.detection?p({detection:n.detection,frame:e,orientation:null}):null}}},ch={high:`fdh.ort`,standard:`fd.ort`,low:`fdl.ort`},lh={ageGender:`fa.ort`},uh={standard:`flv.ort`,wide:`flw.ort`};Xm();var dh=({detection:e,frame:t})=>{let n=Math.max(e.boundingRect.width,e.boundingRect.height)*1.1,r=Math.max(1,Math.min(Math.ceil(n),t.width,t.height)),i=e.boundingRect.x+e.boundingRect.width/2,a=e.boundingRect.y+e.boundingRect.height/2;return{size:r,x:Math.max(0,Math.min(t.width-r,Math.round(i-r/2))),y:Math.max(0,Math.min(t.height-r,Math.round(a-r/2)))}},fh=({runtime:e,imageFromImageBitmap:t})=>{let n=`_neutral.browDownLeft.browDownRight.browInnerUp.browOuterUpLeft.browOuterUpRight.cheekPuff.cheekSquintLeft.cheekSquintRight.eyeBlinkLeft.eyeBlinkRight.eyeLookDownLeft.eyeLookDownRight.eyeLookInLeft.eyeLookInRight.eyeLookOutLeft.eyeLookOutRight.eyeLookUpLeft.eyeLookUpRight.eyeSquintLeft.eyeSquintRight.eyeWideLeft.eyeWideRight.jawForward.jawLeft.jawOpen.jawRight.mouthClose.mouthDimpleLeft.mouthDimpleRight.mouthFrownLeft.mouthFrownRight.mouthFunnel.mouthLeft.mouthLowerDownLeft.mouthLowerDownRight.mouthPressLeft.mouthPressRight.mouthPucker.mouthRight.mouthRollLower.mouthRollUpper.mouthShrugLower.mouthShrugUpper.mouthSmileLeft.mouthSmileRight.mouthStretchLeft.mouthStretchRight.mouthUpperUpLeft.mouthUpperUpRight.noseSneerLeft.noseSneerRight`.split(`.`),r=[0,1,4,5,6,7,8,10,13,14,17,21,33,37,39,40,46,52,53,54,55,58,61,63,65,66,67,70,78,80,81,82,84,87,88,91,93,95,103,105,107,109,127,132,133,136,144,145,146,148,149,150,152,153,154,155,157,158,159,160,161,162,163,168,172,173,176,178,181,185,191,195,197,234,246,249,251,263,267,269,270,276,282,283,284,285,288,291,293,295,296,297,300,308,310,311,312,314,317,318,321,323,324,332,334,336,338,356,361,362,365,373,374,375,377,378,379,380,381,382,384,385,386,387,388,389,390,397,398,400,402,405,409,415,454,466,468,469,470,471,472,473,474,475,476,477],i=`standard`,a=({frame:e,height:n,width:r})=>t({frame:e,height:n,width:r}).data,o=({outputs:e,scale:t,threshold:n})=>{let r=[];for(let i of[8,16,32]){let a=e[`score_${i}`]??e[`cls_${i}`],o=e[`bbox_${i}`],s=e[`kps_${i}`],c=e[`obj_${i}`];if(!a||!o||!s)continue;let l=a.data,u=c?.data,d=o.data,f=s.data,p=640/i;for(let e=0;e<l.length;e+=1){let a=l[e]*(u?u[e]:1);if(a<n)continue;let o=Math.floor(e/2),s=(o%p+.5)*i,c=(Math.floor(o/p)+.5)*i,m=e*4,h=e*10,g=e=>({x:(s+f[h+e*2]*i)/t,y:(c+f[h+e*2+1]*i)/t});r.push({boundingRect:{x:(s-d[m]*i)/t,y:(c-d[m+1]*i)/t,width:(d[m]+d[m+2])*i/t,height:(d[m+1]+d[m+3])*i/t},score:a,keypoints:{leftEye:g(0),rightEye:g(1),nose:g(2),mouthLeft:g(3),mouthRight:g(4)}})}}return Td({detections:r,threshold:.4})},s=async({frame:t,faceDetector:n})=>{let r=640/Math.max(t.width,t.height),i=Math.round(t.width*r),s=Math.round(t.height*r),c=a({frame:t,height:s,width:i}),l=Cd({data:c,height:s,width:i,normalize:e=>(e-127.5)/128}),u=new Float32Array(1228800);for(let e=0;e<3;e+=1)for(let t=0;t<s;t+=1)u.set(l.subarray(e*i*s+t*i,e*i*s+(t+1)*i),e*640*640+t*640);let d=await e.session({filename:ch[n]}),f=await eh({label:`face.detector`,session:d,feeds:{[d.inputNames[0]]:e.tensor(`float32`,u,[1,3,640,640])}});try{return n===`standard`?jd({outputs:Ad({outputs:f}),scale:r,threshold:.5}):o({outputs:f,scale:r,threshold:.5})}finally{$m({outputs:f})}},c=async({frame:t})=>{let n=a({frame:t,height:128,width:128}),r=new Float32Array(49152);for(let e=0;e<49152;e+=1)r[e]=n[Math.floor(e/3)*4+e%3]/127.5-1;let i=await e.session({filename:ch.low}),o=await eh({label:`face.detector`,session:i,feeds:{[i.inputNames[0]]:e.tensor(`float32`,r,[1,128,128,3])}});try{let e=o.regressors.data,n=o.classificators.data,r=[],i=[];for(let{count:e,copies:t}of[{count:16,copies:2},{count:8,copies:6}])for(let n=0;n<e;n+=1)for(let r=0;r<e;r+=1)for(let a=0;a<t;a+=1)i.push({x:(r+.5)/e,y:(n+.5)/e});for(let a=0;a<n.length;a+=1){let o=1/(1+Math.exp(-n[a]));if(o<.5)continue;let s=a*16,c=i[a];if(!c)continue;let l=n=>({x:(e[s+5+n*2]+c.x*128)*(t.width/128),y:(e[s+4+n*2]+c.y*128)*(t.height/128)}),u=e[s+3]*(t.width/128),d=e[s+2]*(t.height/128),f=(e[s+1]+c.x*128)*(t.width/128),p=(e[s]+c.y*128)*(t.height/128);r.push({boundingRect:{x:f-u/2,y:p-d/2,width:u,height:d},score:o,keypoints:{leftEye:l(0),rightEye:l(1),nose:l(2),mouthLeft:l(3),mouthRight:l(4)}})}return Td({detections:r,threshold:.3})}finally{$m({outputs:o})}},l=async({blendshapes:i=!0,detection:a,frame:o})=>{let{size:s,x:c,y:l}=dh({detection:a,frame:o}),u=t({frame:o,height:256,width:256,sourceRect:{x:c,y:l,width:s,height:s}}).data,d=await e.session({filename:`fl.ort`}),f=await eh({label:`face.landmarks`,session:d,feeds:{[d.inputNames[0]]:e.tensor(`float32`,Cd({data:u,height:256,width:256,normalize:e=>e/255}),[1,3,256,256])}});try{if(f.score.data[0]<.5)return null;let t=f.landmarks.data,u=Array.from({length:478},(e,n)=>({x:c+t[n*3]*s/256,y:l+t[n*3+1]*s/256,z:t[n*3+2]*s/256})),d=u[33],p=u[263],m=u[1],h=(m.y-(d.y+p.y)/2)/Math.abs(p.x-d.x)*100,g=(m.x-(d.x+p.x)/2)/Math.abs(p.x-d.x)*100,_=new Float32Array(n.length);if(i){let t=new Float32Array(292);for(let e=0;e<r.length;e+=1){let n=u[r[e]];t[e*2]=n.x,t[e*2+1]=n.y}let n=await e.session({filename:`fe.ort`}),i=await eh({label:`face.blendshape`,session:n,feeds:{[n.inputNames[0]]:e.tensor(`float32`,t,[1,146,2])}});try{_=i[n.outputNames[0]].data}finally{$m({outputs:i})}}return{blendshapes:Object.fromEntries(n.map((e,t)=>[e,_[t]??0])),pitch:h-54,yaw:g-5,roll:Math.atan2(p.y-d.y,p.x-d.x)*180/Math.PI,boundingRect:a.boundingRect,mesh:{height:o.height,landmarks:u,width:o.width}}}finally{$m({outputs:f})}},u=async({faceDetector:t=`standard`}={})=>{i=t,await Promise.all([e.session({filename:ch[t]}),e.session({filename:`fl.ort`}),e.session({filename:`fe.ort`})])},d=async({blendshapes:e=!0,frame:t})=>{let n=i===`low`?await c({frame:t}):await s({frame:t,faceDetector:i});return(await Promise.all(n.map(n=>l({blendshapes:e,detection:n,frame:t})))).filter(e=>e!==null)},f=async e=>(await d({frame:e}))[0]??null,p=async({blendshapes:t=!0,frame:n,tileHeight:r,tileWidth:i})=>{let a=[];for(let o of Od({frameSize:n.height,tileSize:r}))for(let s of Od({frameSize:n.width,tileSize:i})){let c=await e.createImageBitmap(n,s,o,i,r);try{let e=await d({blendshapes:t,frame:c});a.push(...e.map(e=>Ed({face:e,x:s,y:o})))}finally{c.close()}}return a},m=async({blendshapes:e=!0,frame:t})=>await p({blendshapes:e,frame:t,tileHeight:Math.ceil(t.height/2),tileWidth:Math.ceil(t.width/2)}),h=async({frame:e})=>{let t=await d({blendshapes:!1,frame:e}),n=await p({blendshapes:!1,frame:e,tileHeight:Math.ceil(e.height*.4),tileWidth:Math.ceil(e.width*.4)});return Dd({faces:[...t,...n]})},g=({detection:e,x:t,y:n})=>({...e,boundingRect:{...e.boundingRect,x:e.boundingRect.x+t,y:e.boundingRect.y+n},keypoints:Object.fromEntries(Object.entries(e.keypoints).map(([e,r])=>[e,{x:r.x+t,y:r.y+n}]))}),_=async({frame:t,tileHeight:n,tileWidth:r})=>{let i=[];for(let a of Od({frameSize:t.height,tileSize:n}))for(let o of Od({frameSize:t.width,tileSize:r})){let s=await e.createImageBitmap(t,o,a,r,n);try{let e=await c({frame:s});i.push(...e.map(e=>g({detection:e,x:o,y:a})))}finally{s.close()}}return i},v=async({frame:e})=>{let t=await c({frame:e}),n=await _({frame:e,tileHeight:Math.ceil(e.height*.4),tileWidth:Math.ceil(e.width*.4)});return Td({detections:[...t,...n],threshold:.3})},y=async(e,t={})=>{let n=await d({blendshapes:t.blendshapes,frame:e});if(i!==`low`&&(!t.forMatch||n.length>0))return n;let r=await m({blendshapes:t.blendshapes,frame:e});return Dd({faces:[...n,...r]})},b=({detection:e,face:t})=>Yp({face:t,polygon:e.polygon});return{loadFaceDetector:u,detectFace:f,detectPictureFaces:y,faceIsInsideDocument:b,detectDocumentFaces:async({detection:t,frame:n})=>{let r=await e.createImageBitmap(n,0,0,Math.ceil(n.width/2),n.height),a;try{a=(i===`low`?await h({frame:r}):await y(r,{blendshapes:!1})).map(e=>({...e,mesh:{...e.mesh,height:n.height,width:n.width}}))}finally{r.close()}return{faces:a.filter(e=>b({detection:t,face:e})).sort((e,t)=>t.boundingRect.width*t.boundingRect.height-e.boundingRect.width*e.boundingRect.height),hasPictureFace:a.length>0,pictureFaces:a}},detectDocumentFacePresence:async({detection:t,frame:n})=>{let r=await e.createImageBitmap(n,0,0,Math.ceil(n.width/2),n.height);try{return(i===`low`?await v({frame:r}):await s({frame:r,faceDetector:i})).some(e=>b({detection:t,face:e}))}finally{r.close()}}}},ph=({detection:e,frame:t,scale:n})=>{let r=e.boundingRect,i=Math.min((t.height-1)/r.height,(t.width-1)/r.width,n),a=r.width*i,o=r.height*i,s=r.x+r.width/2,c=r.y+r.height/2,l=s-a/2,u=c-o/2,d=s+a/2,f=c+o/2;return l<0&&(d-=l,l=0),u<0&&(f-=u,u=0),d>t.width-1&&(l-=d-t.width+1,d=t.width-1),f>t.height-1&&(u-=f-t.height+1,f=t.height-1),{x:l,y:u,width:d-l,height:f-u}},mh=({detection:e,frame:t,scale:n})=>{let r=e.boundingRect,i=Math.min((t.height-1)/r.height,(t.width-1)/r.width,n),a=r.width*i,o=r.height*i,s=r.x+r.width/2,c=r.y+r.height/2,l=s-a/2,u=c-o/2,d=s+a/2,f=c+o/2;l<0&&(d-=l,l=0),u<0&&(f-=u,u=0),d>t.width-1&&(l-=d-t.width+1,d=t.width-1),f>t.height-1&&(u-=f-t.height+1,f=t.height-1);let p=Math.trunc(l),m=Math.trunc(u),h=Math.trunc(d),g=Math.trunc(f);return{x:p,y:m,width:h-p+1,height:g-m+1}},hh=({data:e,height:t,normalize:n,width:r})=>{let i=r*t,a=new Float32Array(i*3);for(let t=0;t<i;t+=1)a[t]=n(e[t*4+2]),a[i+t]=n(e[t*4+1]),a[2*i+t]=n(e[t*4]);return a};U();var gh=({runtime:e})=>({frame:t,height:n=t.height,width:r=t.width,sourceRect:i})=>{let a=e.createCanvas(r,n);try{let e=a.getContext(`2d`,{willReadFrequently:!0});if(!e)throw Error(H.IMAGE_PROCESSING_FAILED);return i?e.drawImage(t,i.x,i.y,i.width,i.height,0,0,r,n):e.drawImage(t,0,0,r,n),{data:e.getImageData(0,0,r,n).data,height:n,width:r}}finally{Zm({canvas:a})}};U();var _h=62,vh=({runtime:e})=>{let t=gh({runtime:e});return{detectFaceAttributes:async({detection:n,frame:r})=>{let i=await e.session({filename:lh.ageGender}),a=ph({detection:n,frame:r,scale:1}),o=t({frame:r,height:_h,width:_h,sourceRect:a}).data,s=await eh({label:`face.attributes`,session:i,feeds:{[i.inputNames[0]]:e.tensor(`float32`,hh({data:o,height:_h,normalize:e=>e,width:_h}),[1,3,_h,_h])}});try{let e=i.outputNames.map(e=>{let t=s[e];if(!t||!(t.data instanceof Float32Array))throw Error(H.INVALID_MODEL_OUTPUT);let n=t.data;if(n.length!==1&&n.length!==2||!n.every(Number.isFinite))throw Error(H.INVALID_MODEL_OUTPUT);return n}),t=e.find(e=>e.length===2),n=e.find(e=>e.length===1);if(e.length!==2||!t||!n)throw Error(H.INVALID_MODEL_OUTPUT);return{age:n[0]*100,gender:t[0]>=t[1]?`female`:`male`,genderScore:Math.max(t[0],t[1])}}finally{$m({outputs:s})}},loadFaceAttributes:async()=>{await e.session({filename:lh.ageGender})}}};U();var yh=80,bh=3,xh=1,Sh=[{filename:uh.standard,label:`face.liveness`,scale:2.7},{filename:uh.wide,label:`face.liveness.wide`,scale:4}],Ch=({values:e})=>{let t=Math.max(...e),n=Array.from(e,e=>Math.exp(e-t)),r=n.reduce((e,t)=>e+t,0);return n.map(e=>e/r)},wh=({values:e})=>{if(!(e instanceof Float32Array)||e.length!==bh)throw Error(H.INVALID_MODEL_OUTPUT);for(let t of e)if(!Number.isFinite(t))throw Error(H.INVALID_MODEL_OUTPUT);return e},Th=({values:e})=>{let t=0;for(let n=1;n<e.length;n+=1)e[n]>e[t]&&(t=n);return t},Eh=({runtime:e})=>{let t=gh({runtime:e});return{detectFaceLiveness:async({detection:n,frame:r})=>{let i=[0,0,0];for(let a of Sh){let o=await e.session({filename:a.filename}),s=mh({detection:n,frame:r,scale:a.scale}),c=t({frame:r,height:yh,width:yh,sourceRect:s}).data,l=await eh({label:a.label,session:o,feeds:{[o.inputNames[0]]:e.tensor(`float32`,hh({data:c,height:yh,normalize:e=>e,width:yh}),[1,3,yh,yh])}});try{let e=Ch({values:wh({values:l[o.outputNames[0]]?.data})});for(let t=0;t<i.length;t+=1)i[t]+=e[t]/Sh.length}finally{$m({outputs:l})}}let a=i[xh];return{live:Th({values:i})===xh,score:a}},loadFaceLiveness:async()=>{await Promise.all(Sh.map(t=>e.session({filename:t.filename})))}}};U(),Kp(),Xm();var Dh=({runtime:e})=>{let{detectDocumentOrientation:t}=oh({runtime:e}),n={left:[33,133],right:[263,362]},r=({matrix:e,values:t})=>{let n=e.map((e,n)=>[...e,t[n]]);for(let e=0;e<n.length;e+=1){let t=e;for(let r=e+1;r<n.length;r+=1)Math.abs(n[r][e])>Math.abs(n[t][e])&&(t=r);if(Math.abs(n[t][e])<1e-8)return null;[n[e],n[t]]=[n[t],n[e]];let r=n[e][e];for(let t=e;t<=n.length;t+=1)n[e][t]/=r;for(let t=0;t<n.length;t+=1){if(t===e)continue;let r=n[t][e];for(let i=e;i<=n.length;i+=1)n[t][i]-=r*n[e][i]}}return n.map(e=>e[n.length])},i=({from:e,to:t})=>{let n=[],i=[];for(let[r,a]of e.entries()){let e=t[r];n.push([a.x,a.y,1,0,0,0,-e.x*a.x,-e.x*a.y]),i.push(e.x),n.push([0,0,0,a.x,a.y,1,-e.y*a.x,-e.y*a.y]),i.push(e.y)}let a=r({matrix:n,values:i});return a?[...a,1]:null},a=Wm,o=({frame:t,polygon:n,rotation:r=0})=>{let a=Gp({polygon:n}),o=Math.max(0,Math.floor(a.x)),s=Math.max(0,Math.floor(a.y)),c=Math.max(1,Math.min(t.width-o,Math.ceil(a.width))),l=Math.max(1,Math.min(t.height-s,Math.ceil(a.height))),u=r%180?l:c,d=r%180?c:l,f=e.createCanvas(u,d),p=f.getContext(`2d`);if(!p)throw Error(H.IMAGE_PROCESSING_FAILED);r===90?(p.translate(0,d),p.rotate(-Math.PI/2)):r===180?(p.translate(u,d),p.rotate(Math.PI)):r===270&&(p.translate(u,0),p.rotate(Math.PI/2)),p.drawImage(t,o,s,c,l,0,0,c,l);let m=o+c,h=s+l,g=i({from:[{x:0,y:0},{x:u,y:0},{x:u,y:d},{x:0,y:d}],to:r===90?[{x:m,y:s},{x:m,y:h},{x:o,y:h},{x:o,y:s}]:r===180?[{x:m,y:h},{x:o,y:h},{x:o,y:s},{x:m,y:s}]:r===270?[{x:o,y:h},{x:o,y:s},{x:m,y:s},{x:m,y:h}]:[{x:o,y:s},{x:m,y:s},{x:m,y:h},{x:o,y:h}]});return g?{frame:f.transferToImageBitmap(),height:d,sourceHeight:t.height,sourceWidth:t.width,toSource:g,width:u}:null},s=async({frame:e,polygon:n,orientation:r})=>{if(n.length!==4)return null;let i=r??await t({frame:e,boundingRect:Gp({polygon:n})}),a=o({frame:e,polygon:n,rotation:i.rotation});return a?{...a,orientation:i}:null},c=({document:e,face:t})=>{let n=t.mesh.landmarks.map(({x:t,y:n,z:r})=>({...a({homography:e.toSource,point:{x:t,y:n}}),z:r})),r=[{x:t.boundingRect.x,y:t.boundingRect.y},{x:t.boundingRect.x+t.boundingRect.width,y:t.boundingRect.y},{x:t.boundingRect.x+t.boundingRect.width,y:t.boundingRect.y+t.boundingRect.height},{x:t.boundingRect.x,y:t.boundingRect.y+t.boundingRect.height}].map(t=>a({homography:e.toSource,point:t})),i=r.map(({x:e})=>e),o=r.map(({y:e})=>e),s={x:Math.min(...i),y:Math.min(...o),width:Math.max(...i)-Math.min(...i),height:Math.max(...o)-Math.min(...o)};return{...t,boundingRect:s,mesh:{...t.mesh,height:e.sourceHeight,landmarks:n,width:e.sourceWidth}}},l=({face:e})=>{let t=e.mesh.landmarks,r=n.left.map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t})),i=n.right.map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t})),a=[13,14].map(e=>t[e]).filter(Boolean).map(({x:e,y:t})=>({x:e,y:t}));return r.length!==2||i.length!==2||a.length!==2?null:{boundingRect:e.boundingRect,mouth:{x:(a[0].x+a[1].x)/2,y:(a[0].y+a[1].y)/2},leftEye:{x:(r[0].x+r[1].x)/2,y:(r[0].y+r[1].y)/2},rightEye:{x:(i[0].x+i[1].x)/2,y:(i[0].y+i[1].y)/2}}},u=({face:e,lines:t,maxAngleDifference:n})=>{let r=Math.atan2(e.rightEye.y-e.leftEye.y,e.rightEye.x-e.leftEye.x)*180/Math.PI,i=0;for(let a of t){let t=Math.abs(a.angle-r)%180,o=Math.min(t,180-t),s=a.box;!(s.y>=e.boundingRect.y&&s.y+s.height<=e.boundingRect.y+e.boundingRect.height)||o>n||s.x>e.boundingRect.x+e.boundingRect.width&&(i+=1)}return i};return{transformPoint:a,orientDocumentFrame:s,restoreRectifiedFace:c,rectifiedDocumentFace:l,documentAlignment:({face:e,lines:t,maxAngleDifference:n,maxFaceAreaRatio:r,maxFaceHeightRatio:i,maxFaceWidthRatio:a,minFaceAreaRatio:o,minFaceHeightRatio:s,minFaceWidthRatio:c,documentSize:l})=>{if(!e)return{faceAdjacentTextLineCount:0,angleDifference:null,eyesAngle:null,faceAreaRatio:0,faceAreaValid:!1,faceDimensionsValid:!1,faceHeightRatio:0,faceWidthRatio:0,textAngle:null,textParallel:!1,textSide:`unknown`};let d=e.boundingRect.width*e.boundingRect.height/(l.width*l.height),f=d>=o&&d<=r,p=e.boundingRect.width/l.width,m=e.boundingRect.height/l.height,h=p>=c&&p<=a&&m>=s&&m<=i,g=Math.atan2(e.rightEye.y-e.leftEye.y,e.rightEye.x-e.leftEye.x)*180/Math.PI,_=t.filter(t=>{let n=t.box;return n.y>=e.boundingRect.y&&n.y+n.height<=e.boundingRect.y+e.boundingRect.height&&n.x>e.boundingRect.x+e.boundingRect.width}),v=_.length?_.reduce((e,t)=>e+t.angle,0)/_.length:null,y=v===null?null:Math.abs(v-g)%180,b=y===null?null:Math.min(y,180-y),x=b!==null&&b<=n;return{faceAdjacentTextLineCount:u({face:e,lines:t,maxAngleDifference:n}),angleDifference:b,eyesAngle:g,faceAreaRatio:d,faceAreaValid:f,faceDimensionsValid:h,faceHeightRatio:m,faceWidthRatio:p,textAngle:v,textParallel:x,textSide:_.length?`right`:`unknown`}}}};U(),Xm();var Oh={standard:{filename:`fm.ort`,layout:`nhwc`},high:{filename:`fmh.ort`,layout:`nhwc`},ultra:{filename:`fmu.ort`,layout:`nchw`}},kh=({runtime:e,orientDocumentFrame:t,detectDocument:n,faceDetection:r,detectFace:i,detectPictureFaces:a,faceMatcher:o=`ultra`})=>{let s=gh({runtime:e}),c=[10,338,297,332,284,251,389,356,454,323,361,288,397,365,379,378,400,377,152,148,176,149,150,136,172,58,132,93,234,127,162,21,54,103,67,109],l={"eyes-nose-mouth":{landmarks:[[33,133],[263,362],[1],[61],[291]],target:[[38.2946,51.6963],[73.5318,51.5014],[56.0252,71.7366],[41.5493,92.3655],[70.7299,92.2041]]}},u=({points:e})=>[e.reduce((e,[t])=>e+t,0)/e.length,e.reduce((e,[,t])=>e+t,0)/e.length],d=({source:e,target:t})=>{if(e.length<2||e.length!==t.length)return null;let[n,r]=u({points:e}),[i,a]=u({points:t}),o=0,s=0,c=0;for(let[l,[u,d]]of e.entries()){let[e,f]=t[l],p=u-n,m=d-r,h=e-i,g=f-a;o+=p*p+m*m,s+=p*h+m*g,c+=p*g-m*h}if(o<1e-8)return null;let l=s/o,d=c/o;return l*l+d*d<1e-8?null:[l,-d,i-l*n+d*r,d,l,a-d*n-l*r]},f=({height:e,minimumArea:t,polygon:n,width:r})=>{if(Math.abs(n.reduce((e,t,r)=>{let i=n[(r+1)%n.length];return e+t[0]*i[1]-i[0]*t[1]},0))/2<t)return null;let i=new Float32Array(r*e),a=Math.max(0,Math.ceil(Math.min(...n.map(([,e])=>e))-.5)),o=Math.min(e,Math.ceil(Math.max(...n.map(([,e])=>e))-.5));for(let e=a;e<o;e+=1){let t=[],a=e+.5;for(let e=0,r=n.length-1;e<n.length;r=e++){let[i,o]=n[r],[s,c]=n[e];o>a!=c>a&&t.push((s-i)*(a-o)/(c-o)+i)}t.sort((e,t)=>e-t);for(let n=0;n+1<t.length;n+=2){let a=Math.min(r,Math.max(0,Math.ceil(t[n]-.5))),o=Math.max(0,Math.min(r,Math.ceil(t[n+1]-.5)));i.fill(1,e*r+a,e*r+o)}}return i},p=({face:e,grayscale:t})=>{let{image:n,weights:r}=e,i=0,a=0,o=0,s=0;for(let e=0;e<r.length;e+=1){let t=r[e];if(!t)continue;let c=e*4,l=n[c]*.299+n[c+1]*.587+n[c+2]*.114;i+=l*t,a+=l*l*t,o+=t,(l<8||l>247)&&(s+=t)}if(o<r.length*.1)return null;let c=i/o;if(c<25||c>230||s/o>.4)return null;let l=Math.sqrt(Math.max(1,a/o-c*c)),u=Math.min(1.8,Math.max(.55,58/(127.5/c*l)))*(127.5/c),d=new Uint8ClampedArray(n.length);for(let e=0;e<r.length;e+=1){let i=e*4,a=r[e],o=n[i]*.299+n[i+1]*.587+n[i+2]*.114,s=(o-c)*u+127.5,l=s/Math.max(o,1);for(let e=0;e<3;e+=1)d[i+e]=Math.max(0,Math.min(255,t?s:n[i+e]*l))*a+127.5*(1-a);d[i+3]=255}return d},m=({alignment:t,face:n,frame:r})=>{let i=c.map(e=>{let t=n.mesh.landmarks[e];return[t.x,t.y]});if(i.some(([e,t])=>!Number.isFinite(e)||!Number.isFinite(t)||e<0||t<0||e>=r.width||t>=r.height))return null;let a=e.createCanvas(112,112);try{let e=a.getContext(`2d`,{willReadFrequently:!0});if(!e)throw Error(H.IMAGE_PROCESSING_FAILED);let o=l[t],s=o.landmarks.map(e=>{let t=e.map(e=>{let t=n.mesh.landmarks[e];return[t.x,t.y]});return u({points:t})}),c=d({source:s,target:o.target});if(!c||!c.every(Number.isFinite))return null;e.fillStyle=`rgb(128, 128, 128)`,e.fillRect(0,0,112,112),e.setTransform(c[0],c[3],c[1],c[4],c[2],c[5]),e.drawImage(r,0,0),e.setTransform(1,0,0,1,0,0);let m=i.map(([e,t])=>[c[0]*e+c[1]*t+c[2],c[3]*e+c[4]*t+c[5]]),h=f({height:112,minimumArea:1254.4,polygon:m,width:112});if(!h)return null;let g={image:e.getImageData(0,0,112,112).data,weights:h},_=p({face:g,grayscale:!1});if(!_)return null;let v=p({face:g,grayscale:!0});return v?{...g,normalized:{rgb:_,greyscale:v}}:null}finally{Zm({canvas:a})}},h=async({faceMatcher:t=o}={})=>await e.session({filename:Oh[t].filename}),g=({layout:e,normalized:t})=>{let n=12544,r=new Float32Array(n*3);for(let i=0;i<n;i+=1){let a=i*4;for(let o=0;o<3;o+=1){let s=(t[a+o]-127.5)/127.5,c=e===`nhwc`?i*3+o:o*n+i;r[c]=s}}return r},_=async({normalized:t})=>{let{layout:n}=Oh[o],r=g({layout:n,normalized:t}),i=n===`nhwc`?[1,112,112,3]:[1,3,112,112],a=await h(),s=await eh({label:`face.embedding`,session:a,feeds:{[a.inputNames[0]]:e.tensor(`float32`,r,i)}});try{let e=s[a.outputNames[0]].data;if(!(e instanceof Float32Array))throw Error(H.INVALID_MODEL_OUTPUT);let t=e,n=Math.hypot(...t);if(t.length!==512||!t.every(Number.isFinite)||!Number.isFinite(n)||n<1e-8)throw Error(H.INVALID_MODEL_OUTPUT);return Array.from(t,e=>e/n)}finally{$m({outputs:s})}},v=async({blob:t})=>{try{return await e.createImageBitmap(t)}catch(e){throw Error(H.IMAGE_DECODE_FAILED,{cause:e})}},y=async({normalized:e})=>{try{return await _({normalized:e})}catch(e){if(e instanceof Error&&e.message===H.INVALID_MODEL_OUTPUT)return null;throw e}},b=async({face:e})=>{let t=await y({normalized:e.normalized.rgb});if(!t)return null;let n=await y({normalized:e.normalized.greyscale});return n?{grayscale:n,rgb:t}:null},x=async({face:e})=>await y({normalized:e.normalized.greyscale}),S=async()=>{let e=new Uint8ClampedArray(50176).fill(127);if(!await b({face:{normalized:{rgb:e,greyscale:e}}}))throw Error(H.INVALID_MODEL_OUTPUT)},C=async({pixels:t})=>{let n=e.createCanvas(112,112);try{let e=n.getContext(`2d`);if(!e)throw Error(H.IMAGE_PROCESSING_FAILED);let r=e.createImageData(112,112);r.data.set(t),e.putImageData(r,0,0);let i=await n.convertToBlob({type:`image/jpeg`,quality:1});if(i.type!==`image/jpeg`)throw Error(H.IMAGE_ENCODE_FAILED);return i}finally{Zm({canvas:n})}},w=async({face:e})=>{let t=await b({face:e});if(!t)return null;let[n,r]=await Promise.all([C({pixels:e.normalized.rgb}),C({pixels:e.normalized.greyscale})]);return{embeddings:t,images:{rgb:n,greyscale:r}}},T=async({alignment:e,face:t,frame:n})=>{let r=m({alignment:e,face:t,frame:n});return r?await b({face:r}):null},ee=async({alignment:e,frame:t})=>{let n=await i(t);if(!n)throw Error(H.FACE_NOT_FOUND);let r=await T({alignment:e,face:n,frame:t});if(!r)throw Error(H.FACE_NOT_USABLE);return r},te=async({alignment:e,frame:t})=>{let n=await a(t,{forMatch:!0}),r=[];for(let i of n){let n=await T({alignment:e,face:i,frame:t});n&&r.push(n)}return r},ne=async({alignment:e,frame:i})=>{let a=await n(i);if(!a)throw Error(H.DOCUMENT_NOT_FOUND);let o=await t({frame:i,polygon:a.polygon,orientation:a.orientation});if(!o)throw Error(H.DOCUMENT_NOT_FOUND);try{let t={boundingRect:{height:o.height,width:o.width,x:0,y:0},polygon:[{x:0,y:0},{x:o.width,y:0},{x:o.width,y:o.height},{x:0,y:o.height}]},{faces:n}=await r.detectDocumentFaces({detection:t,frame:o.frame});if(!n.length)throw Error(H.DOCUMENT_FACE_NOT_FOUND);for(let t of n){let n=await T({alignment:e,face:t,frame:o.frame});if(n)return n}}finally{o.frame.close()}throw Error(H.FACE_NOT_USABLE)};return{prepareFace:m,loadFaceMatch:h,warmupFaceMatch:S,imageBitmap:v,readImage:s,preparedFaceEmbeddings:b,preparedFaceGrayscaleEmbedding:x,preparedFaceArtifacts:w,matchFaceWithDocument:async({document:e,documentFaceEmbeddings:t,referenceFaceEmbeddings:n,options:r,reference:i})=>{let a=null,o=null;try{let s=t;s||=(o=await v({blob:e}),await ne({alignment:r.alignment,frame:o,language:r.language,ocrEngine:r.ocrEngine}));let c=n;c||=(a=await v({blob:i}),await ee({alignment:r.alignment,frame:a}));let l=Hm({first:c,second:s});return Vm({score:l,threshold:r.threshold})}finally{a&&a.close(),o&&o.close()}},matchReferenceWithFaces:async({options:e,picture:t,references:n,referenceFaceEmbeddings:r})=>{let i=await v({blob:t}),a=[];try{if(!r)for(let e of n){let t=await v({blob:e});a.push(t)}let t=await te({alignment:e.alignment,frame:i});if(!t.length)throw Error(H.NO_USABLE_CANDIDATES);let o=r?[...r]:[];for(let t of a)try{let n=await ee({alignment:e.alignment,frame:t});o.push(n)}catch(e){if(!(e instanceof Error)||e.message!==H.FACE_NOT_FOUND&&e.message!==H.FACE_NOT_USABLE)throw e}let s=-1/0;for(let e of o)for(let n of t){let t=Hm({first:n,second:e});s=Math.max(s,t)}if(!Number.isFinite(s))throw Error(H.NO_USABLE_REFERENCES);return Vm({score:s,threshold:e.threshold})}finally{i.close();for(let e of a)e.close()}}}},Ah=n({InferenceSession:()=>Og,TRACE:()=>yg,TRACE_EVENT_BEGIN:()=>Cg,TRACE_EVENT_END:()=>wg,TRACE_FUNC_BEGIN:()=>xg,TRACE_FUNC_END:()=>Sg,Tensor:()=>_g,default:()=>wv,env:()=>Y,registerBackend:()=>Vh}),jh=Object.defineProperty,Mh=Object.getOwnPropertyDescriptor,Nh=Object.getOwnPropertyNames,Ph=Object.prototype.hasOwnProperty,Fh=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),q=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},Ih=(e,t)=>{for(var n in t)jh(e,n,{get:t[n],enumerable:!0})},Lh=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Nh(t))!Ph.call(e,i)&&i!==n&&jh(e,i,{get:()=>t[i],enumerable:!(r=Mh(t,i))||r.enumerable});return e},Rh=e=>Lh(jh({},`__esModule`,{value:!0}),e),zh,Bh,Vh,Hh,Uh,Wh=q(()=>{"use strict";zh=new Map,Bh=[],Vh=(e,t,n)=>{if(t&&typeof t.init==`function`&&typeof t.createInferenceSessionHandler==`function`){let r=zh.get(e);if(r===void 0)zh.set(e,{backend:t,priority:n});else{if(r.priority>n)return;if(r.priority===n&&r.backend!==t)throw Error(`cannot register backend "${e}" using priority ${n}`)}if(n>=0){let t=Bh.indexOf(e);t!==-1&&Bh.splice(t,1);for(let t=0;t<Bh.length;t++)if(zh.get(Bh[t]).priority<=n){Bh.splice(t,0,e);return}Bh.push(e)}}else throw TypeError(`not a valid backend`)},Hh=async e=>{let t=zh.get(e);if(!t)return`backend not found.`;if(t.initialized)return t.backend;if(t.aborted)return t.error;{let n=!!t.initPromise;try{return n||(t.initPromise=t.backend.init(e)),await t.initPromise,t.initialized=!0,t.backend}catch(e){return n||(t.error=`${e}`,t.aborted=!0),t.error}finally{delete t.initPromise}}},Uh=async e=>{let t=e.executionProviders||[],n=t.map(e=>typeof e==`string`?e:e.name),r=n.length===0?Bh:n,i,a=[],o=new Set;for(let e of r){let t=await Hh(e);typeof t==`string`?a.push({name:e,err:t}):(i||=t,i===t&&o.add(e))}if(!i)throw Error(`no available backend found. ERR: ${a.map(e=>`[${e.name}] ${e.err}`).join(`, `)}`);for(let{name:e,err:t}of a)n.includes(e)&&console.warn(`removing requested execution provider "${e}" from session options because it is not available: ${t}`);let s=t.filter(e=>o.has(typeof e==`string`?e:e.name));return[i,new Proxy(e,{get:(e,t)=>t===`executionProviders`?s:Reflect.get(e,t)})]}}),Gh=q(()=>{"use strict";Wh()}),Kh,qh=q(()=>{"use strict";Kh=`1.30.0`}),Jh,J,Yh=q(()=>{"use strict";qh(),Jh=`warning`,J={wasm:{},webgl:{},webgpu:{},versions:{common:Kh},set logLevel(e){if(e!==void 0){if(typeof e!=`string`||[`verbose`,`info`,`warning`,`error`,`fatal`].indexOf(e)===-1)throw Error(`Unsupported logging level: ${e}`);Jh=e}},get logLevel(){return Jh}},Object.defineProperty(J,"logLevel",{enumerable:!0})}),Y,Xh=q(()=>{"use strict";Yh(),Y=J}),Zh,Qh,$h=q(()=>{"use strict";Zh=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`):new OffscreenCanvas(1,1);n.width=e.dims[3],n.height=e.dims[2];let r=n.getContext(`2d`);if(r!=null){let i,a;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[3]):(i=e.dims[3],a=e.dims[2]);let o=t?.format===void 0?`RGB`:t.format,s=t?.norm,c,l;s===void 0||s.mean===void 0?c=[255,255,255,255]:typeof s.mean==`number`?c=[s.mean,s.mean,s.mean,s.mean]:(c=[s.mean[0],s.mean[1],s.mean[2],0],s.mean[3]!==void 0&&(c[3]=s.mean[3])),s===void 0||s.bias===void 0?l=[0,0,0,0]:typeof s.bias==`number`?l=[s.bias,s.bias,s.bias,s.bias]:(l=[s.bias[0],s.bias[1],s.bias[2],0],s.bias[3]!==void 0&&(l[3]=s.bias[3]));let u=a*i,d=0,f=u,p=u*2,m=-1;o===`RGBA`?(d=0,f=u,p=u*2,m=u*3):o===`RGB`?(d=0,f=u,p=u*2):o===`RBG`&&(d=0,p=u,f=u*2);for(let t=0;t<a;t++)for(let n=0;n<i;n++){let i=(e.data[d++]-l[0])*c[0],a=(e.data[f++]-l[1])*c[1],o=(e.data[p++]-l[2])*c[2],s=m===-1?255:(e.data[m++]-l[3])*c[3];r.fillStyle=`rgba(`+i+`,`+a+`,`+o+`,`+s+`)`,r.fillRect(n,t,1,1)}if(`toDataURL`in n)return n.toDataURL();throw Error(`toDataURL is not supported`)}throw Error(`Can not access image data`)},Qh=(e,t)=>{let n=typeof document<`u`?document.createElement(`canvas`).getContext(`2d`):new OffscreenCanvas(1,1).getContext(`2d`),r;if(n!=null){let i,a,o;t?.tensorLayout!==void 0&&t.tensorLayout===`NHWC`?(i=e.dims[2],a=e.dims[1],o=e.dims[3]):(i=e.dims[3],a=e.dims[2],o=e.dims[1]);let s=t!==void 0&&t.format!==void 0?t.format:`RGB`,c=t?.norm,l,u;c===void 0||c.mean===void 0?l=[255,255,255,255]:typeof c.mean==`number`?l=[c.mean,c.mean,c.mean,c.mean]:(l=[c.mean[0],c.mean[1],c.mean[2],255],c.mean[3]!==void 0&&(l[3]=c.mean[3])),c===void 0||c.bias===void 0?u=[0,0,0,0]:typeof c.bias==`number`?u=[c.bias,c.bias,c.bias,c.bias]:(u=[c.bias[0],c.bias[1],c.bias[2],0],c.bias[3]!==void 0&&(u[3]=c.bias[3]));let d=a*i;if(t!==void 0&&(t.format!==void 0&&o===4&&t.format!==`RGBA`||o===3&&t.format!==`RGB`&&t.format!==`BGR`))throw Error(`Tensor format doesn't match input tensor dims`);let f=0,p=1,m=2,h=3,g=0,_=d,v=d*2,y=-1;s===`RGBA`?(g=0,_=d,v=d*2,y=d*3):s===`RGB`?(g=0,_=d,v=d*2):s===`RBG`&&(g=0,v=d,_=d*2),r=n.createImageData(i,a);for(let t=0;t<a*i;f+=4,p+=4,m+=4,h+=4,t++)r.data[f]=(e.data[g++]-u[0])*l[0],r.data[p]=(e.data[_++]-u[1])*l[1],r.data[m]=(e.data[v++]-u[2])*l[2],r.data[h]=y===-1?255:(e.data[y++]-u[3])*l[3]}else throw Error(`Can not access image data`);return r}}),eg,tg,ng,rg,ig,ag,og=q(()=>{"use strict";gg(),eg=(e,t)=>{if(e===void 0)throw Error(`Image buffer must be defined`);if(t.height===void 0||t.width===void 0)throw Error(`Image height and width must be defined`);if(t.tensorLayout===`NHWC`)throw Error(`NHWC Tensor layout is not supported yet`);let{height:n,width:r}=t,i=t.norm??{mean:255,bias:0},a,o;a=typeof i.mean==`number`?[i.mean,i.mean,i.mean,i.mean]:[i.mean[0],i.mean[1],i.mean[2],i.mean[3]??255],o=typeof i.bias==`number`?[i.bias,i.bias,i.bias,i.bias]:[i.bias[0],i.bias[1],i.bias[2],i.bias[3]??0];let s=t.format===void 0?`RGBA`:t.format,c=t.tensorFormat!==void 0&&t.tensorFormat!==void 0?t.tensorFormat:`RGB`,l=n*r,u=c===`RGBA`?new Float32Array(l*4):new Float32Array(l*3),d=4,f=0,p=1,m=2,h=3,g=0,_=l,v=l*2,y=-1;s===`RGB`&&(d=3,f=0,p=1,m=2,h=-1),c===`RGBA`?y=l*3:c===`RBG`?(g=0,v=l,_=l*2):c===`BGR`&&(v=0,_=l,g=l*2);for(let t=0;t<l;t++,f+=d,m+=d,p+=d,h+=d)u[g++]=(e[f]+o[0])/a[0],u[_++]=(e[p]+o[1])/a[1],u[v++]=(e[m]+o[2])/a[2],y!==-1&&h!==-1&&(u[y++]=(e[h]+o[3])/a[3]);return c===`RGBA`?new hg(`float32`,u,[1,4,n,r]):new hg(`float32`,u,[1,3,n,r])},tg=async(e,t)=>{let n=typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement,r=typeof ImageData<`u`&&e instanceof ImageData,i=typeof ImageBitmap<`u`&&e instanceof ImageBitmap,a=typeof e==`string`,o,s=t??{},c=()=>{if(typeof document<`u`)return document.createElement(`canvas`);if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(1,1);throw Error(`Canvas is not supported`)},l=e=>typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas?e.getContext(`2d`):null;if(n){let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let n=e.height,i=e.width;if(t!==void 0&&t.resizedHeight!==void 0&&t.resizedWidth!==void 0&&(n=t.resizedHeight,i=t.resizedWidth),t!==void 0){if(s=t,t.tensorFormat!==void 0)throw Error(`Image input config format must be RGBA for HTMLImageElement`);s.tensorFormat=`RGBA`,s.height=n,s.width=i}else s.tensorFormat=`RGBA`,s.height=n,s.width=i;r.drawImage(e,0,0),o=r.getImageData(0,0,i,n).data}else throw Error(`Can not access image data`)}else if(r){let n,r;if(t!==void 0&&t.resizedWidth!==void 0&&t.resizedHeight!==void 0?(n=t.resizedHeight,r=t.resizedWidth):(n=e.height,r=e.width),t!==void 0&&(s=t),s.format=`RGBA`,s.height=n,s.width=r,t!==void 0){let t=c();t.width=r,t.height=n;let i=l(t);if(i!=null)i.putImageData(e,0,0),o=i.getImageData(0,0,r,n).data;else throw Error(`Can not access image data`)}else o=e.data}else if(i){if(t===void 0)throw Error(`Please provide image config with format for Imagebitmap`);let n=c();n.width=e.width,n.height=e.height;let r=l(n);if(r!=null){let t=e.height,n=e.width;return r.drawImage(e,0,0,n,t),o=r.getImageData(0,0,n,t).data,s.height=t,s.width=n,eg(o,s)}throw Error(`Can not access image data`)}else{if(a)return new Promise((t,n)=>{let r=c(),i=l(r);if(!e||!i)return n();let a=new Image;a.crossOrigin=`Anonymous`,a.src=e,a.onload=()=>{r.width=a.width,r.height=a.height,i.drawImage(a,0,0,r.width,r.height);let e=i.getImageData(0,0,r.width,r.height);s.height=r.height,s.width=r.width,t(eg(e.data,s))}});throw Error(`Input data provided is not supported - aborted tensor creation`)}if(o!==void 0)return eg(o,s);throw Error(`Input data provided is not supported - aborted tensor creation`)},ng=(e,t)=>{let{width:n,height:r,download:i,dispose:a}=t;return new hg({location:`texture`,type:`float32`,texture:e,dims:[1,r,n,4],download:i,dispose:a})},rg=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new hg({location:`gpu-buffer`,type:n??`float32`,gpuBuffer:e,dims:r,download:i,dispose:a})},ig=(e,t)=>{let{dataType:n,dims:r,download:i,dispose:a}=t;return new hg({location:`ml-tensor`,type:n??`float32`,mlTensor:e,dims:r,download:i,dispose:a})},ag=(e,t,n)=>new hg({location:`cpu-pinned`,type:e,data:t,dims:n??[t.length]})}),sg,cg,lg,ug,dg=q(()=>{"use strict";sg=new Map([[`float32`,Float32Array],[`uint8`,Uint8Array],[`int8`,Int8Array],[`uint16`,Uint16Array],[`int16`,Int16Array],[`int32`,Int32Array],[`bool`,Uint8Array],[`float64`,Float64Array],[`uint32`,Uint32Array],[`int4`,Uint8Array],[`uint4`,Uint8Array]]),cg=new Map([[Float32Array,`float32`],[Uint8Array,`uint8`],[Int8Array,`int8`],[Uint16Array,`uint16`],[Int16Array,`int16`],[Int32Array,`int32`],[Float64Array,`float64`],[Uint32Array,`uint32`]]),lg=!1,ug=()=>{if(!lg){lg=!0;let e=typeof BigInt64Array<`u`&&BigInt64Array.from,t=typeof BigUint64Array<`u`&&BigUint64Array.from,n=globalThis.Float16Array,r=typeof n<`u`&&n.from;e&&(sg.set(`int64`,BigInt64Array),cg.set(BigInt64Array,`int64`)),t&&(sg.set(`uint64`,BigUint64Array),cg.set(BigUint64Array,`uint64`)),r?(sg.set(`float16`,n),cg.set(n,`float16`)):sg.set(`float16`,Uint16Array)}}}),fg,pg,mg=q(()=>{"use strict";gg(),fg=e=>{let t=1;for(let n=0;n<e.length;n++){let r=e[n];if(typeof r!=`number`||!Number.isSafeInteger(r))throw TypeError(`dims[${n}] must be an integer, got: ${r}`);if(r<0)throw RangeError(`dims[${n}] must be a non-negative integer, got: ${r}`);t*=r}return t},pg=(e,t)=>{switch(e.location){case`cpu`:return new hg(e.type,e.data,t);case`cpu-pinned`:return new hg({location:`cpu-pinned`,data:e.data,type:e.type,dims:t});case`texture`:return new hg({location:`texture`,texture:e.texture,type:e.type,dims:t});case`gpu-buffer`:return new hg({location:`gpu-buffer`,gpuBuffer:e.gpuBuffer,type:e.type,dims:t});case`ml-tensor`:return new hg({location:`ml-tensor`,mlTensor:e.mlTensor,type:e.type,dims:t});default:throw Error(`tensorReshape: tensor location ${e.location} is not supported`)}}}),hg,gg=q(()=>{"use strict";$h(),og(),dg(),mg(),hg=class{constructor(e,t,n){ug();let r,i;if(typeof e==`object`&&`location`in e)switch(this.dataLocation=e.location,r=e.type,i=e.dims,e.location){case`cpu-pinned`:{let t=sg.get(r);if(!t)throw TypeError(`unsupported type "${r}" to create tensor from pinned buffer`);if(!(e.data instanceof t))throw TypeError(`buffer should be of type ${t.name}`);this.cpuData=e.data;break}case`texture`:if(r!==`float32`)throw TypeError(`unsupported type "${r}" to create tensor from texture`);this.gpuTextureData=e.texture,this.downloader=e.download,this.disposer=e.dispose;break;case`gpu-buffer`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from gpu buffer`);this.gpuBufferData=e.gpuBuffer,this.downloader=e.download,this.disposer=e.dispose;break;case`ml-tensor`:if(r!==`float32`&&r!==`float16`&&r!==`int32`&&r!==`int64`&&r!==`uint32`&&r!==`uint64`&&r!==`int8`&&r!==`uint8`&&r!==`bool`&&r!==`uint4`&&r!==`int4`)throw TypeError(`unsupported type "${r}" to create tensor from MLTensor`);this.mlTensorData=e.mlTensor,this.downloader=e.download,this.disposer=e.dispose;break;default:throw Error(`Tensor constructor: unsupported location '${this.dataLocation}'`)}else{let a,o;if(typeof e==`string`){if(r=e,o=n,e===`string`){if(!Array.isArray(t))throw TypeError(`A string tensor's data must be a string array.`);a=t}else{let n=sg.get(e);if(n===void 0)throw TypeError(`Unsupported tensor type: ${e}.`);if(Array.isArray(t)){if(e===`float16`&&n===Uint16Array||e===`uint4`||e===`int4`)throw TypeError(`Creating a ${e} tensor from number array is not supported. Please use ${n.name} as data.`);a=e===`uint64`||e===`int64`?n.from(t,BigInt):n.from(t)}else if(t instanceof n)a=t;else if(t instanceof Uint8ClampedArray){if(e===`uint8`)a=Uint8Array.from(t);else throw TypeError(`A Uint8ClampedArray tensor's data must be type of uint8`)}else if(e===`float16`&&t instanceof Uint16Array&&n!==Uint16Array)a=new globalThis.Float16Array(t.buffer,t.byteOffset,t.length);else throw TypeError(`A ${r} tensor's data must be type of ${n}`)}}else if(o=t,Array.isArray(e)){if(e.length===0)throw TypeError(`Tensor type cannot be inferred from an empty array.`);let t=typeof e[0];if(t===`string`)r=`string`,a=e;else if(t===`boolean`)r=`bool`,a=Uint8Array.from(e);else throw TypeError(`Invalid element type of data array: ${t}.`)}else if(e instanceof Uint8ClampedArray)r=`uint8`,a=Uint8Array.from(e);else{let t=cg.get(e.constructor);if(t===void 0)throw TypeError(`Unsupported type for tensor data: ${e.constructor}.`);r=t,a=e}if(o===void 0)o=[a.length];else if(!Array.isArray(o))throw TypeError(`A tensor's dims must be a number array`);i=o,this.cpuData=a,this.dataLocation=`cpu`}let a=fg(i);if(this.cpuData&&a!==this.cpuData.length&&(r!==`uint4`&&r!==`int4`||Math.ceil(a/2)!==this.cpuData.length))throw Error(`Tensor's size(${a}) does not match data length(${this.cpuData.length}).`);this.type=r,this.dims=i,this.size=a}static async fromImage(e,t){return tg(e,t)}static fromTexture(e,t){return ng(e,t)}static fromGpuBuffer(e,t){return rg(e,t)}static fromMLTensor(e,t){return ig(e,t)}static fromPinnedBuffer(e,t,n){return ag(e,t,n)}toDataURL(e){return Zh(this,e)}toImageData(e){return Qh(this,e)}get data(){if(this.ensureValid(),!this.cpuData)throw Error("The data is not on CPU. Use `getData()` to download GPU data to CPU, or use `texture` or `gpuBuffer` property to access the GPU data directly.");return this.cpuData}get location(){return this.dataLocation}get texture(){if(this.ensureValid(),!this.gpuTextureData)throw Error(`The data is not stored as a WebGL texture.`);return this.gpuTextureData}get gpuBuffer(){if(this.ensureValid(),!this.gpuBufferData)throw Error(`The data is not stored as a WebGPU buffer.`);return this.gpuBufferData}get mlTensor(){if(this.ensureValid(),!this.mlTensorData)throw Error(`The data is not stored as a WebNN MLTensor.`);return this.mlTensorData}async getData(e){switch(this.ensureValid(),this.dataLocation){case`cpu`:case`cpu-pinned`:return this.data;case`texture`:case`gpu-buffer`:case`ml-tensor`:if(!this.downloader)throw Error(`The current tensor is not created with a specified data downloader.`);if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);try{this.isDownloading=!0;let t=await this.downloader();return this.downloader=void 0,this.dataLocation=`cpu`,this.cpuData=t,e&&this.disposer&&(this.disposer(),this.disposer=void 0),t}finally{this.isDownloading=!1}default:throw Error(`cannot get data from location: ${this.dataLocation}`)}}dispose(){if(this.isDownloading)throw Error(`The current tensor is being downloaded.`);this.disposer&&=(this.disposer(),void 0),this.cpuData=void 0,this.gpuTextureData=void 0,this.gpuBufferData=void 0,this.mlTensorData=void 0,this.downloader=void 0,this.isDownloading=void 0,this.dataLocation=`none`}ensureValid(){if(this.dataLocation===`none`)throw Error(`The tensor is disposed.`)}reshape(e){if(this.ensureValid(),this.downloader||this.disposer)throw Error(`Cannot reshape a tensor that owns GPU resource.`);return pg(this,e)}}}),_g,vg=q(()=>{"use strict";gg(),_g=hg}),yg,bg,xg,Sg,Cg,wg,Tg=q(()=>{"use strict";Yh(),yg=(e,t)=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.timeStamp(`${e}::ORT::${t}`)},bg=(e,t)=>{let n=Error().stack?.split(/\r\n|\r|\n/g)||[],r=!1;for(let i=0;i<n.length;i++){if(r&&!n[i].includes(`TRACE_FUNC`)){let r=`FUNC_${e}::${n[i].trim().split(` `)[1]}`;t&&(r+=`::${t}`),yg(`CPU`,r);return}n[i].includes(`TRACE_FUNC`)&&(r=!0)}},xg=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||bg(`BEGIN`,e)},Sg=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||bg(`END`,e)},Cg=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.time(`ORT::${e}`)},wg=e=>{(typeof J.trace>`u`?!J.wasm.trace:!J.trace)||console.timeEnd(`ORT::${e}`)}}),Eg,Dg=q(()=>{"use strict";Wh(),vg(),Tg(),Eg=class e{constructor(e){this.handler=e}async run(e,t,n){xg(),Cg(`InferenceSession.run`);let r={},i={};if(typeof e!=`object`||!e||e instanceof _g||Array.isArray(e))throw TypeError(`'feeds' must be an object that use input names as keys and OnnxValue as corresponding values.`);let a=!0;if(typeof t==`object`){if(t===null)throw TypeError(`Unexpected argument[1]: cannot be null.`);if(t instanceof _g)throw TypeError(`'fetches' cannot be a Tensor`);if(Array.isArray(t)){if(t.length===0)throw TypeError(`'fetches' cannot be an empty array.`);a=!1;for(let e of t){if(typeof e!=`string`)throw TypeError(`'fetches' must be a string array or an object.`);if(this.outputNames.indexOf(e)===-1)throw RangeError(`'fetches' contains invalid output name: ${e}.`);r[e]=null}if(typeof n==`object`&&n)i=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else{let e=!1,o=Object.getOwnPropertyNames(t);for(let n of this.outputNames)if(o.indexOf(n)!==-1){let i=t[n];(i===null||i instanceof _g)&&(e=!0,a=!1,r[n]=i)}if(e){if(typeof n==`object`&&n)i=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else i=t}}else if(typeof t<`u`)throw TypeError(`Unexpected argument[1]: must be 'fetches' or 'options'.`);for(let t of this.inputNames)if(typeof e[t]>`u`)throw Error(`input '${t}' is missing in 'feeds'.`);if(a)for(let e of this.outputNames)r[e]=null;let o=await this.handler.run(e,r,i),s={};for(let e in o)if(Object.hasOwnProperty.call(o,e)){let t=o[e];s[e]=t instanceof _g?t:new _g(t.type,t.data,t.dims)}return wg(`InferenceSession.run`),Sg(),s}async release(){return this.handler.dispose()}static async create(t,n,r,i){xg(),Cg(`InferenceSession.create`);let a,o={};if(typeof t==`string`){if(a=t,typeof n==`object`&&n)o=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else if(t instanceof Uint8Array){if(a=t,typeof n==`object`&&n)o=n;else if(typeof n<`u`)throw TypeError(`'options' must be an object.`)}else if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&t instanceof SharedArrayBuffer){let e=t,s=0,c=t.byteLength;if(typeof n==`object`&&n)o=n;else if(typeof n==`number`){if(s=n,!Number.isSafeInteger(s))throw RangeError(`'byteOffset' must be an integer.`);if(s<0||s>=e.byteLength)throw RangeError(`'byteOffset' is out of range [0, ${e.byteLength}).`);if(c=t.byteLength-s,typeof r==`number`){if(c=r,!Number.isSafeInteger(c))throw RangeError(`'byteLength' must be an integer.`);if(c<=0||s+c>e.byteLength)throw RangeError(`'byteLength' is out of range (0, ${e.byteLength-s}].`);if(typeof i==`object`&&i)o=i;else if(typeof i<`u`)throw TypeError(`'options' must be an object.`)}else if(typeof r<`u`)throw TypeError(`'byteLength' must be a number.`)}else if(typeof n<`u`)throw TypeError(`'options' must be an object.`);a=new Uint8Array(e,s,c)}else throw TypeError(`Unexpected argument[0]: must be 'path' or 'buffer'.`);let[s,c]=await Uh(o),l=await s.createInferenceSessionHandler(a,c);return wg(`InferenceSession.create`),Sg(),new e(l)}startProfiling(){this.handler.startProfiling()}endProfiling(){this.handler.endProfiling()}get inputNames(){return this.handler.inputNames}get outputNames(){return this.handler.outputNames}get inputMetadata(){return this.handler.inputMetadata}get outputMetadata(){return this.handler.outputMetadata}}}),Og,kg=q(()=>{"use strict";Dg(),Og=Eg}),Ag=q(()=>{"use strict";}),jg=q(()=>{"use strict";}),Mg=q(()=>{"use strict";}),Ng=q(()=>{"use strict";}),Pg={};Ih(Pg,{InferenceSession:()=>Og,TRACE:()=>yg,TRACE_EVENT_BEGIN:()=>Cg,TRACE_EVENT_END:()=>wg,TRACE_FUNC_BEGIN:()=>xg,TRACE_FUNC_END:()=>Sg,Tensor:()=>_g,env:()=>Y,registerBackend:()=>Vh});var Fg=q(()=>{"use strict";Gh(),Xh(),kg(),vg(),Ag(),jg(),Tg(),Mg(),Ng()}),Ig=q(()=>{"use strict";}),Lg={};Ih(Lg,{default:()=>Bg});var Rg,zg,Bg,Vg=q(()=>{"use strict";J_(),d_(),n_(),Rg=`ort-wasm-proxy-worker`,zg=globalThis.self?.name===Rg,zg&&(self.onmessage=e=>{let{type:t,in:n}=e.data;try{switch(t){case`init-wasm`:u_(n.wasm).then(()=>{I_(n).then(()=>{postMessage({type:t})},e=>{postMessage({type:t,err:e})})},e=>{postMessage({type:t,err:e})});break;case`init-ep`:{let{epName:e,env:r}=n;L_(r,e).then(()=>{postMessage({type:t})},e=>{postMessage({type:t,err:e})});break}case`copy-from`:{let{buffer:e}=n,r=V_(e);postMessage({type:t,out:r});break}case`create`:{let{model:e,options:r}=n;H_(e,r).then(e=>{postMessage({type:t,out:e})},e=>{postMessage({type:t,err:e})});break}case`release`:U_(n),postMessage({type:t});break;case`run`:{let{sessionId:e,inputIndices:r,inputs:i,outputIndices:a,options:o}=n;G_(e,r,i,a,Array(a.length).fill(null),o).then(e=>{e.some(e=>e[3]!==`cpu`)?postMessage({type:t,err:`Proxy does not support non-cpu tensor location.`}):postMessage({type:t,out:e},q_([...i,...e]))},e=>{postMessage({type:t,err:e})});break}case`end-profiling`:K_(n),postMessage({type:t})}}catch(e){postMessage({type:t,err:e})}}),Bg=zg?null:e=>new Worker(e??Gg,{type:`module`,name:Rg})}),Hg,Ug,Wg,Gg,Kg,qg,Jg,Yg,Xg,Zg,Qg,$g,e_,t_,n_=q(()=>{"use strict";Ig(),Hg=typeof location>`u`?void 0:location.origin,Ug={}.url>`file:`&&{}.url<`file;`,Wg=()=>Ug?new URL(new URL(`ort.wasm.min.mjs`,{}.url).href,Hg).href:{}.url,Gg=Wg(),Kg=()=>{if(Gg&&!Gg.startsWith(`blob:`))return Gg.substring(0,Gg.lastIndexOf(`/`)+1)},qg=(e,t)=>{try{let n=t??Gg;return(n?new URL(e,n):new URL(e)).origin===Hg}catch{return!1}},Jg=(e,t)=>{let n=t??Gg;try{return(n?new URL(e,n):new URL(e)).href}catch{return}},Yg=(e,t)=>`${t??`./`}${e}`,Xg=async e=>{let t=await(await fetch(e,{credentials:`same-origin`})).blob();return URL.createObjectURL(t)},Zg=async e=>(await import(e)).default,Qg=(Vg(),Rh(Lg)).default,$g=async()=>{if(!Gg)throw Error(`Failed to load proxy worker: cannot determine the script source URL.`);if(qg(Gg))return[void 0,Qg()];let e=await Xg(Gg);return[e,Qg(e)]},e_=void 0,t_=async(e,t,n,r)=>{let i=e_&&!(e||t);if(i){if(Gg)i=qg(Gg)||r&&!n;else if(r&&!n)i=!0;else throw Error(`cannot determine the script source URL.`)}if(i)return[void 0,e_];{let r=`ort-wasm-simd-threaded.mjs`,i=e??Jg(r,t),a=n&&i&&!qg(i,t),o=a?await Xg(i):i??Yg(r,t);return[a?o:void 0,await Zg(o)]}}}),r_,i_,a_,o_,s_,c_,l_,u_,X,d_=q(()=>{"use strict";n_(),i_=!1,a_=!1,o_=!1,s_=()=>{if(typeof SharedArrayBuffer>`u`)return!1;try{return typeof MessageChannel<`u`&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch{return!1}},c_=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,30,1,28,0,65,0,253,15,253,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,253,186,1,26,11]))}catch{return!1}},l_=()=>{try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,19,1,17,0,65,1,253,15,65,2,253,15,65,3,253,15,253,147,2,11]))}catch{return!1}},u_=async e=>{if(i_)return Promise.resolve();if(a_)throw Error(`multiple calls to 'initializeWebAssembly()' detected.`);if(o_)throw Error(`previous call to 'initializeWebAssembly()' failed.`);a_=!0;let t=e.initTimeout,n=e.numThreads;if(e.simd!==!1){if(e.simd===`relaxed`){if(!l_())throw Error(`Relaxed WebAssembly SIMD is not supported in the current environment.`)}else if(!c_())throw Error(`WebAssembly SIMD is not supported in the current environment.`)}let r=s_();n>1&&!r&&(typeof self<`u`&&!self.crossOriginIsolated&&console.warn(`env.wasm.numThreads is set to `+n+`, but this will not work unless you enable crossOriginIsolated mode. See https://web.dev/cross-origin-isolation-guide/ for more info.`),console.warn(`WebAssembly multi-threading is not supported in the current environment. Falling back to single-threading.`),e.numThreads=n=1);let i=e.wasmPaths,a=typeof i==`string`?i:void 0,o=i?.mjs,s=o?.href??o,c=i?.wasm,l=c?.href??c,u=e.wasmBinary,[d,f]=await t_(s,a,n>1,!!u||!!l),p=!1,m=[];if(t>0&&m.push(new Promise(e=>{setTimeout(()=>{p=!0,e()},t)})),m.push(new Promise((e,t)=>{let r={numThreads:n};if(u)r.wasmBinary=u,r.locateFile=e=>e;else if(l||a)r.locateFile=e=>l??a+e;else if(s&&s.indexOf(`blob:`)!==0)r.locateFile=e=>new URL(e,s).href;else if(d){let e=Kg();e&&(r.locateFile=t=>e+t)}f(r).then(t=>{a_=!1,i_=!0,r_=t,e(),d&&URL.revokeObjectURL(d)},e=>{a_=!1,o_=!0,t(e)})})),await Promise.race(m),p)throw Error(`WebAssembly backend initializing failed due to timeout: ${t}ms`)},X=()=>{if(i_&&r_)return r_;throw Error(`WebAssembly is not initialized yet.`)}}),f_,p_,Z,m_=q(()=>{"use strict";d_(),f_=(e,t)=>{let n=X(),r=n.lengthBytesUTF8(e)+1,i=n._malloc(r);return n.stringToUTF8(e,i,r),t.push(i),i},p_=(e,t,n,r)=>{if(typeof e==`object`&&e){if(n.has(e))throw Error(`Circular reference in options`);n.add(e)}Object.entries(e).forEach(([e,i])=>{let a=t?t+e:e;if(typeof i==`object`)p_(i,a+`.`,n,r);else if(typeof i==`string`||typeof i==`number`)r(a,i.toString());else if(typeof i==`boolean`)r(a,i?`1`:`0`);else throw Error(`Can't handle extra config type: ${typeof i}`)})},Z=e=>{let t=X(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetLastError(r,r+n);let i=Number(t.getValue(r,n===4?`i32`:`i64`)),a=t.getValue(r+n,`*`),o=a?t.UTF8ToString(a):``;throw Error(`${e} ERROR_CODE: ${i}, ERROR_MESSAGE: ${o}`)}finally{t.stackRestore(n)}}}),h_,g_=q(()=>{"use strict";d_(),m_(),h_=e=>{let t=X(),n=0,r=[],i=e||{};try{if(e?.logSeverityLevel===void 0)i.logSeverityLevel=2;else if(typeof e.logSeverityLevel!=`number`||!Number.isInteger(e.logSeverityLevel)||e.logSeverityLevel<0||e.logSeverityLevel>4)throw Error(`log severity level is not valid: ${e.logSeverityLevel}`);if(e?.logVerbosityLevel===void 0)i.logVerbosityLevel=0;else if(typeof e.logVerbosityLevel!=`number`||!Number.isInteger(e.logVerbosityLevel))throw Error(`log verbosity level is not valid: ${e.logVerbosityLevel}`);e?.terminate===void 0&&(i.terminate=!1);let a=0;return e?.tag!==void 0&&(a=f_(e.tag,r)),n=t._OrtCreateRunOptions(i.logSeverityLevel,i.logVerbosityLevel,!!i.terminate,a),n===0&&Z(`Can't create run options.`),e?.extra!==void 0&&p_(e.extra,``,new WeakSet,(e,i)=>{let a=f_(e,r),o=f_(i,r);t._OrtAddRunConfigEntry(n,a,o)!==0&&Z(`Can't set a run config entry: ${e} - ${i}.`)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseRunOptions(n),r.forEach(e=>t._free(e)),e}}}),__,v_,y_,b_,x_,S_,C_=q(()=>{"use strict";d_(),m_(),__=e=>{switch(e){case`disabled`:return 0;case`basic`:return 1;case`extended`:return 2;case`layout`:return 3;case`all`:return 99;default:throw Error(`unsupported graph optimization level: ${e}`)}},v_=e=>{switch(e){case`sequential`:return 0;case`parallel`:return 1;default:throw Error(`unsupported execution mode: ${e}`)}},y_=e=>{e.extra||={},e.extra.session||(e.extra.session={});let t=e.extra.session;t.use_ort_model_bytes_directly||=`1`,e.executionProviders&&e.executionProviders.some(e=>(typeof e==`string`?e:e.name)===`webgpu`)&&(e.enableMemPattern=!1)},b_=(e,t,n,r)=>{let i=f_(t,r),a=f_(n,r);X()._OrtAddSessionConfigEntry(e,i,a)!==0&&Z(`Can't set a session config entry: ${t} - ${n}.`)},x_=async(e,t,n)=>{let r=t.executionProviders;for(let t of r){let r=typeof t==`string`?t:t.name,i=[];switch(r){case`webnn`:if(r=`WEBNN`,b_(e,`session.disable_quant_qdq`,`1`,n),b_(e,`session.disable_qdq_constant_folding`,`1`,n),typeof t!=`string`){let r=t?.deviceType;r&&b_(e,`deviceType`,r,n)}break;case`webgpu`:if(r=`JS`,typeof t!=`string`){let r=t;if(r?.preferredLayout){if(r.preferredLayout!==`NCHW`&&r.preferredLayout!==`NHWC`)throw Error(`preferredLayout must be either 'NCHW' or 'NHWC': ${r.preferredLayout}`);b_(e,`preferredLayout`,r.preferredLayout,n)}}break;case`wasm`:case`cpu`:continue;default:throw Error(`not supported execution provider: ${r}`)}let a=f_(r,n),o=i.length,s=0,c=0;if(o>0){s=X()._malloc(o*X().PTR_SIZE),n.push(s),c=X()._malloc(o*X().PTR_SIZE),n.push(c);for(let e=0;e<o;e++)X().setValue(s+e*X().PTR_SIZE,i[e][0],`*`),X().setValue(c+e*X().PTR_SIZE,i[e][1],`*`)}await X()._OrtAppendExecutionProvider(e,a,s,c,o)!==0&&Z(`Can't append execution provider: ${r}.`)}},S_=async e=>{let t=X(),n=0,r=[],i=e||{};y_(i);try{let e=__(i.graphOptimizationLevel??`all`),a=v_(i.executionMode??`sequential`),o=typeof i.logId==`string`?f_(i.logId,r):0,s=i.logSeverityLevel??2;if(!Number.isInteger(s)||s<0||s>4)throw Error(`log severity level is not valid: ${s}`);let c=i.logVerbosityLevel??0;if(!Number.isInteger(c)||c<0||c>4)throw Error(`log verbosity level is not valid: ${c}`);let l=typeof i.optimizedModelFilePath==`string`?f_(i.optimizedModelFilePath,r):0;if(n=t._OrtCreateSessionOptions(e,!!i.enableCpuMemArena,!!i.enableMemPattern,a,!!i.enableProfiling,0,o,s,c,l),n===0&&Z(`Can't create session options.`),i.executionProviders&&await x_(n,i,r),i.enableGraphCapture!==void 0){if(typeof i.enableGraphCapture!=`boolean`)throw Error(`enableGraphCapture must be a boolean value: ${i.enableGraphCapture}`);b_(n,`enableGraphCapture`,i.enableGraphCapture.toString(),r)}if(i.freeDimensionOverrides)for(let[e,a]of Object.entries(i.freeDimensionOverrides)){if(typeof e!=`string`)throw Error(`free dimension override name must be a string: ${e}`);if(typeof a!=`number`||!Number.isInteger(a)||a<0)throw Error(`free dimension override value must be a non-negative integer: ${a}`);let i=f_(e,r);t._OrtAddFreeDimensionOverride(n,i,a)!==0&&Z(`Can't set a free dimension override: ${e} - ${a}.`)}return i.extra!==void 0&&p_(i.extra,``,new WeakSet,(e,t)=>{b_(n,e,t,r)}),[n,r]}catch(e){throw n!==0&&t._OrtReleaseSessionOptions(n)!==0&&Z(`Can't release session options.`),r.forEach(e=>t._free(e)),e}}}),w_,T_,E_,D_,O_,k_,A_,j_,M_=q(()=>{"use strict";w_=e=>{switch(e){case`int8`:return 3;case`uint8`:return 2;case`bool`:return 9;case`int16`:return 5;case`uint16`:return 4;case`int32`:return 6;case`uint32`:return 12;case`float16`:return 10;case`float32`:return 1;case`float64`:return 11;case`string`:return 8;case`int64`:return 7;case`uint64`:return 13;case`int4`:return 22;case`uint4`:return 21;default:throw Error(`unsupported data type: ${e}`)}},T_=e=>{switch(e){case 3:return`int8`;case 2:return`uint8`;case 9:return`bool`;case 5:return`int16`;case 4:return`uint16`;case 6:return`int32`;case 12:return`uint32`;case 10:return`float16`;case 1:return`float32`;case 11:return`float64`;case 8:return`string`;case 7:return`int64`;case 13:return`uint64`;case 22:return`int4`;case 21:return`uint4`;default:throw Error(`unsupported data type: ${e}`)}},E_=(e,t)=>{let n=[-1,4,1,1,2,2,4,8,-1,1,2,8,4,8,-1,-1,-1,-1,-1,-1,-1,.5,.5][e],r=typeof t==`number`?t:t.reduce((e,t)=>e*t,1);return n>0?Math.ceil(r*n):void 0},D_=e=>{switch(e){case`float16`:return typeof Float16Array<`u`?Float16Array:Uint16Array;case`float32`:return Float32Array;case`uint8`:return Uint8Array;case`int8`:return Int8Array;case`uint16`:return Uint16Array;case`int16`:return Int16Array;case`int32`:return Int32Array;case`bool`:return Uint8Array;case`float64`:return Float64Array;case`uint32`:return Uint32Array;case`int64`:return BigInt64Array;case`uint64`:return BigUint64Array;default:throw Error(`unsupported type: ${e}`)}},O_=e=>{switch(e){case`verbose`:return 0;case`info`:return 1;case`warning`:return 2;case`error`:return 3;case`fatal`:return 4;default:throw Error(`unsupported logging level: ${e}`)}},k_=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,A_=e=>e===`float32`||e===`float16`||e===`int32`||e===`int64`||e===`uint32`||e===`uint64`||e===`int8`||e===`uint8`||e===`bool`||e===`uint4`||e===`int4`,j_=e=>{switch(e){case`none`:return 0;case`cpu`:return 1;case`cpu-pinned`:return 2;case`texture`:return 3;case`gpu-buffer`:return 4;case`ml-tensor`:return 5;default:throw Error(`unsupported data location: ${e}`)}}}),N_,P_=q(()=>{"use strict";Ig(),N_=async e=>{if(typeof e==`string`){let t=await fetch(e);if(!t.ok)throw Error(`failed to load external data file: ${e}`);let n=t.headers.get(`Content-Length`),r=n?parseInt(n,10):0;if(r<1073741824)return new Uint8Array(await t.arrayBuffer());{if(!t.body)throw Error(`failed to load external data file: ${e}, no response body.`);let n=t.body.getReader(),i;try{i=new ArrayBuffer(r)}catch(e){if(e instanceof RangeError){let e=Math.ceil(r/65536);i=new WebAssembly.Memory({initial:e,maximum:e}).buffer}else throw e}let a=0;for(;;){let{done:e,value:t}=await n.read();if(e)break;let r=t.byteLength;new Uint8Array(i,a,r).set(t),a+=r}return new Uint8Array(i,0,r)}}return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e instanceof Uint8Array?e:new Uint8Array(e)}}),F_,I_,L_,R_,z_,B_,V_,H_,U_,W_,G_,K_,q_,J_=q(()=>{"use strict";Fg(),g_(),C_(),M_(),d_(),m_(),P_(),F_=(e,t)=>{X()._OrtInit(e,t)!==0&&Z(`Can't initialize onnxruntime.`)},I_=async e=>{F_(e.wasm.numThreads,O_(e.logLevel))},L_=async(e,t)=>{X().asyncInit?.();let n=e.webgpu.adapter;if(t===`webgpu`){if(typeof navigator>`u`||!navigator.gpu)throw Error(`WebGPU is not supported in current environment`);if(n){if(typeof n.limits!=`object`||typeof n.features!=`object`||typeof n.requestDevice!=`function`)throw Error("Invalid GPU adapter set in `env.webgpu.adapter`. It must be a GPUAdapter object.")}else{let t=e.webgpu.powerPreference;if(t!==void 0&&t!==`low-power`&&t!==`high-performance`)throw Error(`Invalid powerPreference setting: "${t}"`);let r=e.webgpu.forceFallbackAdapter;if(r!==void 0&&typeof r!=`boolean`)throw Error(`Invalid forceFallbackAdapter setting: "${r}"`);if(n=await navigator.gpu.requestAdapter({powerPreference:t,forceFallbackAdapter:r}),!n)throw Error(`Failed to get GPU adapter. You may need to enable flag "--enable-unsafe-webgpu" if you are using Chrome.`)}}if(t===`webnn`&&(typeof navigator>`u`||!navigator.ml))throw Error(`WebNN is not supported in current environment`)},R_=new Map,z_=e=>{let t=X(),n=t.stackSave();try{let n=t.PTR_SIZE,r=t.stackAlloc(2*n);t._OrtGetInputOutputCount(e,r,r+n)!==0&&Z(`Can't get session input/output count.`);let i=n===4?`i32`:`i64`;return[Number(t.getValue(r,i)),Number(t.getValue(r+n,i))]}finally{t.stackRestore(n)}},B_=(e,t)=>{let n=X(),r=n.stackSave(),i=0;try{let r=n.PTR_SIZE,a=n.stackAlloc(2*r);n._OrtGetInputOutputMetadata(e,t,a,a+r)!==0&&Z(`Can't get session input/output metadata.`);let o=Number(n.getValue(a,`*`));i=Number(n.getValue(a+r,`*`));let s=n.HEAP32[i/4];if(s===0)return[o,0];let c=n.HEAPU32[i/4+1],l=[];for(let e=0;e<c;e++){let t=Number(n.getValue(i+8+e*r,`*`));l.push(t===0?Number(n.getValue(i+8+(e+c)*r,`*`)):n.UTF8ToString(t))}return[o,s,l]}finally{n.stackRestore(r),i!==0&&n._OrtFree(i)}},V_=e=>{let t=X(),n=t._malloc(e.byteLength);if(n===0)throw Error(`Can't create a session. failed to allocate a buffer of size ${e.byteLength}.`);return t.HEAPU8.set(e,n),[n,e.byteLength]},H_=async(e,t)=>{let n,r,i=X();Array.isArray(e)?[n,r]=e:e.buffer===i.HEAPU8.buffer?[n,r]=[e.byteOffset,e.byteLength]:[n,r]=V_(e);let a=0,o=0,s=[],c=[],l=[];try{if([o,s]=await S_(t),t?.externalData&&i.mountExternalData){let e=[];for(let n of t.externalData){let t=typeof n==`string`?n:n.path,r=typeof n==`string`?n:n.data;e.push(N_(r).then(e=>{i.mountExternalData(t,e)}))}await Promise.all(e)}for(let e of t?.executionProviders??[])if((typeof e==`string`?e:e.name)===`webnn`){if(i.shouldTransferToMLTensor=!1,typeof e!=`string`){let t=e,n=t?.context,r=t?.gpuDevice,a=t?.deviceType,o=t?.powerPreference;i.currentContext=n||(r?await i.webnnCreateMLContext(r):await i.webnnCreateMLContext({deviceType:a,powerPreference:o}))}else i.currentContext=await i.webnnCreateMLContext();break}a=await i._OrtCreateSession(n,r,o),i.webgpuOnCreateSession?.(a),a===0&&Z(`Can't create a session.`),i.jsepOnCreateSession?.(),i.currentContext&&(i.webnnRegisterMLContext(a,i.currentContext),i.currentContext=void 0,i.shouldTransferToMLTensor=!0);let[e,u]=z_(a),d=!!t?.enableGraphCapture,f=[],p=[],m=[],h=[];for(let t=0;t<e;t++){let[e,n,r]=B_(a,t);e===0&&Z(`Can't get an input name.`),c.push(e);let o=i.UTF8ToString(e);f.push(o),m.push(n===0?{name:o,isTensor:!1}:{name:o,isTensor:!0,type:T_(n),shape:r})}for(let t=0;t<u;t++){let[n,r,o]=B_(a,t+e);n===0&&Z(`Can't get an output name.`),l.push(n);let s=i.UTF8ToString(n);p.push(s),h.push(r===0?{name:s,isTensor:!1}:{name:s,isTensor:!0,type:T_(r),shape:o})}return R_.set(a,[a,c,l,null,d,!1]),[a,f,p,m,h]}catch(e){throw c.forEach(e=>i._OrtFree(e)),l.forEach(e=>i._OrtFree(e)),a!==0&&i._OrtReleaseSession(a)!==0&&Z(`Can't release session.`),e}finally{i._free(n),o!==0&&i._OrtReleaseSessionOptions(o)!==0&&Z(`Can't release session options.`),s.forEach(e=>i._free(e)),i.unmountExternalData?.()}},U_=e=>{let t=X(),n=R_.get(e);if(!n)throw Error(`cannot release session. invalid session id: ${e}`);let[r,i,a,o,s]=n;o&&(s&&t._OrtClearBoundOutputs(o.handle)!==0&&Z(`Can't clear bound outputs.`),t._OrtReleaseBinding(o.handle)!==0&&Z(`Can't release IO binding.`)),t.jsepOnReleaseSession?.(e),t.webnnOnReleaseSession?.(e),t.webgpuOnReleaseSession?.(e),i.forEach(e=>t._OrtFree(e)),a.forEach(e=>t._OrtFree(e)),t._OrtReleaseSession(r)!==0&&Z(`Can't release session.`),R_.delete(e)},W_=async(e,t,n,r,i,a,o=!1)=>{if(!e){t.push(0);return}let s=X(),c=s.PTR_SIZE,l=e[0],u=e[1],d=e[3],f=d,p,m;if(l===`string`&&(d===`gpu-buffer`||d===`ml-tensor`))throw Error(`String tensor is not supported on GPU.`);if(o&&d!==`gpu-buffer`)throw Error(`External buffer must be provided for input/output index ${a} when enableGraphCapture is true.`);if(d===`gpu-buffer`){let t=e[2].gpuBuffer;m=E_(w_(l),u);{let e=s.jsepRegisterBuffer;if(!e)throw Error(`Tensor location "gpu-buffer" is not supported without using WebGPU.`);p=e(r,a,t,m)}}else if(d===`ml-tensor`){let t=e[2].mlTensor;m=E_(w_(l),u);let n=s.webnnRegisterMLTensor;if(!n)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);p=n(r,t,w_(l),u)}else{let t=e[2];if(Array.isArray(t)){m=c*t.length,p=s._malloc(m),n.push(p);for(let e=0;e<t.length;e++){if(typeof t[e]!=`string`)throw TypeError(`tensor data at index ${e} is not a string`);s.setValue(p+e*c,f_(t[e],n),`*`)}}else{let e=s.webnnIsGraphInput,a=s.webnnIsGraphOutput;if(l!==`string`&&e&&a){let o=s.UTF8ToString(i);if(e(r,o)||a(r,o)){let e=w_(l);m=E_(e,u),f=`ml-tensor`;let n=s.webnnCreateTemporaryTensor,i=s.webnnUploadTensor;if(!n||!i)throw Error(`Tensor location "ml-tensor" is not supported without using WebNN.`);let a=await n(r,e,u);i(a,new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),p=a}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}else m=t.byteLength,p=s._malloc(m),n.push(p),s.HEAPU8.set(new Uint8Array(t.buffer,t.byteOffset,m),p)}}let h=s.stackSave(),g=s.stackAlloc(4*u.length);try{u.forEach((e,t)=>s.setValue(g+t*c,e,c===4?`i32`:`i64`));let e=s._OrtCreateTensor(w_(l),p,m,g,u.length,j_(f));e===0&&Z(`Can't create tensor for input/output. session=${r}, index=${a}.`),t.push(e)}finally{s.stackRestore(h)}},G_=async(e,t,n,r,i,a)=>{let o=X(),s=o.PTR_SIZE,c=R_.get(e);if(!c)throw Error(`cannot run inference. invalid session id: ${e}`);let l=c[0],u=c[1],d=c[2],f=c[3],p=c[4];c[5];let m=t.length,h=r.length,g=0,_=[],v=[],y=[],b=[],x=[],S=o.stackSave(),C=o.stackAlloc(m*s),w=o.stackAlloc(m*s),T=o.stackAlloc(h*s),ee=o.stackAlloc(h*s);try{[g,_]=h_(a),Cg(`wasm prepareInputOutputTensor`);for(let r=0;r<m;r++)await W_(n[r],v,b,e,u[t[r]],t[r],p);for(let t=0;t<h;t++)await W_(i[t],y,b,e,d[r[t]],m+r[t],p);wg(`wasm prepareInputOutputTensor`);for(let e=0;e<m;e++)o.setValue(C+e*s,v[e],`*`),o.setValue(w+e*s,u[t[e]],`*`);for(let e=0;e<h;e++)o.setValue(T+e*s,y[e],`*`),o.setValue(ee+e*s,d[r[e]],`*`);o.jsepOnRunStart?.(l),o.webnnOnRunStart?.(l);let c;c=await o._OrtRun(l,w,C,m,ee,h,T,g),c!==0&&Z(`failed to call OrtRun().`);let S=[],te=[];Cg(`wasm ProcessOutputTensor`);for(let t=0;t<h;t++){let n=Number(o.getValue(T+t*s,`*`));if(n===y[t]||x.includes(y[t])){S.push(i[t]),n!==y[t]&&o._OrtReleaseTensor(n)!==0&&Z(`Can't release tensor.`);continue}let a=o.stackSave(),c=o.stackAlloc(4*s),l=!1,u,d=0;try{o._OrtGetTensorData(n,c,c+s,c+2*s,c+3*s)!==0&&Z(`Can't access output tensor data on index ${t}.`);let i=s===4?`i32`:`i64`,a=Number(o.getValue(c,i));d=o.getValue(c+s,`*`);let p=o.getValue(c+s*2,`*`),m=Number(o.getValue(c+s*3,i)),h=[];for(let e=0;e<m;e++)h.push(Number(o.getValue(p+e*s,i)));o._OrtFree(p)!==0&&Z(`Can't free memory for tensor dims.`);let g=h.reduce((e,t)=>e*t,1);u=T_(a);let _=f?.outputPreferredLocations[r[t]];if(u===`string`){if(_===`gpu-buffer`||_===`ml-tensor`)throw Error(`String tensor is not supported on GPU.`);let e=[];for(let t=0;t<g;t++){let n=o.getValue(d+t*s,`*`),r=o.getValue(d+(t+1)*s,`*`),i=t===g-1?void 0:r-n;e.push(o.UTF8ToString(n,i))}S.push([u,h,e,`cpu`])}else if(_===`gpu-buffer`&&g>0){let e=o.jsepGetBuffer;if(!e)throw Error(`preferredLocation "gpu-buffer" is not supported without using WebGPU.`);let t=e(d),r=E_(a,g);if(r===void 0||!k_(u))throw Error(`Unsupported data type: ${u}`);l=!0,S.push([u,h,{gpuBuffer:t,download:o.jsepCreateDownloader(t,r,u),dispose:()=>{o._OrtReleaseTensor(n)!==0&&Z(`Can't release tensor.`)}},`gpu-buffer`])}else if(_===`ml-tensor`&&g>0){let t=o.webnnEnsureTensor,r=o.webnnIsGraphInputOutputTypeSupported;if(!t||!r)throw Error(`preferredLocation "ml-tensor" is not supported without using WebNN.`);if(E_(a,g)===void 0||!A_(u))throw Error(`Unsupported data type: ${u}`);if(!r(e,u,!1))throw Error(`preferredLocation "ml-tensor" for ${u} output is not supported by current WebNN Context.`);let i=await t(e,d,a,h,!1);l=!0,S.push([u,h,{mlTensor:i,download:o.webnnCreateMLTensorDownloader(d,u),dispose:()=>{o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n)}},`ml-tensor`])}else if(_===`ml-tensor-cpu-output`&&g>0){let e=o.webnnCreateMLTensorDownloader(d,u)(),t=S.length;l=!0,te.push((async()=>{let r=[t,await e];return o.webnnReleaseTensorId(d),o._OrtReleaseTensor(n),r})()),S.push([u,h,[],`cpu`])}else{let e=new(D_(u))(g);new Uint8Array(e.buffer,e.byteOffset,e.byteLength).set(o.HEAPU8.subarray(d,d+e.byteLength)),S.push([u,h,e,`cpu`])}}finally{o.stackRestore(a),u===`string`&&d&&o._free(d),l||o._OrtReleaseTensor(n)}}f&&!p&&(o._OrtClearBoundOutputs(f.handle)!==0&&Z(`Can't clear bound outputs.`),R_.set(e,[l,u,d,f,p,!1]));for(let[e,t]of await Promise.all(te))S[e][2]=t;return wg(`wasm ProcessOutputTensor`),S}finally{o.webnnOnRunEnd?.(l),o.stackRestore(S),v.forEach(e=>o._OrtReleaseTensor(e)),y.forEach(e=>o._OrtReleaseTensor(e)),b.forEach(e=>o._free(e)),g!==0&&o._OrtReleaseRunOptions(g),_.forEach(e=>o._free(e))}},K_=e=>{let t=X(),n=R_.get(e);if(!n)throw Error(`invalid session id`);let r=n[0],i=t._OrtEndProfiling(r);i===0&&Z(`Can't get an profile file name.`),t._OrtFree(i)},q_=e=>{let t=[];for(let n of e){let e=n[2];!Array.isArray(e)&&`buffer`in e&&t.push(e.buffer)}return t}}),Y_,X_,Z_,Q_,$_,ev,tv,nv,rv,iv,av,ov,sv,cv,lv,uv,dv,fv,pv=q(()=>{"use strict";Fg(),J_(),d_(),n_(),Y_=()=>!!Y.wasm.proxy&&typeof document<`u`,Z_=!1,Q_=!1,$_=!1,nv=new Map,rv=(e,t)=>{let n=nv.get(e);n?n.push(t):nv.set(e,[t])},iv=()=>{if(Z_||!Q_||$_||!X_)throw Error(`worker not ready`)},av=e=>{switch(e.data.type){case`init-wasm`:Z_=!1,e.data.err?($_=!0,tv[1](e.data.err)):(Q_=!0,tv[0]()),ev&&=(URL.revokeObjectURL(ev),void 0);break;case`init-ep`:case`copy-from`:case`create`:case`release`:case`run`:case`end-profiling`:{let t=nv.get(e.data.type);e.data.err?t.shift()[1](e.data.err):t.shift()[0](e.data.out);break}}},ov=async()=>{if(!Q_){if(Z_)throw Error(`multiple calls to 'initWasm()' detected.`);if($_)throw Error(`previous call to 'initWasm()' failed.`);if(Z_=!0,Y_())return new Promise((e,t)=>{X_?.terminate(),$g().then(([n,r])=>{try{X_=r,X_.onerror=e=>t(e),X_.onmessage=av,tv=[e,t];let i={type:`init-wasm`,in:Y};if(!i.in.wasm.wasmPaths&&n){let e=Kg();e&&(i.in.wasm.wasmPaths=e)}X_.postMessage(i),ev=n}catch(e){t(e)}},t)});try{await u_(Y.wasm),await I_(Y),Q_=!0}catch(e){throw $_=!0,e}finally{Z_=!1}}},sv=async e=>{if(Y_())return iv(),new Promise((t,n)=>{rv(`init-ep`,[t,n]);let r={type:`init-ep`,in:{epName:e,env:Y}};X_.postMessage(r)});await L_(Y,e)},cv=async e=>Y_()?(iv(),new Promise((t,n)=>{rv(`copy-from`,[t,n]);let r={type:`copy-from`,in:{buffer:e}};X_.postMessage(r,[e.buffer])})):V_(e),lv=async(e,t)=>{if(Y_()){if(t?.preferredOutputLocation)throw Error(`session option "preferredOutputLocation" is not supported for proxy.`);return iv(),new Promise((n,r)=>{rv(`create`,[n,r]);let i={type:`create`,in:{model:e,options:{...t}}},a=[];e instanceof Uint8Array&&a.push(e.buffer),X_.postMessage(i,a)})}return H_(e,t)},uv=async e=>{if(Y_())return iv(),new Promise((t,n)=>{rv(`release`,[t,n]);let r={type:`release`,in:e};X_.postMessage(r)});U_(e)},dv=async(e,t,n,r,i,a)=>{if(Y_()){if(n.some(e=>e[3]!==`cpu`))throw Error(`input tensor on GPU is not supported for proxy.`);if(i.some(e=>e))throw Error(`pre-allocated output tensor is not supported for proxy.`);return iv(),new Promise((i,o)=>{rv(`run`,[i,o]);let s=n,c={type:`run`,in:{sessionId:e,inputIndices:t,inputs:s,outputIndices:r,options:a}};X_.postMessage(c,q_(s))})}return G_(e,t,n,r,i,a)},fv=async e=>{if(Y_())return iv(),new Promise((t,n)=>{rv(`end-profiling`,[t,n]);let r={type:`end-profiling`,in:e};X_.postMessage(r)});K_(e)}}),mv,hv,gv,_v=q(()=>{"use strict";Fg(),pv(),M_(),Ig(),P_(),mv=(e,t)=>{switch(e.location){case`cpu`:return[e.type,e.dims,e.data,`cpu`];case`gpu-buffer`:return[e.type,e.dims,{gpuBuffer:e.gpuBuffer},`gpu-buffer`];case`ml-tensor`:return[e.type,e.dims,{mlTensor:e.mlTensor},`ml-tensor`];default:throw Error(`invalid data location: ${e.location} for ${t()}`)}},hv=e=>{switch(e[3]){case`cpu`:return new _g(e[0],e[2],e[1]);case`gpu-buffer`:{let t=e[0];if(!k_(t))throw Error(`not supported data type: ${t} for deserializing GPU tensor`);let{gpuBuffer:n,download:r,dispose:i}=e[2];return _g.fromGpuBuffer(n,{dataType:t,dims:e[1],download:r,dispose:i})}case`ml-tensor`:{let t=e[0];if(!A_(t))throw Error(`not supported data type: ${t} for deserializing MLTensor tensor`);let{mlTensor:n,download:r,dispose:i}=e[2];return _g.fromMLTensor(n,{dataType:t,dims:e[1],download:r,dispose:i})}default:throw Error(`invalid data location: ${e[3]}`)}},gv=class{async fetchModelAndCopyToWasmMemory(e){return cv(await N_(e))}async loadModel(e,t){xg();let n;n=typeof e==`string`?await this.fetchModelAndCopyToWasmMemory(e):e,[this.sessionId,this.inputNames,this.outputNames,this.inputMetadata,this.outputMetadata]=await lv(n,t),Sg()}async dispose(){return uv(this.sessionId)}async run(e,t,n){xg();let r=[],i=[];Object.entries(e).forEach(e=>{let t=e[0],n=e[1],a=this.inputNames.indexOf(t);if(a===-1)throw Error(`invalid input '${t}'`);r.push(n),i.push(a)});let a=[],o=[];Object.entries(t).forEach(e=>{let t=e[0],n=e[1],r=this.outputNames.indexOf(t);if(r===-1)throw Error(`invalid output '${t}'`);a.push(n),o.push(r)});let s=r.map((e,t)=>mv(e,()=>`input "${this.inputNames[i[t]]}"`)),c=a.map((e,t)=>e?mv(e,()=>`output "${this.outputNames[o[t]]}"`):null),l=await dv(this.sessionId,i,s,o,c,n),u={};for(let e=0;e<l.length;e++)u[this.outputNames[o[e]]]=a[e]??hv(l[e]);return Sg(),u}startProfiling(){}endProfiling(){fv(this.sessionId)}}}),vv={};Ih(vv,{OnnxruntimeWebAssemblyBackend:()=>bv,initializeFlags:()=>yv,wasmBackend:()=>xv});var yv,bv,xv,Sv=q(()=>{"use strict";Fg(),pv(),_v(),yv=()=>{(typeof Y.wasm.initTimeout!=`number`||Y.wasm.initTimeout<0)&&(Y.wasm.initTimeout=0);let e=Y.wasm.simd;if(typeof e!=`boolean`&&e!==void 0&&e!==`fixed`&&e!==`relaxed`&&(console.warn(`Property "env.wasm.simd" is set to unknown value "${e}". Reset it to \`false\` and ignore SIMD feature checking.`),Y.wasm.simd=!1),typeof Y.wasm.proxy!=`boolean`&&(Y.wasm.proxy=!1),typeof Y.wasm.trace!=`boolean`&&(Y.wasm.trace=!1),typeof Y.wasm.numThreads!=`number`||!Number.isInteger(Y.wasm.numThreads)||Y.wasm.numThreads<=0){if(typeof self<`u`&&!self.crossOriginIsolated)Y.wasm.numThreads=1;else{let e=typeof navigator>`u`?Fh(`node:os`).cpus().length:navigator.hardwareConcurrency;Y.wasm.numThreads=Math.min(4,Math.ceil((e||1)/2))}}},bv=class{async init(e){yv(),await ov(),await sv(e)}async createInferenceSessionHandler(e,t){let n=new gv;return await n.loadModel(e,t),n}},xv=new bv});Fg(),Fg(),Fg();var Cv=`1.30.0`,wv=Pg;{let e=(Sv(),Rh(vv)).wasmBackend;Vh(`cpu`,e,10),Vh(`wasm`,e,10)}Object.defineProperty(Y.versions,"web",{value:Cv,enumerable:!0}),U();var Tv=new Map,Ev=!1,Dv,Ov=Ah,kv=()=>[`wasm`],Av=()=>globalThis.crossOriginIsolated&&!!globalThis.SharedArrayBuffer,jv=async()=>{if(Ev)return Ov;Ov.env.wasm.numThreads=+!Av();let[e,t]=await Promise.all([dd({filename:`ort-wasm-simd-threaded.mjs`}),ud({filename:`ort-wasm-simd-threaded.wasm`})]);return Ov.env.wasm.wasmPaths={mjs:e},Ov.env.wasm.wasmBinary=t,Ev=!0,Ov},Mv=async({filename:e})=>{let t=Tv.get(e);try{return t||(t=(async()=>{let t=await jv(),n=await ud({filename:e}),r=await t.InferenceSession.create(n,{executionProviders:kv(),extra:{session:{load_model_format:`ORT`}},graphOptimizationLevel:`disabled`});return{inputNames:r.inputNames,outputNames:r.outputNames,run:async e=>{let t=Dv,n=Promise.withResolvers();Dv=n.promise,await t;try{return await r.run(e)}finally{n.resolve(),Dv===n.promise&&(Dv=void 0)}}}})(),Tv.set(e,t)),await t}catch(n){throw t&&Tv.get(e)===t&&Tv.delete(e),Error(H.MODEL_LOAD_FAILED,{cause:n})}};U();var Nv=Ah,Pv={environment:`browser`,createCanvas:(e,t)=>new OffscreenCanvas(e,t),createImageData:(e,t)=>new ImageData(e,t),createImageBitmap:(async(...e)=>{try{return await createImageBitmap(...e)}catch(e){throw Error(H.IMAGE_DECODE_FAILED,{cause:e})}}),session:Mv,tensor:(e,t,n)=>new Nv.Tensor(e,t,n)};gh({runtime:Pv});var Fv=gh({runtime:Pv}),Iv=Dh({runtime:Pv}),Lv=sh({runtime:Pv}),Rv=fh({runtime:Pv,imageFromImageBitmap:Fv});kh({runtime:Pv,...Iv,...Lv,...Rv,faceDetection:Rv});var zv=Eh({runtime:Pv}),Bv=vh({runtime:Pv});Wu(),U(),km(),Qp(),am(),tm();var Vv=z({id:gl()}),Hv=L().min(1).max(255),Uv=L().min(1).max(255),Wv=L().max(500),Gv=L().min(32).max(128),Kv=Dm.pose,qv=xl(Kv).min(2).max(4),Jv=z({action:Hv,subjectId:Uv.optional(),metadata:Wv.optional()}),Yv=nm.extend({action:Hv,poses:qv}),Xv=z({gender:Dl([`female`,`male`]).optional(),age:wl([R(),R()]).refine(([e,t])=>e<=t).optional()}),Zv=z({token:Gv,poses:qv,faces:xl(Zp).min(2).max(4),assertions:Xv.optional()}),Qv=z({token:Gv,assertions:Xv,face:Zp,reason:Zu.nullable()}),$v=z({resultId:gl(),token:Gv,outcome:em,reason:Zu.nullable()}),ey=z({search:L().default(``)}),ty=z({id:gl(),created_at:Bu({offset:!0}),action:Hv,subject_id:Uv.nullable(),outcome:em.nullable(),reason:L().nullable(),country:L().nullable()}),ny={id:Vv,action:Hv,subjectId:Uv,metadata:Wv,token:Gv,pose:Kv,poses:qv,intentInput:Jv,intent:Yv,assertions:Xv,verifyInput:Zv,rejectInput:Qv,verify:$v,listInput:ey,summary:ty,detail:ty.extend({metadata:Wv.nullable(),score:R().nullable(),poses:xl(Kv),expires_at:Bu({offset:!0}),resolved_at:Bu({offset:!0}).nullable(),consumed_at:Bu({offset:!0}).nullable(),origin:L().nullable(),ip:L().nullable(),user_agent:L().nullable()}),list:xl(ty)};z({created_at:L(),action:L(),outcome:em.nullable(),country:L().nullable()});var ry,iy=t((()=>{ry={INTENT_TOKEN_INVALID:`The intent token is invalid, expired, or already used.`,FACEKEY_ALREADY_ENROLLED:`This subject already has a FaceKey.`,FACEKEY_NOT_ENROLLED:`This subject does not have a FaceKey.`,FACEKEY_VERSION_MISMATCH:`The FaceKey version is incompatible. Enroll again.`,FACEKEY_KEY_UNAVAILABLE:`The FaceKey encryption key is unavailable.`,FACEKEY_TEMPLATE_INVALID:`The stored FaceKey template is invalid.`,OPERATION_CANCELLED:`The operation was cancelled.`,OPERATION_TIMEOUT:`The operation exceeded its time limit.`,CLIENT_KEY_REQUIRED:`A client key is required.`,API_KEY_FORBIDDEN:`This API key cannot access this resource.`,CAMERA_INTERRUPTED:`Camera capture was interrupted.`,CAMERA_NOT_FOUND:`No camera was found.`,CAMERA_PERMISSION_DENIED:`Camera permission was denied.`,CAMERA_UNAVAILABLE:`The camera is unavailable.`,CAMERA_UNSUPPORTED:`This browser does not support camera access.`,CAPTURES_INCOMPLETE:`Some required captures are missing.`,CLIENT_ASSET_NOT_FOUND:`The requested client asset was not found.`,CLIENT_NOT_AVAILABLE:`The client is unavailable.`,CONTACT_RATE_LIMITED:`Too many contact requests were sent. Try again later.`,DOCUMENT_BACK_CONTAINS_FACE:`The document back contains a face. Show the back of the document.`,DOCUMENT_BACK_NOT_DISTINCT:`The document back must differ from the front.`,DOCUMENT_BACK_REQUIRED:`The document back is required.`,DOCUMENT_BLURRY:`The document image is blurry.`,DOCUMENT_CODE_TYPE_MISMATCH:`The document code does not match the document type.`,DOCUMENT_FACE_GEOMETRY_INVALID:`The document photo size or position is invalid.`,DOCUMENT_FACE_NOT_CONTAINED:`The document photo is not fully visible.`,DOCUMENT_FACE_NOT_FOUND:`No face was found on the document.`,DOCUMENT_NOT_FOUND:`No document was found.`,DOCUMENT_NOT_RECOGNIZED:`The document could not be recognized.`,DOCUMENT_TEXT_ALIGNMENT_INVALID:`The document text alignment is invalid.`,DOCUMENT_TEXT_NOT_READABLE:`The document text is not readable.`,DOCUMENT_VALIDATION_FAILED:`The document could not be validated.`,EMAIL_ALREADY_REGISTERED:`This email address is already registered.`,EMAIL_DELIVERY_FAILED:`The email could not be sent.`,EUROPEAN_LICENCE_BACK_MARKER_REQUIRED:`The licence back marker is missing.`,FACE_AGE_MISMATCH:`The detected age is outside the requested range.`,FACE_ALIGNMENT_FAILED:`The face could not be aligned.`,FACE_ATTRIBUTES_UNAVAILABLE:`The face attributes could not be detected.`,FACE_GENDER_MISMATCH:`The detected gender does not match the requested gender.`,FACE_LIGHTING_INVALID:`The face lighting is unsuitable.`,FACE_MISMATCH:`The faces do not match.`,FACE_NOT_FOUND:`No face was found.`,FACE_NOT_STABLE:`The face did not remain still.`,FACE_NOT_USABLE:`The face image is unsuitable for analysis.`,FACE_OUT_OF_FRAME:`The face is outside the frame.`,FACE_POSE_INVALID:`The face pose is invalid.`,FACE_SPOOF_DETECTED:`A spoof attempt was detected. Present a live face.`,GEO_DATABASE_DOWNLOAD_EMPTY:`The location database download was empty.`,GEO_DATABASE_DOWNLOAD_FAILED:`The location database could not be downloaded.`,IMAGE_DECODE_FAILED:`The image could not be decoded.`,IMAGE_ENCODE_FAILED:`The image could not be encoded.`,IMAGE_PROCESSING_FAILED:`The image could not be processed.`,IMAGE_TOO_LARGE:`The image exceeds the size limit.`,INFERENCE_FAILED:`Image analysis failed.`,INFERENCE_QUEUE_FULL:`Image analysis capacity is full. Try again later.`,INFERENCE_TIMEOUT:`Image analysis exceeded its time limit.`,VALIDATION_ERROR:`The request data is invalid.`,RESPONSE_VALIDATION_ERROR:`The service response failed validation.`,RESOURCE_NOT_FOUND:`The requested resource was not found.`,RESOURCE_NOT_FOUND_IN_VIEW:`The requested resource is not available in this view.`,REQUEST_TOO_LARGE:`The request exceeds the size limit.`,INTERNAL_ERROR:`An internal error occurred.`,INVALID_CREDENTIALS:`The credentials are invalid.`,BILLING_DETAILS_REQUIRED:`Billing details are required.`,PAYMENT_METHOD_NOT_FOUND:`No payment method was found.`,PAYMENT_NOT_FOUND:`The payment was not found.`,RECOVERY_SENT:`A recovery email was sent.`,INVALID_DOCUMENT_AAMVA:`The document barcode is invalid.`,INVALID_DOCUMENT_MRZ:`The document machine readable zone is invalid.`,INVALID_FACE_MATCH_INPUT:`The face matching input is invalid.`,INVALID_IMAGE:`The image is invalid.`,INVALID_KEY_LABEL:`The key label is invalid.`,INVALID_MODEL_OUTPUT:`Image analysis returned invalid output.`,INVALID_OPTIONS:`The SDK options are invalid.`,INVALID_PASSPORT_MRZ:`The passport machine readable zone is invalid.`,INVALID_POSES:`The face pose sequence is invalid.`,INVALID_CLIENT_KEY:`The client key is invalid.`,INVALID_REGISTRATION:`The registration data is invalid.`,INVALID_SERVICE_RESPONSE:`The service returned an invalid response.`,INVALID_VERIFICATION_FEEDBACK:`The verification feedback is invalid.`,INVALID_VERIFICATION_INPUT:`The verification input is invalid.`,KEY_NOT_FOUND:`The key was not found.`,MODEL_LOAD_FAILED:`The analysis assets could not be loaded.`,MULTIPLE_FACES:`More than one face was found.`,NETWORK_ERROR:`The network request failed.`,NO_USABLE_CANDIDATES:`No usable candidate face was found.`,NO_USABLE_REFERENCES:`No usable reference face was found.`,OCR_DICTIONARY_MISMATCH:`The text recognition dictionary is incompatible.`,OCR_ENVIRONMENT_MISMATCH:`The text recognition environment is incompatible.`,OCR_LANGUAGE_UNSUPPORTED:`The text recognition language is unsupported.`,OCR_MODEL_UNSUPPORTED:`The text recognition model is unsupported.`,PAYMENT_FAILED:`The payment failed.`,BILLING_ACCOUNT_BLOCKED:`The billing account is blocked.`,ACCOUNT_HAS_UNBILLED_USAGE:`The account has unbilled usage.`,POSE_IDENTITY_MISMATCH:`The face images show different identities.`,POSE_BACKGROUND_MISMATCH:`The face images show different backgrounds.`,SERVICE_UNAVAILABLE:`The service is unavailable.`,SUPERADMIN_REQUIRED:`Administrator access is required.`,UI_ELEMENT_NOT_FOUND:`A required SDK UI element was not found.`,UNAUTHORIZED:`Authentication is required.`,USER_ACCESS_REQUIRED:`User access is required.`,USER_NOT_FOUND:`The user was not found.`,VERIFICATION_SAVE_FAILED:`The verification could not be saved.`,INVALID_PDF:`The PDF is invalid.`,PDF_LOAD_FAILED:`PDF support could not be loaded.`,PDF_PASSWORD_REQUIRED:`Password protected PDFs are not supported.`,SDK_CAPABILITY_NOT_CONFIGURED:`This SDK capability is not configured.`,SDK_DISPOSED:`This SDK instance was disposed.`,OPERATION_IN_PROGRESS:`An SDK operation is already in progress.`,AUTHORIZATION_FAILED:`The authorization callback failed.`}})),Q,ay,oy,sy=t((()=>{Xu(),iy(),Q=({code:e,cause:t,status:n,resultId:r})=>Object.assign(Error(ry[e],{cause:t}),{name:`VoltomSdkError`,code:e,...n===void 0?{}:{status:n},...r===void 0?{}:{resultId:r}}),ay=e=>typeof e==`object`&&!!e&&`name`in e&&e.name===`VoltomSdkError`&&`message`in e&&typeof e.message==`string`&&`code`in e&&Ku(e.code),oy=({error:e,fallback:t=H.INTERNAL_ERROR,signal:n})=>{if(n?.aborted){let t=Yu({error:n.reason,fallback:H.OPERATION_CANCELLED})===H.OPERATION_TIMEOUT?H.OPERATION_TIMEOUT:H.OPERATION_CANCELLED;return Q({code:t,cause:e})}if(ay(e))return e;let r=typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`?e.status:void 0,i=typeof e==`object`&&e&&`resultId`in e&&typeof e.resultId==`string`?e.resultId:void 0;return Q({code:Yu({error:e,fallback:t}),cause:e,status:r,resultId:i})}}));am(),sy();var cy=async({task:e})=>{try{return await e()}catch(e){throw oy({error:e,fallback:H.AUTHORIZATION_FAILED})}},ly=({intent:e,action:t})=>{let n=nm.safeParse(e);if(!n.success)throw Q({code:H.INVALID_SERVICE_RESPONSE,cause:e});if(n.data.action!==t||Date.parse(n.data.expiresAt)<=Date.now())throw Q({code:H.INTENT_TOKEN_INVALID,resultId:n.data.resultId})},uy=async({operation:e,signal:t})=>{let n=Promise.withResolvers(),r=()=>n.reject(t.reason);t.addEventListener(`abort`,r,{once:!0}),t.aborted&&r();try{return await Promise.race([e,n.promise])}finally{t.removeEventListener(`abort`,r)}},dy,fy,py,my,hy,gy,_y,vy,yy,by=t((()=>{sy(),dy=new WeakMap,fy=async({video:e,signal:t})=>{t?.throwIfAborted();let n=Promise.withResolvers(),r=e,i=dy.get(e)??new Set,a=null,o=null,s=!1,c=c=>{s||(s=!0,a!==null&&r.cancelVideoFrameCallback?.(a),o!==null&&cancelAnimationFrame(o),t?.removeEventListener(`abort`,u),i.delete(l),i.size||dy.delete(e),c?n.reject(c):n.resolve())},l=()=>c(Q({code:H.OPERATION_CANCELLED})),u=()=>c(Q({code:H.OPERATION_CANCELLED}));i.add(l),dy.set(e,i),t?.addEventListener(`abort`,u,{once:!0}),r.requestVideoFrameCallback?a=r.requestVideoFrameCallback(()=>c()):o=requestAnimationFrame(()=>c()),await n.promise},py=()=>{let e=/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent),t=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return e||t},my=async()=>{let e=[],t=(t,n)=>{n||e.push(t)};if(t(`navigator.mediaDevices.getUserMedia`,typeof navigator.mediaDevices==`object`&&typeof navigator.mediaDevices.getUserMedia==`function`),t(`navigator.mediaDevices.enumerateDevices`,typeof navigator.mediaDevices==`object`&&typeof navigator.mediaDevices.enumerateDevices==`function`),t(`MediaStream`,typeof MediaStream<`u`),t(`MediaStreamTrack`,typeof MediaStreamTrack<`u`),t(`HTMLVideoElement`,typeof HTMLVideoElement<`u`),t(`createImageBitmap`,typeof createImageBitmap==`function`),t(`OffscreenCanvas`,typeof OffscreenCanvas<`u`),t(`OffscreenCanvas.getContext`,typeof OffscreenCanvas<`u`&&typeof OffscreenCanvas.prototype.getContext==`function`),t(`OffscreenCanvas.convertToBlob`,typeof OffscreenCanvas<`u`&&typeof OffscreenCanvas.prototype.convertToBlob==`function`),t(`WebAssembly`,typeof WebAssembly<`u`),t(`fetch`,typeof fetch==`function`),t(`Blob`,typeof Blob<`u`),t(`File`,typeof File<`u`),t(`URL.createObjectURL`,typeof URL.createObjectURL==`function`),t(`URL.revokeObjectURL`,typeof URL.revokeObjectURL==`function`),!e.includes(`OffscreenCanvas`)&&!e.includes(`OffscreenCanvas.getContext`)&&!e.includes(`OffscreenCanvas.convertToBlob`))try{let e=new OffscreenCanvas(1,1),n=e.getContext(`2d`);if(t(`OffscreenCanvas 2D context`,n!==null),n&&typeof createImageBitmap==`function`){let n=await e.convertToBlob({type:`image/jpeg`});t(`JPEG encoding`,n.type===`image/jpeg`),n.type===`image/jpeg`&&((await createImageBitmap(n)).close(),t(`JPEG decoding`,!0))}else t(`JPEG encoding`,!1),t(`JPEG decoding`,!1)}catch{e.includes(`JPEG encoding`)||t(`JPEG encoding`,!1),t(`JPEG decoding`,!1)}else t(`JPEG encoding`,!1),t(`JPEG decoding`,!1);return{supported:e.length===0,unsupportedFeatures:e}},hy=({video:e})=>{for(let t of dy.get(e)??[])t();let t=e.srcObject;if(t instanceof MediaStream)for(let e of t.getTracks())e.stop();e.srcObject=null},gy=async({facingMode:e,video:t,signal:n})=>{if(!navigator.mediaDevices||typeof navigator.mediaDevices.getUserMedia!=`function`)throw Q({code:H.CAMERA_UNSUPPORTED});let r={facingMode:{ideal:e}};py()||(r.width={ideal:1280},r.height={ideal:720});let i=()=>hy({video:t});n?.addEventListener(`abort`,i,{once:!0});try{let i=await navigator.mediaDevices.getUserMedia({video:r,audio:!1});if(n?.aborted){for(let e of i.getTracks())e.stop();n.throwIfAborted()}t.srcObject=i;let a=(await navigator.mediaDevices.enumerateDevices()).filter(({kind:e})=>e===`videoinput`).length>1?e:`user`;return await t.play(),n?.throwIfAborted(),a}catch(e){if(hy({video:t}),n?.aborted)throw Q({code:H.OPERATION_CANCELLED});let r=e instanceof Error?e.name:``,i=H.CAMERA_UNAVAILABLE;throw(r===`NotAllowedError`||r===`SecurityError`)&&(i=H.CAMERA_PERMISSION_DENIED),r===`NotFoundError`&&(i=H.CAMERA_NOT_FOUND),r===`AbortError`&&(i=H.CAMERA_INTERRUPTED),Q({code:i,cause:e})}finally{n?.removeEventListener(`abort`,i)}},_y=async({canvas:e,quality:t})=>{try{let n=await e.convertToBlob({type:`image/jpeg`,quality:t});if(n.type!==`image/jpeg`)throw Q({code:H.IMAGE_ENCODE_FAILED});return n}catch(e){throw Q({code:H.IMAGE_ENCODE_FAILED,cause:e})}},vy=async({frame:e})=>{let t=new OffscreenCanvas(e.width,e.height),n=t.getContext(`2d`);if(!n)throw Q({code:H.IMAGE_PROCESSING_FAILED});return n.drawImage(e,0,0),await _y({canvas:t})},yy=async({image:e})=>{let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));return`data:image/jpeg;base64,${btoa(n)}`}}));by();var xy=({pitch:e,pose:t,requireEyeLevelCamera:n=!0,options:r})=>{if(!n||t!==`faceStraight`)return null;let i=Math.max(-8,r.minPitch),a=Math.min(8,r.maxPitch);return!Number.isFinite(e)||e<i||e>a?`FACE_CAMERA_ALIGNMENT_REQUIRED`:null},Sy=()=>py()?`alignPhoneWithFace`:`alignFaceWithWebcam`,Cy,wy=t((()=>{Cy={INTENT_TOKEN_INVALID:`intentTokenInvalid`,FACEKEY_ALREADY_ENROLLED:`faceKeyAlreadyEnrolled`,FACEKEY_NOT_ENROLLED:`faceKeyNotEnrolled`,FACEKEY_VERSION_MISMATCH:`faceKeyVersionMismatch`,FACEKEY_KEY_UNAVAILABLE:`serviceUnavailable`,FACEKEY_TEMPLATE_INVALID:`serviceUnavailable`,OPERATION_CANCELLED:`verificationCancelled`,OPERATION_TIMEOUT:`operationTimeout`,CLIENT_KEY_REQUIRED:`clientKeyRequired`,API_KEY_FORBIDDEN:`accessDenied`,CAMERA_INTERRUPTED:`cameraInterrupted`,CAMERA_NOT_FOUND:`cameraNotFound`,CAMERA_PERMISSION_DENIED:`cameraPermissionDenied`,CAMERA_UNAVAILABLE:`cameraUnavailable`,CAMERA_UNSUPPORTED:`cameraUnsupported`,CAPTURES_INCOMPLETE:`capturesIncomplete`,CLIENT_ASSET_NOT_FOUND:`verificationFailed`,CLIENT_NOT_AVAILABLE:`verificationFailed`,CONTACT_RATE_LIMITED:`verificationFailed`,DOCUMENT_BACK_CONTAINS_FACE:`documentBackHasFace`,DOCUMENT_BACK_NOT_DISTINCT:`documentBackSameAsFront`,DOCUMENT_BACK_REQUIRED:`frameDocumentBack`,DOCUMENT_BLURRY:`documentBlurry`,DOCUMENT_CODE_TYPE_MISMATCH:`documentNotRecognized`,DOCUMENT_FACE_GEOMETRY_INVALID:`documentAlignmentInvalid`,DOCUMENT_FACE_NOT_CONTAINED:`documentAlignmentInvalid`,DOCUMENT_FACE_NOT_FOUND:`faceNotVisibleInDocument`,DOCUMENT_NOT_FOUND:`documentNotDetected`,DOCUMENT_NOT_RECOGNIZED:`documentNotRecognized`,DOCUMENT_TEXT_ALIGNMENT_INVALID:`documentAlignmentInvalid`,DOCUMENT_TEXT_NOT_READABLE:`documentNotReadable`,DOCUMENT_VALIDATION_FAILED:`documentValidationFailed`,EMAIL_ALREADY_REGISTERED:`verificationFailed`,EMAIL_DELIVERY_FAILED:`verificationFailed`,EUROPEAN_LICENCE_BACK_MARKER_REQUIRED:`frameDocumentBack`,FACE_AGE_MISMATCH:`faceAgeMismatch`,FACE_ALIGNMENT_FAILED:`faceNotUsable`,FACE_ATTRIBUTES_UNAVAILABLE:`faceAttributesUnavailable`,FACE_GENDER_MISMATCH:`faceGenderMismatch`,FACE_LIGHTING_INVALID:`faceNotUsable`,FACE_MISMATCH:`faceMismatch`,FACE_NOT_FOUND:`terminalFaceNotFound`,FACE_NOT_STABLE:`stayStill`,FACE_NOT_USABLE:`faceNotUsable`,FACE_OUT_OF_FRAME:`centerFace`,FACE_POSE_INVALID:`facePoseInvalid`,FACE_SPOOF_DETECTED:`faceSpoofDetected`,GEO_DATABASE_DOWNLOAD_EMPTY:`verificationFailed`,GEO_DATABASE_DOWNLOAD_FAILED:`verificationFailed`,IMAGE_DECODE_FAILED:`invalidImage`,IMAGE_ENCODE_FAILED:`imageEncodeFailed`,IMAGE_PROCESSING_FAILED:`imageProcessingFailed`,IMAGE_TOO_LARGE:`requestTooLarge`,INFERENCE_FAILED:`serviceUnavailable`,INFERENCE_QUEUE_FULL:`rateLimited`,INFERENCE_TIMEOUT:`operationTimeout`,VALIDATION_ERROR:`invalidInput`,RESPONSE_VALIDATION_ERROR:`invalidServiceResponse`,RESOURCE_NOT_FOUND:`verificationFailed`,RESOURCE_NOT_FOUND_IN_VIEW:`verificationFailed`,REQUEST_TOO_LARGE:`requestTooLarge`,INTERNAL_ERROR:`serviceUnavailable`,INVALID_CREDENTIALS:`verificationFailed`,BILLING_DETAILS_REQUIRED:`verificationFailed`,PAYMENT_METHOD_NOT_FOUND:`verificationFailed`,PAYMENT_NOT_FOUND:`verificationFailed`,RECOVERY_SENT:`verificationFailed`,INVALID_DOCUMENT_AAMVA:`documentCodeNotReadable`,INVALID_DOCUMENT_MRZ:`documentCodeNotReadable`,INVALID_FACE_MATCH_INPUT:`invalidInput`,INVALID_IMAGE:`invalidImage`,INVALID_KEY_LABEL:`verificationFailed`,INVALID_MODEL_OUTPUT:`invalidModelOutput`,INVALID_OPTIONS:`invalidOptions`,INVALID_PASSPORT_MRZ:`documentCodeNotReadable`,INVALID_POSES:`invalidPoses`,INVALID_CLIENT_KEY:`invalidClientKey`,INVALID_REGISTRATION:`verificationFailed`,INVALID_SERVICE_RESPONSE:`invalidServiceResponse`,INVALID_VERIFICATION_FEEDBACK:`verificationFailed`,INVALID_VERIFICATION_INPUT:`invalidInput`,KEY_NOT_FOUND:`verificationFailed`,MODEL_LOAD_FAILED:`modelLoadFailed`,MULTIPLE_FACES:`centerFace`,NETWORK_ERROR:`networkError`,NO_USABLE_CANDIDATES:`terminalFaceNotFound`,NO_USABLE_REFERENCES:`faceNotUsable`,OCR_DICTIONARY_MISMATCH:`modelLoadFailed`,OCR_ENVIRONMENT_MISMATCH:`modelLoadFailed`,OCR_LANGUAGE_UNSUPPORTED:`invalidOptions`,OCR_MODEL_UNSUPPORTED:`invalidOptions`,PAYMENT_FAILED:`verificationFailed`,BILLING_ACCOUNT_BLOCKED:`billingAccountBlocked`,ACCOUNT_HAS_UNBILLED_USAGE:`verificationFailed`,POSE_IDENTITY_MISMATCH:`poseIdentityMismatch`,POSE_BACKGROUND_MISMATCH:`poseBackgroundMismatch`,SERVICE_UNAVAILABLE:`serviceUnavailable`,SUPERADMIN_REQUIRED:`verificationFailed`,UI_ELEMENT_NOT_FOUND:`serviceUnavailable`,UNAUTHORIZED:`accessDenied`,USER_ACCESS_REQUIRED:`verificationFailed`,USER_NOT_FOUND:`verificationFailed`,VERIFICATION_SAVE_FAILED:`verificationSaveFailed`,INVALID_PDF:`invalidPdf`,PDF_LOAD_FAILED:`pdfLoadFailed`,PDF_PASSWORD_REQUIRED:`pdfPasswordRequired`,SDK_CAPABILITY_NOT_CONFIGURED:`sdkCapabilityNotConfigured`,SDK_DISPOSED:`sdkDisposed`,OPERATION_IN_PROGRESS:`operationInProgress`,AUTHORIZATION_FAILED:`authorizationFailed`}})),Ty,Ey,Dy,Oy,ky,Ay,jy,My,Ny,Py,Fy,Iy,Ly,Ry,zy,By,Vy,Hy,Uy,Wy,Gy,Ky,qy,Jy,Yy,Xy,Zy,Qy,$y,eb,tb,nb,rb,ib,ab,ob,sb,cb,lb,ub,db,fb,pb,mb,hb,gb,_b,vb,yb,bb,xb,Sb,Cb,wb,Tb,Eb,Db,Ob,kb,Ab,jb,Mb,Nb,Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb,Hb,Ub,Wb,Gb,Kb,qb,Jb,Yb,Xb,Zb,Qb,$b,ex,tx,nx,rx,ix,ax,ox,sx,cx,lx,ux,dx,fx,px,mx,hx,gx,_x,vx,yx,bx,xx,Sx,Cx,wx,Tx,Ex,Dx,Ox,kx,Ax,jx,Mx,Nx,Px,Fx,Ix,Lx,Rx,zx,Bx,Vx,Hx,Ux,Wx,Gx,Kx,qx,Jx,Yx,Xx,Zx,Qx,$x,eS,tS,nS,rS,iS,aS,oS,sS,cS,lS,uS,dS,fS,pS,mS,hS,gS,_S=t((()=>{Ty=`Invalid document`,Ey=`Checking face match`,Dy=`Checking document`,Oy=`Loading verification assets`,ky=`{percent}% · {downloaded} MB of {total} MB`,Ay=`About {time} remaining`,jy=`Ready to start`,My=`Preparing verification models`,Ny=`Document is not readable`,Py=`The document image is blurry`,Fy=`Error: {message}`,Iy=`Face`,Ly=`Center your face in the camera view and keep it fully visible`,Ry=`Not a real human. Show your real face.`,zy=`Move closer until your face fills the frame`,By=`No face visible in the document`,Vy=`Show the front of the document`,Hy=`Frame the passport photo page`,Uy=`Make all text visible and well readable`,Wy=`Hold the document straight with the photo and text fully visible`,Gy=`Show the back of the document`,Ky=`Stay still`,qy=`Hold the document still`,Jy=`Lower your chin slightly`,Yy=`Turn your head slightly left`,Xy=`Turn your head slightly right`,Zy=`Look straight into the camera`,Qy=`Raise your phone to eye level`,$y=`Move your face to webcam level`,eb=`Raise your phone to eye level`,tb=`Keep your face centered in the camera view`,nb=`Tilt your screen until you can look straight into the camera`,rb=`Raise your chin slightly`,ib=`Turn less`,ab=`Raise less`,ob=`Lower less`,sb=`Tilt less`,cb=`Smile`,lb=`Tilt your head slightly left`,ub=`Tilt your head slightly right`,db=`Keep left eye closed`,fb=`Keep right eye closed`,pb=`Match ({score}%)`,mb=`No match ({score}%)`,hb=`Start`,gb=`Stop`,_b=`Straighten your head`,vb=`Verification capture {index}`,yb=`Allow camera access to continue.`,bb=`No camera was found.`,xb=`The camera is unavailable.`,Sb=`Connection failed.`,Cb=`The verification service is unavailable.`,wb=`Verification assets could not be loaded.`,Tb=`Use a clear face image with even lighting.`,Eb=`Verification could not be completed.`,Db=`The operation was cancelled.`,Ob=`Some required captures are missing.`,kb=`The document could not be validated.`,Ab=`The verification settings are invalid.`,jb=`The face verification sequence is invalid.`,Mb=`The verification service returned an invalid response.`,Nb=`Keep the same background during face verification.`,Pb=`The face verification images do not match.`,Fb=`The image could not be prepared.`,Ib=`The image could not be processed.`,Lb=`Select a valid image file.`,Rb=`The verification key is missing.`,zb=`The verification could not be saved.`,Bb=`Retry`,Vb=`Move your face left until it is centered in the camera view.`,Hb=`Move your face right until it is centered in the camera view.`,Ub=`Move your face up until it is centered in the camera view.`,Wb=`Move your face down until it is centered in the camera view.`,Gb=`Tilt your head slightly to your left to straighten it.`,Kb=`Tilt your head slightly to your right to straighten it.`,qb=`Turn your head slightly to your left.`,Jb=`Turn your head slightly to your right.`,Yb=`Raise your chin slightly.`,Xb=`Lower your chin slightly.`,Zb=`Smile more clearly.`,Qb=`Close your left eye and keep your right eye open.`,$b=`Close your right eye and keep your left eye open.`,ex=`Document not found.`,tx=`Move the document closer.`,nx=`Move the document farther away.`,rx=`Move the document slightly farther away.`,ix=`Frame the whole document.`,ax=`The document shape is invalid.`,ox=`The document is not supported.`,sx=`Make sure the photo on the document is fully visible.`,cx=`Make sure the document photo is fully visible.`,lx=`Make sure the document photo and text are fully visible.`,ux=`Keep the document straight, with the photo on the left and text on the right.`,dx=`This document could not be recognized. Use a supported identity document.`,fx=`Make all text and code lines visible and readable.`,px=`Show the back of the document, not the front.`,mx=`The back must be different from the front.`,hx=`The photo on the document is too small.`,gx=`Invalid PDF`,_x=`Password protected PDFs are not supported`,vx=`Could not load PDF support. Try again.`,yx=`Preparing camera`,bx=`Checking your face`,xx=`Done`,Sx=`Face not recognized`,Cx=`Center your face in the circle`,wx=`Set up FaceKey`,Tx=`Unlock with FaceKey`,Ex=`Camera preview`,Dx=`Face capture progress`,Ox=`Move your head left`,kx=`Move your head right`,Ax=`Raise your head`,jx=`Lower your head`,Mx=`Tilt your head left`,Nx=`Tilt your head right`,Px=`Cancel`,Fx=`Face not recognized. Try this pose again.`,Ix=`Face does not match. Try this pose again.`,Lx=`Face not usable. Try this pose again.`,Rx=`The operation took too long. Try again.`,zx=`This authorization has expired or is invalid. Start again.`,Bx=`The client key is invalid.`,Vx=`The file or request is too large.`,Hx=`This feature is not enabled.`,Ux=`This SDK instance is no longer available.`,Wx=`An operation is already in progress.`,Gx=`Authorization failed. Try again.`,Kx=`A FaceKey is already registered.`,qx=`Register a FaceKey before you unlock.`,Jx=`Register your FaceKey again to continue.`,Yx=`This account is blocked by a billing issue.`,Xx=`The service is busy. Try again later.`,Zx=`Image analysis returned an invalid result.`,Qx=`This browser does not support camera access.`,$x=`Camera capture was interrupted. Try again.`,eS=`Access was denied.`,tS=`The supplied data is invalid.`,nS=`The faces do not match.`,rS=`No face was found in the image.`,iS=`The requested face pose could not be verified.`,aS=`Match the face orientation in your reference`,oS=`Acquire human`,sS=`Acquire document`,cS=`Acquire reference`,lS=`Match ID`,uS=`Verification steps`,dS=`Preparing reference`,fS=`A spoof attempt was detected. Present a live face.`,pS=`The detected age is outside the requested range.`,mS=`The face attributes could not be detected.`,hS=`The detected gender does not match the requested gender.`,gS={invalidDocument:Ty,checkingFaceMatch:Ey,checkingDocument:Dy,loadingAssets:Oy,loadingProgress:ky,loadingRemaining:Ay,readyToStart:jy,preparingModels:My,document:`Doc`,documentNotReadable:Ny,documentBlurry:Py,error:Fy,face:Iy,faceNotFound:Ly,faceInPolygon:Ry,faceTooSmall:zy,faceNotVisibleInDocument:By,frameDocument:Vy,framePassport:Hy,passportMrzNotReadable:Uy,documentAlignmentInvalid:Wy,frameDocumentBack:Gy,stayStill:Ky,holdDocumentStill:qy,lookDown:Jy,lookLeft:Yy,lookRight:Xy,lookStraight:Zy,alignPhoneWithFace:Qy,alignFaceWithWebcam:$y,raisePhone:eb,centerFace:tb,tiltScreen:nb,lookUp:rb,turnLess:ib,raiseLess:ab,lowerLess:ob,tiltLess:sb,smile:cb,tiltLeft:lb,tiltRight:ub,winkLeft:db,winkRight:fb,match:pb,noMatch:mb,start:hb,stop:gb,straightenHead:_b,verificationCapture:vb,cameraPermissionDenied:yb,cameraNotFound:bb,cameraUnavailable:xb,networkError:Sb,serviceUnavailable:Cb,modelLoadFailed:wb,faceNotUsable:Tb,verificationFailed:Eb,verificationCancelled:Db,capturesIncomplete:Ob,documentValidationFailed:kb,invalidOptions:Ab,invalidPoses:jb,invalidServiceResponse:Mb,poseBackgroundMismatch:Nb,poseIdentityMismatch:Pb,imageEncodeFailed:Fb,imageProcessingFailed:Ib,invalidImage:Lb,clientKeyRequired:Rb,verificationSaveFailed:zb,retry:Bb,faceCenterMoveLeft:Vb,faceCenterMoveRight:Hb,faceCenterMoveUp:Ub,faceCenterMoveDown:Wb,faceTiltMoreLeft:Gb,faceTiltMoreRight:Kb,faceTurnLeft:qb,faceTurnRight:Jb,faceLookMoreUp:Yb,faceLookMoreDown:Xb,faceSmileRequired:Zb,faceWinkLeftRequired:Qb,faceWinkRightRequired:$b,documentNotDetected:ex,documentBoxTooSmall:tx,documentBoxTooLarge:nx,documentBoxNearEdge:rx,documentBoxTouchesEdges:ix,documentShapeInvalid:ax,documentNotSupported:ox,documentPhotoNotVisible:sx,documentPhotoNotContained:cx,documentPhotoSizeInvalid:lx,documentLayoutInvalid:ux,documentNotRecognized:dx,documentCodeNotReadable:fx,documentBackHasFace:px,documentBackSameAsFront:mx,documentPhotoTooSmall:hx,invalidPdf:gx,pdfPasswordRequired:_x,pdfLoadFailed:vx,preparingCamera:yx,checkingFace:bx,done:xx,faceNotRecognized:Sx,faceNotCentered:Cx,setUpFaceKey:wx,unlockWithFaceKey:Tx,cameraPreview:Ex,faceCaptureProgress:Dx,moveHeadLeft:Ox,moveHeadRight:kx,moveHeadUp:Ax,moveHeadDown:jx,tiltHeadLeft:Mx,tiltHeadRight:Nx,cancel:Px,faceRetryPose:Fx,faceRetryMatch:Ix,faceRetryUsable:Lx,operationTimeout:Rx,intentTokenInvalid:zx,invalidClientKey:Bx,requestTooLarge:Vx,sdkCapabilityNotConfigured:Hx,sdkDisposed:Ux,operationInProgress:Wx,authorizationFailed:Gx,faceKeyAlreadyEnrolled:Kx,faceKeyNotEnrolled:qx,faceKeyVersionMismatch:Jx,billingAccountBlocked:Yx,rateLimited:Xx,invalidModelOutput:Zx,cameraUnsupported:Qx,cameraInterrupted:$x,accessDenied:eS,invalidInput:tS,faceMismatch:nS,terminalFaceNotFound:rS,facePoseInvalid:iS,matchReferencePose:aS,acquireHuman:oS,acquireDocument:sS,acquireReference:cS,matchId:lS,verificationSteps:uS,preparingReference:dS,faceSpoofDetected:fS,faceAgeMismatch:pS,faceAttributesUnavailable:mS,faceGenderMismatch:hS}})),vS,yS,bS,xS,SS,CS,wS,TS,ES,DS=t((()=>{fd(),wy(),sy(),_S(),vS=[`ar`,`ch`,`de`,`en`,`es`,`fr`,`it`,`ja`,`pt`,`ru`,`zh`],yS=new Map,bS=new Map,xS=async({language:e})=>{if(yS.has(e))return;let t=bS.get(e);t||(t=(async()=>{try{let t=await ud({filename:`locales/${e}.json`}),n=JSON.parse(new TextDecoder().decode(t));if(typeof n!=`object`||!n||Array.isArray(n)||Object.values(n).some(e=>typeof e!=`string`))throw Q({code:H.MODEL_LOAD_FAILED,cause:n});return n}catch(e){throw oy({error:e,fallback:H.MODEL_LOAD_FAILED})}})(),bS.set(e,t));try{yS.set(e,await t)}finally{bS.delete(e)}},SS=async({language:e})=>{let t=e??wS();await Promise.all([xS({language:t}),...t===`en`?[]:[xS({language:`en`})]])},CS=({element:e,theme:t})=>{t&&(e.dataset.theme=t)},wS=()=>{let e=[navigator.language,...navigator.languages];for(let t of e){let e=t.toLowerCase();if(/^zh-(hk|mo|tw)\b/u.test(e))return`ch`;let n=e.split(`-`)[0];if(vS.includes(n))return n}return`en`},TS=({language:e})=>{let t=e??wS(),n=e=>{let n=yS.get(t),r=yS.get(`en`);return n?.[e]??r?.[e]??gS[e]};return{translate:n,translateError:({error:e})=>{let t=Yu({error:e}),r=Cy[t]??`verificationFailed`;return n(r)}}},ES=async({milliseconds:e})=>{let t=Promise.withResolvers();setTimeout(()=>t.resolve(),e),await t.promise}}));DS(),fd(),sy();var OS=`https://api.voltom.io`,kS={prepare:!0,debug:!1},AS=({url:e})=>{if(typeof e!=`string`)throw Q({code:H.INVALID_OPTIONS});let t;try{t=new URL(e)}catch{throw Q({code:H.INVALID_OPTIONS})}if(![`http:`,`https:`].includes(t.protocol)||t.username||t.password||t.search||t.hash)throw Q({code:H.INVALID_OPTIONS});return t.href.replace(/\/+$/u,``)},jS=({apiUrl:e=OS,sdkUrl:t=ad})=>{let n={apiUrl:AS({url:e}),sdkUrl:AS({url:t})};try{sd({sdkUrl:n.sdkUrl})}catch(e){throw oy({error:e,fallback:H.INVALID_OPTIONS})}return n},MS=({options:e,capabilities:t,authorizeRequired:n=!1})=>{if(typeof e!=`object`||!e)throw Q({code:H.INVALID_OPTIONS});if(!(`clientKey`in e)||e.clientKey===``)throw Q({code:H.CLIENT_KEY_REQUIRED});if(typeof e.clientKey!=`string`)throw Q({code:H.INVALID_CLIENT_KEY});if(n&&!(`authorize`in e)||`authorize`in e&&e.authorize!==void 0&&typeof e.authorize!=`function`)throw Q({code:H.INVALID_OPTIONS});for(let t of[`prepare`,`debug`,`requireEyeLevelCamera`,`ui`])if(t in e&&e[t]!==void 0&&typeof e[t]!=`boolean`)throw Q({code:H.INVALID_OPTIONS});if(`capabilities`in e&&e.capabilities!==void 0&&(!Array.isArray(e.capabilities)||e.capabilities.some(e=>!t.includes(e))))throw Q({code:H.INVALID_OPTIONS})},NS=({options:e})=>{if(typeof e!=`object`||!e||Array.isArray(e)||`debug`in e&&e.debug!==void 0&&typeof e.debug!=`boolean`)throw Q({code:H.INVALID_OPTIONS});if(!(`signal`in e)||e.signal===void 0)return;let t=e.signal;if(typeof t!=`object`||!t||!(`aborted`in t)||typeof t.aborted!=`boolean`||!(`addEventListener`in t)||typeof t.addEventListener!=`function`||!(`removeEventListener`in t)||typeof t.removeEventListener!=`function`||!(`throwIfAborted`in t)||typeof t.throwIfAborted!=`function`)throw Q({code:H.INVALID_OPTIONS})},PS,FS,IS,LS=t((()=>{PS={faceReference:{primary:`matchReferencePose`},faceStraight:{primary:`lookStraight`},faceUp:{primary:`lookUp`},faceDown:{primary:`lookDown`},faceLeft:{primary:`lookLeft`},faceRight:{primary:`lookRight`},faceSmile:{primary:`smile`},faceWinkLeft:{primary:`winkLeft`},faceTiltLeft:{primary:`tiltLeft`},faceTiltRight:{primary:`tiltRight`}},FS={FACE_ROLL_TILT_LEFT:`tiltLeft`,FACE_ROLL_TILT_RIGHT:`tiltRight`,FACE_ROLL_TILT_LESS:`tiltLess`,FACE_YAW_TURN_LEFT:`lookLeft`,FACE_YAW_TURN_RIGHT:`lookRight`,FACE_YAW_TURN_LESS:`turnLess`,FACE_PITCH_LOOK_UP:`lookUp`,FACE_PITCH_LOOK_DOWN:`lookDown`,FACE_PITCH_RAISE_LESS:`raiseLess`,FACE_PITCH_LOWER_LESS:`lowerLess`,FACE_SMILE_REQUIRED:`smile`,FACE_WINK_LEFT_REQUIRED:`winkLeft`,FACEKEY_LOWER_HEAD:`lookDown`,FACEKEY_LOWER_HEAD_LESS:`lowerLess`,FACEKEY_RAISE_HEAD:`lookUp`,FACEKEY_RAISE_HEAD_LESS:`raiseLess`,FACEKEY_SMILE_REQUIRED:`smile`,FACEKEY_TILT_HEAD_LEFT:`tiltLeft`,FACEKEY_TILT_HEAD_LESS:`tiltLess`,FACEKEY_TILT_HEAD_RIGHT:`tiltRight`,FACEKEY_TURN_HEAD_LEFT:`lookLeft`,FACEKEY_TURN_HEAD_LESS:`turnLess`,FACEKEY_TURN_HEAD_RIGHT:`lookRight`,FACEKEY_WINK_LEFT_REQUIRED:`winkLeft`},IS={facePoses:PS,poseRejections:FS}})),RS,zS,BS=t((()=>{LS(),RS=({pose:e})=>{let t=IS.facePoses[e];return{...t,primary:t.primary}},zS=({code:e})=>IS.poseRejections[e]})),VS,HS,US,WS,GS,KS=t((()=>{Xm(),km(),BS(),VS=({pose:e})=>{let t=sm[e];return t?.yaw===void 0?t?.pitch===void 0?t?.roll===void 0?e===`faceStraight`?{axis:`roll`,value:0}:{axis:null,value:null}:{axis:`roll`,value:t.roll}:{axis:`pitch`,value:t.pitch}:{axis:`yaw`,value:t.yaw}},HS=({alignment:e,neutral:t})=>t?{pitch:e.pitch-t.pitch,yaw:e.yaw-t.yaw,roll:e.roll-t.roll}:e,US=({alignment:e,blendshapes:t,neutral:n,pose:r,options:i,referencePose:a})=>{if(r===`faceReference`&&a){let t=`yaw`;for(let n of[`pitch`,`roll`])Math.abs(e[n]-a[n])>Math.abs(e[t]-a[t])&&(t=n);let n=e[t]-a[t],i=Im({alignment:e,target:a}),o=i===null?`inside`:Math.abs(n)<=23?`approaching`:`outside`;return{pose:r,referencePose:a,axis:t,target:a[t],error:n,zone:o,code:i}}let o=HS({alignment:e,neutral:r===`faceStraight`?null:n}),s=Fm({...e,blendshapes:t,pose:r,options:i});s===null&&r===`faceUp`&&n&&(s=Fm({...e,pitch:o.pitch,blendshapes:t,pose:r,options:i}));let c=VS({pose:r}),l=c.axis&&c.value!==null?o[c.axis]-c.value:0,u=(i.tolerance??15)+8,d=s===null?`inside`:Math.abs(l)<=u?`approaching`:`outside`;return{pose:r,axis:c.axis,target:c.value,error:l,zone:d,code:s}},WS=({corrective:e,pose:t})=>{let n=RS({pose:t}).primary;return{primary:n,corrective:e&&e!==n?e:null}},GS=({pose:e,code:t})=>WS({pose:e,corrective:t?zS({code:t}):null})}));KS(),U(),sy();var qS=async({apiUrl:e,path:t,method:n=`POST`,body:r,clientKey:i,signal:a})=>{let o=AS({url:e??`https://api.voltom.io`}),s={};i&&(s.authorization=`Bearer ${i}`),r&&(s[`content-type`]=`application/json`);let c;try{a?.throwIfAborted(),c=await fetch(`${o}${t}`,{method:n,headers:s,body:r,signal:a})}catch(e){throw oy({error:e,fallback:H.NETWORK_ERROR,signal:a})}if(c.status===413)throw Q({code:H.REQUEST_TOO_LARGE,status:c.status});let l;try{l=await c.json(),a?.throwIfAborted()}catch(e){throw oy({error:Q({code:H.INVALID_SERVICE_RESPONSE,status:c.status,cause:e}),signal:a})}if(!c.ok){let e=Qu.safeParse(l);throw e.success?Q({code:e.data.code,status:c.status,cause:l}):Q({code:H.INVALID_SERVICE_RESPONSE,status:c.status,cause:l})}return l},JS=()=>({active:ot(!1),debugEnabled:ot(!1),debug:ot([]),error:ot(null),phase:ot(`idle`),prompt:ot(``),pose:ot(null),framing:ot(!0),completed:ot(0),total:ot(1),outcome:ot(null),captures:ot([])});sy();var YS=({attributes:e,gender:t,age:n})=>e?t&&t!==`any`&&e.gender!==t?H.FACE_GENDER_MISMATCH:n&&(e.age<n[0]||e.age>n[1])?H.FACE_AGE_MISMATCH:null:H.FACE_ATTRIBUTES_UNAVAILABLE,XS=e=>{if(MS({options:e,capabilities:[],authorizeRequired:!0}),typeof e.authorize!=`function`||e.requireEyeLevelCamera!==void 0&&typeof e.requireEyeLevelCamera!=`boolean`)throw Q({code:H.INVALID_OPTIONS});return{...e,requireEyeLevelCamera:e.requireEyeLevelCamera??!1}},ZS=e=>{if(NS({options:e}),typeof e.action!=`string`||e.action.length<1||e.action.length>255||e.subjectId!==void 0&&(typeof e.subjectId!=`string`||e.subjectId.length<1||e.subjectId.length>255)||e.metadata!==void 0&&(typeof e.metadata!=`string`||e.metadata.length>500)||e.gender!==void 0&&e.gender!==`female`&&e.gender!==`male`&&e.gender!==`any`)throw Q({code:H.INVALID_OPTIONS});if(e.age!==void 0){let t=e.age;if(!Array.isArray(t)||t.length!==2||!Number.isFinite(t[0])||!Number.isFinite(t[1])||t[0]>t[1])throw Q({code:H.INVALID_OPTIONS})}return e},QS,$S=t((()=>{QS=`[data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light dark;--theme-canvas:var(--lightningcss-light,#fafafa)var(--lightningcss-dark,#0b0b0b);--theme-surface:var(--lightningcss-light,#fff)var(--lightningcss-dark,#202020);--theme-surface-subtle:var(--lightningcss-light,#f5f5f5)var(--lightningcss-dark,#2c2c2c);--theme-text:var(--lightningcss-light,#121212)var(--lightningcss-dark,#f7f7f7);--theme-text-muted:var(--lightningcss-light,#626262)var(--lightningcss-dark,#a3a3a3);--theme-text-inverse:var(--lightningcss-light,#fafafa)var(--lightningcss-dark,#0b0b0b);--theme-border:var(--lightningcss-light,#bfbfbf)var(--lightningcss-dark,#606060);--theme-primary:var(--lightningcss-light,#121212)var(--lightningcss-dark,#f7f7f7);--theme-primary-hover:var(--lightningcss-light,#262626)var(--lightningcss-dark,#e5e5e5);--theme-primary-active:var(--lightningcss-light,#404040)var(--lightningcss-dark,#d4d4d4);--theme-focus:var(--lightningcss-light,#525252)var(--lightningcss-dark,#d4d4d4);--theme-cocoa:var(--lightningcss-light,#6b4423)var(--lightningcss-dark,#d29a63);--theme-mint:var(--lightningcss-light,#116b4c)var(--lightningcss-dark,#38efb0);--theme-cyan:var(--lightningcss-light,#0e7490)var(--lightningcss-dark,#22d3ee);--theme-violet:var(--lightningcss-light,#5b21b6)var(--lightningcss-dark,#b69cff);--theme-berry:var(--lightningcss-light,#a21caf)var(--lightningcss-dark,#e879f9);--theme-danger:var(--lightningcss-light,#b42318)var(--lightningcss-dark,#ff6b6b);--theme-danger-surface:var(--lightningcss-light,#fee2e2)var(--lightningcss-dark,#451a19);--theme-success:var(--lightningcss-light,#087443)var(--lightningcss-dark,#4ade80);--theme-success-surface:var(--lightningcss-light,#e7f6ee)var(--lightningcss-dark,#123c2b);--theme-warning:var(--lightningcss-light,#a16207)var(--lightningcss-dark,#ffc93c);--theme-warning-surface:var(--lightningcss-light,#fef3c7)var(--lightningcss-dark,#422006)}@media (prefers-color-scheme:dark){[data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]{--lightningcss-light: ;--lightningcss-dark:initial}}:is(.dark,[data-theme=dark]) :is([data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]){--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}:is(.light,[data-theme=light]) :is([data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root]){--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}:is([data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root])[data-theme=dark]{--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}:is([data-voltom-demo],[data-voltom-root],[data-facekey-root],[data-facegate-root])[data-theme=light]{--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}[data-pose-silhouette],[data-pose-arrow]{display:block;overflow:visible}[data-pose-arrow]{pointer-events:none;fill:none;width:64px;height:64px;stroke:var(--theme-mint);stroke-width:7px;stroke-linecap:round;stroke-linejoin:round;position:absolute;bottom:4%;left:50%;transform:translate(-50%)}[data-pose-arrow] [data-pose-solid]{fill:var(--theme-mint);stroke:none}[data-pose-silhouette] [data-pose-head]{fill:none;stroke:var(--theme-border);stroke-width:1.5px;stroke-dasharray:5 5}[data-pose-silhouette] [data-pose-eye]{fill:var(--theme-text-muted);stroke:none}[data-pose-silhouette] [data-pose-mouth],[data-pose-silhouette] [data-pose-eye-closed],[data-pose-motion]{fill:none;stroke:var(--theme-cyan);stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round}[data-pose-motion]{stroke-dasharray:6 6;animation:.9s linear infinite pose-motion}[data-pose-arrowhead]{fill:var(--theme-cyan);stroke:none}[data-pose-arrow] [data-pose-motion]{stroke:var(--theme-mint);stroke-width:8px;stroke-dasharray:none;animation:none}[data-pose-arrow] [data-pose-arrowhead]{fill:var(--theme-mint)}[data-pose-arrow] [data-pose-smile]{fill:none;stroke:var(--theme-mint);stroke-width:8px;stroke-linecap:round}[data-pose-progress][data-variant=bar]{gap:4px;width:100%;display:flex}[data-pose-progress][data-variant=bar] [data-pose-progress-step]{background:var(--theme-border);border-radius:9999px;flex:1;height:4px;transition:background .2s}[data-pose-progress][data-variant=bar] [data-pose-progress-step][data-complete]{background:var(--theme-mint)}[data-pose-progress][data-variant=ring]{display:block;overflow:visible}[data-pose-progress][data-variant=ring] [data-pose-progress-step]{fill:none;stroke:var(--theme-border);stroke-width:2px;stroke-linecap:round;transition:stroke .3s}[data-pose-progress][data-variant=ring] [data-pose-progress-step][data-complete]{stroke:var(--theme-mint)}[data-pose-success]{opacity:0;pointer-events:none}[data-pose-success] circle{fill:var(--theme-success-surface);stroke:var(--theme-mint);stroke-width:2px}[data-pose-success] path{fill:none;stroke:var(--theme-mint);stroke-width:5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1px}[data-pose-success][data-visible]{animation:.42s ease-out both pose-success-appear}[data-pose-success][data-visible] path{animation:.24s ease-out 60ms both pose-success-draw}@keyframes pose-motion{to{stroke-dashoffset:-12px}}@keyframes pose-success-appear{0%{opacity:0;transform:scale(.85)}to{opacity:1;transform:scale(1)}}@keyframes pose-success-draw{to{stroke-dashoffset:0}}@media (prefers-reduced-motion:reduce){[data-pose-motion]{animation:none}[data-pose-success][data-visible]{opacity:1}[data-pose-success][data-visible] path{stroke-dashoffset:0}}[data-facegate-gate]{z-index:60;background:color-mix(in srgb, var(--theme-canvas) 84%, transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);place-items:center;padding:24px;font-family:ui-sans-serif,system-ui,sans-serif;display:grid;position:fixed;inset:0}[data-facegate-gate] .facegate-stage{place-items:center;display:grid;position:relative}[data-facegate-gate] .facegate-camera{aspect-ratio:1;flex-shrink:0;width:min(60vw,240px,38dvh);position:relative}[data-facegate-gate] .facegate-camera video{object-fit:cover;background:var(--theme-surface-subtle);border-radius:999px;width:100%;height:100%}[data-facegate-gate] .facegate-camera[data-mirrored] video{transform:scaleX(-1)}[data-facegate-gate] .facegate-camera>[data-pose-progress]{width:calc(100% + 28px);height:calc(100% + 28px);position:absolute;inset:-14px;overflow:visible}[data-facegate-gate] .facegate-camera>[data-pose-success]{z-index:2;transform-origin:50%;width:112px;height:112px;margin:auto;position:absolute;inset:0}[data-facegate-gate] .facegate-camera[data-shake]{animation:.48s both facegate-shake}[data-facegate-gate] .facegate-spinner-host{z-index:3;background:color-mix(in srgb, var(--theme-canvas) 70%, transparent);border-radius:999px;place-items:center;display:grid;position:absolute;inset:0}[data-facegate-gate] .facegate-spinner{width:40px;height:40px;color:var(--theme-text);animation:.9s linear infinite facegate-spin}[data-facegate-gate] .facegate-prompt{width:min(80vw,300px);color:var(--theme-text);text-align:center;margin:0;font-size:17px;font-weight:600;position:absolute;top:calc(100% + 30px);left:50%;transform:translate(-50%)}[data-facegate-gate][data-result=pass] [data-pose-progress-step]{stroke:var(--theme-mint)}[data-facegate-gate][data-result=reject] [data-pose-progress-step]{stroke:var(--theme-danger)}@keyframes facegate-shake{0%,to{transform:translate(0)rotate(0)}20%{transform:translate(-6px)rotate(-6deg)}40%{transform:translate(6px)rotate(6deg)}60%{transform:translate(-5px)rotate(-4deg)}80%{transform:translate(5px)rotate(4deg)}}@keyframes facegate-spin{to{transform:rotate(360deg)}}@media (width<=600px){[data-facegate-gate] .facegate-camera{width:min(82vw,300px)}}@media (prefers-reduced-motion:reduce){[data-facegate-gate] .facegate-camera[data-shake],[data-facegate-gate] .facegate-spinner{animation:none}}[data-facegate-debug]{top:max(8px, env(safe-area-inset-top));z-index:1;border:1px solid var(--theme-border);background:color-mix(in srgb, var(--theme-surface) 75%, transparent);width:min(220px,100% - 16px);color:var(--theme-text-muted);pointer-events:none;border-radius:8px;padding:8px 10px;font:10px/1.4 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;position:fixed;left:8px}[data-facegate-debug].hidden{display:none}[data-facegate-debug] [data-valid=true]{color:var(--theme-mint)}[data-facegate-debug] [data-valid=false]{color:var(--theme-danger)}`}));function $(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:eC,__v:--tC,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),E.vnode&&E.vnode(l),l}var eC,tC,nC=t((()=>{be(),eC=Symbol.for(`pv`),tC=0,Array.isArray})),rC,iC=t((()=>{nC(),rC=({className:e,entries:t,kind:n})=>$(`div`,{className:t.length?e:`hidden`,[`data-${n}-debug`]:``,children:t.map(({label:e,valid:t,value:n})=>$(`div`,{children:[$(`span`,{children:[e,`: `]}),$(`span`,{"data-valid":t===void 0?void 0:String(t),children:n})]},e))})})),aC,oC,sC,cC,lC,uC,dC,fC=t((()=>{Ke(),km(),nC(),aC={faceUp:0,faceRight:90,faceDown:180,faceLeft:270},oC=({rotation:e})=>$(`g`,{transform:`rotate(${e} 50 50)`,children:$(`path`,{"data-pose-solid":``,d:`M 46 82 Q 44 82 44 80 V 42 Q 44 40 42 40 H 33 Q 29 40 32 37 L 48.5 19 Q 50 17 51.5 19 L 68 37 Q 71 40 67 40 H 58 Q 56 40 56 42 V 80 Q 56 82 54 82 Z`})}),sC=()=>$(`path`,{"data-pose-motion":``,d:`M 22 50 H 78`}),cC=({left:e})=>{let t=we();return $(s,{children:[$(`defs`,{children:$(`marker`,{id:t,viewBox:`0 0 6 6`,markerUnits:`userSpaceOnUse`,markerWidth:`24`,markerHeight:`24`,refX:`4.4`,refY:`3`,orient:`auto`,children:$(`path`,{"data-pose-solid":``,d:`M 0.6 0.3 Q 0 0 0 0.7 V 5.3 Q 0 6 0.6 5.7 L 5.4 3.3 Q 6 3 5.4 2.7 Z`})})}),$(`path`,{"data-pose-motion":``,d:e?`M 68 26 Q 44 34 32 62`:`M 32 26 Q 56 34 68 62`,"marker-end":`url(#${t})`})]})},lC=({referencePose:e})=>{let{yaw:t,pitch:n,roll:r}=e;if(Math.max(Math.abs(t),Math.abs(n))<=15)return Math.abs(r)>=15?$(cC,{left:r>0}):$(sC,{});let i=Math.atan2(-t,-n)*180/Math.PI;return $(oC,{rotation:i})},uC=({pose:e,referencePose:t})=>{let n=aC[e];return n===void 0?e===`faceStraight`?$(sC,{}):e===`faceReference`&&t?$(lC,{referencePose:t}):e===`faceTiltLeft`||e===`faceTiltRight`?$(cC,{left:e===`faceTiltLeft`}):e===`faceSmile`?$(`path`,{"data-pose-smile":``,d:`M 15 45 A 35 35 0 0 0 85 45`}):e===`faceWinkLeft`?$(s,{children:[$(`circle`,{cx:`50`,cy:`50`,r:`33`}),$(`path`,{d:`M 30 46 Q 38 38 46 46`}),$(`circle`,{"data-pose-solid":``,cx:`64`,cy:`44`,r:`4`})]}):null:$(oC,{rotation:n})},dC=({className:e,pose:t,referencePose:n})=>$(`svg`,{className:e,"data-pose-arrow":``,"data-pose":t,viewBox:`0 0 100 100`,"aria-hidden":`true`,children:$(uC,{pose:t,referencePose:n})})})),pC,mC,hC,gC,_C,vC=t((()=>{nC(),pC=100,mC=2,hC=({total:e})=>pC/e-(e===1?0:mC),gC=({arc:e,index:t,total:n})=>({dasharray:`${e} ${pC-e}`,offset:`${-t*pC/n}`}),_C=({className:e,completed:t,label:n,total:r,variant:i=`bar`})=>{if(i===`ring`){let i=hC({total:r});return $(`svg`,{className:e,"data-pose-progress":``,"data-variant":`ring`,viewBox:`0 0 100 100`,role:`progressbar`,"aria-label":n,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":t,children:$(`g`,{transform:`rotate(-90 50 50)`,children:Array.from({length:r},(e,n)=>{let{dasharray:a,offset:o}=gC({arc:i,index:n,total:r});return $(`circle`,{cx:`50`,cy:`50`,r:`50`,pathLength:pC,ref:e=>{e&&(e.setAttribute(`stroke-dasharray`,a),e.setAttribute(`stroke-dashoffset`,o))},"data-pose-progress-step":``,"data-complete":n<t?``:void 0},n)})})})}return $(`div`,{className:e,"data-pose-progress":``,"data-variant":`bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":r,"aria-valuenow":t,children:Array.from({length:r},(e,n)=>$(`span`,{"data-pose-progress-step":``,"data-complete":n<t?``:void 0},n))})}})),yC,bC=t((()=>{nC(),yC=({className:e,visible:t})=>$(`svg`,{className:e,"data-pose-success":``,"data-visible":t?``:void 0,viewBox:`0 0 100 100`,"aria-hidden":`true`,children:[$(`circle`,{cx:`50`,cy:`50`,r:`44`}),$(`path`,{d:`M29 51 43 65 72 36`,pathLength:`1`})]})})),xC=n({createFaceGateView:()=>wC}),SC,CC,wC,TC=t((()=>{be(),Ke(),$S(),iC(),sy(),by(),fC(),vC(),bC(),nC(),SC=()=>$(`svg`,{className:`facegate-spinner`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:$(`path`,{d:`M12 3a9 9 0 1 0 9 9`})}),CC=({display:e,videoRef:t,options:n,onCancel:r})=>{let{translate:i}=TS({language:n.language});Se(()=>{if(!t.current)throw Q({code:H.UI_ELEMENT_NOT_FOUND});let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let a=e.outcome.value,o=e.phase.value===`checking`,s=e.completed.value,c=e.total.value,l=a===`fail`||a===`error`,u=e.pose.value;return $(`div`,{className:`facegate-gate`,"data-facegate-gate":``,"data-result":a===`pass`?`pass`:a?`reject`:``,onClick:e=>{e.target===e.currentTarget&&r()},children:[$(`style`,{"data-facegate-styles":``,children:QS}),$(rC,{kind:`facegate`,entries:e.debugEnabled.value?[{label:`Phase`,value:e.phase.value},{label:`Progress`,value:`${e.completed.value}/${e.total.value}`},...e.debug.value]:[]}),$(`div`,{className:`facegate-stage`,role:`dialog`,"aria-modal":`true`,"aria-label":`Liveness check`,children:[$(`div`,{className:`facegate-camera`,"data-mirrored":``,"data-shake":l?``:void 0,children:[$(`video`,{ref:t,autoPlay:!0,muted:!0,playsInline:!0,"aria-label":i(`cameraPreview`)}),$(_C,{completed:s,label:i(`faceCaptureProgress`),total:c,variant:`ring`}),$(yC,{visible:a===`pass`}),!(e.phase.value!==`capturing`||a||!u||e.framing.value)&&$(dC,{pose:u}),o?$(`div`,{className:`facegate-spinner-host`,children:$(SC,{})}):null]}),a?null:$(`p`,{className:`facegate-prompt`,role:`status`,"aria-live":`polite`,children:e.prompt.value})]})]})},wC=({options:e,display:t,onCancel:n})=>{let r=o(),i=null,a=0;return{get video(){return r.current},collectCaptureDebug:({inspected:e,pose:n,stable:r})=>{let o=performance.now();if(!t.debugEnabled.value||!i||o-a<100)return;a=o;let s=e.alignment;t.debug.value=[{label:`Pose`,value:n},{label:`Pitch`,value:s?s.pitch.toFixed(2):`—`},{label:`Yaw`,value:s?s.yaw.toFixed(2):`—`},{label:`Roll`,value:s?s.roll.toFixed(2):`—`},{label:`Ready`,valid:e.ready,value:String(e.ready)},{label:`Reason`,value:e.ready?`—`:e.code??e.prompt},{label:`Stable`,value:`${r}/3`}]},requiredVideo:()=>{if(!r.current)throw Q({code:H.UI_ELEMENT_NOT_FOUND});return r.current},open:()=>{i||(a=0,i=document.createElement(`div`),i.dataset.facegateRoot=``,CS({element:i,theme:e.theme}),document.body.append(i),ne($(CC,{display:t,videoRef:r,options:e,onCancel:n}),i))},close:()=>{if(!i)return;let e=r.current;e&&hy({video:e}),ne(null,i),i.remove(),i=null}}}}));fd(),Xm(),km(),sy(),DS(),by(),KS();var{detectPictureFaces:EC,loadFaceDetector:DC}=Rv,{detectFaceLiveness:OC,loadFaceLiveness:kC}=zv,{detectFaceAttributes:AC,loadFaceAttributes:jC}=Bv,MC=3e4,NC=({payload:e})=>{let t=ny.verify.omit({token:!0}).safeParse(e);if(!t.success||t.data.outcome===`pass`&&t.data.reason!==null)throw Q({code:H.INVALID_SERVICE_RESPONSE,cause:e});return t.data},PC=async({frame:e,neutral:t,pose:n,requireEyeLevelCamera:r})=>{let i=await EC(e,{blendshapes:!0}),a=i.length===1?i[0]:null;if(!a)return{framing:!0,alignment:null,code:null,face:null,prompt:`faceNotFound`,ready:!1};let o={pitch:a.pitch,yaw:a.yaw,roll:a.roll},s=a.boundingRect.height/Math.min(e.width,e.height),c=a.boundingRect.x+a.boundingRect.width/2,l=a.boundingRect.y+a.boundingRect.height/2,u=Math.hypot(c-e.width/2,l-e.height/2)<=Math.min(e.width,e.height)*.12;if(s<.5)return{framing:!0,alignment:o,code:null,face:a,prompt:`faceTooSmall`,ready:!1};if(!u)return{framing:!0,alignment:o,code:null,face:a,prompt:`centerFace`,ready:!1};let d=xy({pitch:a.pitch,pose:n,requireEyeLevelCamera:r,options:G});if(d)return{framing:!0,alignment:o,code:d,face:a,prompt:Sy(),ready:!1};let f=US({alignment:o,blendshapes:a.blendshapes,neutral:t,pose:n,options:G});if(f.code){let e=GS({pose:n,code:f.code});return{framing:!1,alignment:o,code:f.code,face:a,prompt:e.corrective??e.primary,ready:!1}}return{framing:!1,alignment:o,code:null,face:a,prompt:GS({pose:n,code:null}).primary,ready:!0}},FC=class{static Errors=H;static isSdkError=ay;options;display=JS();controller=null;view=null;preparing=null;preloading=null;prepared=!1;running=!1;disposed=!1;constructor(e){MS({options:e,capabilities:[],authorizeRequired:!0});let{prepare:t=kS.prepare,...n}=e,r=XS(n);this.options=Object.freeze({...r,...jS(r)}),this.display.debugEnabled.value=this.options.debug??!1,t&&this.prepare().catch(e=>console.error(e))}setDebug({enabled:e}){if(this.disposed)throw Q({code:H.SDK_DISPOSED});if(typeof e!=`boolean`)throw Q({code:H.INVALID_OPTIONS});this.options=Object.freeze({...this.options,debug:e}),this.display.debugEnabled.value=e,e||(this.display.debug.value=[])}async caniuse(){return await my()}async preload(){try{await this.preloadInternal()}catch(e){throw oy({error:e,fallback:H.MODEL_LOAD_FAILED})}}async preloadInternal(){if(this.disposed)throw Q({code:H.SDK_DISPOSED});if(this.preloading)return this.preloading;let e=(async()=>{if(await SS({language:this.options.language}),await ld({filenames:[`fd.ort`,`fe.ort`,`fl.ort`,`flv.ort`,`flw.ort`,`fa.ort`,`ort-wasm-simd-threaded.mjs`,`ort-wasm-simd-threaded.wasm`]}),this.disposed)throw Q({code:H.SDK_DISPOSED})})();this.preloading=e;try{await e}catch(t){throw this.preloading===e&&(this.preloading=null),oy({error:t,fallback:H.MODEL_LOAD_FAILED})}}async prepare(){try{await this.prepareInternal()}catch(e){throw oy({error:e,fallback:H.MODEL_LOAD_FAILED})}}async prepareInternal(){if(this.disposed)throw Q({code:H.SDK_DISPOSED});if(this.prepared)return;if(this.preparing)return this.preparing;let e=(async()=>{if(await this.preload(),this.disposed)throw Q({code:H.SDK_DISPOSED});if(await DC({faceDetector:`standard`}),await kC(),!this.view){let{createFaceGateView:e}=await Promise.resolve().then(()=>(TC(),xC));if(this.disposed)throw Q({code:H.SDK_DISPOSED});this.view=e({options:this.options,display:this.display,onCancel:()=>this.stop()})}if(this.disposed)throw Q({code:H.SDK_DISPOSED});this.prepared=!0})();this.preparing=e;try{await e}catch(e){throw oy({error:e,fallback:H.MODEL_LOAD_FAILED})}finally{this.preparing===e&&(this.preparing=null)}}async request({path:e,body:t,signal:n}){return await qS({apiUrl:this.options.apiUrl,path:`/facegate/${e}`,clientKey:this.options.clientKey,body:JSON.stringify(t),signal:n})}async capture({video:e,poses:t,signal:n,assertions:r}){let{translate:i}=TS({language:this.options.language}),a=[],o=null,s=null,c=null;for(let[l,u]of t.entries()){let t=0;for(Ye(()=>{this.display.phase.value=`capturing`,this.display.completed.value=l,this.display.pose.value=u,this.display.framing.value=!0,this.display.prompt.value=i(GS({pose:u,code:null}).primary)});t<3;){await fy({video:e,signal:n}),n.throwIfAborted();let l=await createImageBitmap(e);try{let e=await PC({frame:l,neutral:c,pose:u,requireEyeLevelCamera:this.options.requireEyeLevelCamera??!1});if(n.throwIfAborted(),t=e.ready?t+1:0,Ye(()=>{this.display.prompt.value=i(e.prompt),this.display.framing.value=e.framing}),this.view?.collectCaptureDebug({inspected:e,pose:u,stable:t}),u===`faceStraight`&&e.ready&&(c=e.alignment),t>=3){if(e.face){let t=await OC({detection:e.face,frame:l});if(n.throwIfAborted(),!t.live)throw Q({code:H.FACE_SPOOF_DETECTED})}r&&u===`faceStraight`&&e.face&&(o=await AC({detection:e.face,frame:l}),n.throwIfAborted(),s=YS({attributes:o,...r}));let t=await vy({frame:l});a.push(await yy({image:t}))}}finally{l.close()}}if(this.display.completed.value=l+1,s)break}return{faces:a,attributes:o,reason:s}}async check(e){if(this.disposed)throw Q({code:H.SDK_DISPOSED});if(this.running)throw Q({code:H.OPERATION_IN_PROGRESS});let t=ZS(e),n={...t.gender&&t.gender!==`any`?{gender:t.gender}:{},...t.age?{age:t.age}:{}},r=n.gender!==void 0||n.age!==void 0,i=new AbortController,a=i.signal,o=()=>i.abort(Q({code:H.OPERATION_CANCELLED})),s;this.running=!0,this.controller=i,t.signal?.addEventListener(`abort`,o,{once:!0}),t.signal?.aborted&&o();try{a.throwIfAborted(),await uy({operation:this.prepare(),signal:a}),a.throwIfAborted(),r&&(await uy({operation:jC(),signal:a}),a.throwIfAborted()),s=setTimeout(()=>i.abort(Q({code:H.OPERATION_TIMEOUT})),MC),Ye(()=>{this.display.debug.value=[],this.display.active.value=!0,this.display.phase.value=`capturing`,this.display.outcome.value=null,this.display.error.value=null,this.display.completed.value=0,this.display.total.value=1,this.display.pose.value=null,this.display.framing.value=!0,this.display.prompt.value=``}),this.view?.open();let e=this.view?.video;if(!e)throw Q({code:H.UI_ELEMENT_NOT_FOUND});await gy({facingMode:`user`,video:e,signal:a}),a.throwIfAborted();let o=await uy({operation:cy({task:()=>this.options.authorize({action:t.action,subjectId:t.subjectId,metadata:t.metadata})}),signal:a});a.throwIfAborted(),ly({intent:o,action:t.action});let c=ny.intent.safeParse(o);if(!c.success)throw Q({code:H.INVALID_SERVICE_RESPONSE,cause:o});let l=c.data.poses;this.display.total.value=l.length;let u=await this.capture({video:e,poses:l,signal:a,assertions:r?n:void 0});a.throwIfAborted();let d=u.faces;if(u.reason){this.display.outcome.value=`fail`,this.display.phase.value=`reject`,this.display.prompt.value=``;try{await uy({operation:this.request({path:`reject`,body:{token:o.token,assertions:n,face:d[0],reason:u.reason},signal:a}),signal:a})}catch{}return await uy({operation:ES({milliseconds:950}),signal:a}),{resultId:o.resultId,outcome:`fail`,reason:u.reason}}this.display.phase.value=`checking`,this.display.prompt.value=TS({language:this.options.language}).translate(`checkingFaceMatch`);let f=NC({payload:await this.request({path:`verify`,body:{token:o.token,poses:l,faces:d,...r?{assertions:n}:{}},signal:a})});if(a.throwIfAborted(),f.outcome===`error`)throw Q({code:f.reason??H.INTERNAL_ERROR,resultId:f.resultId,cause:f});return this.display.outcome.value=f.outcome,this.display.phase.value=f.outcome===`pass`?`pass`:`reject`,this.display.prompt.value=``,await uy({operation:ES({milliseconds:950}),signal:a}),a.throwIfAborted(),{resultId:f.resultId,outcome:f.outcome,reason:f.reason}}catch(e){let t=oy({error:e,signal:a}),n=t.code;if(this.display.error.value=t,this.display.active.value&&n!==H.OPERATION_CANCELLED&&(this.display.outcome.value=`error`,this.display.phase.value=`reject`,this.display.prompt.value=``,!a.aborted))try{await uy({operation:ES({milliseconds:950}),signal:a})}catch{throw oy({error:t,signal:a})}throw a.aborted?oy({error:t,signal:a}):t}finally{clearTimeout(s),t.signal?.removeEventListener(`abort`,o),this.view?.close(),this.display.active.value=!1,this.controller=null,this.running=!1}}stop(){this.controller&&this.controller.abort(Q({code:H.OPERATION_CANCELLED}))}dispose(){this.disposed||(this.disposed=!0,this.stop(),this.view?.close())}getState(){return{active:this.display.active.value,phase:this.display.phase.value,prompt:this.display.prompt.value,completed:this.display.completed.value,total:this.display.total.value,outcome:this.display.outcome.value,error:this.display.error.value}}},IC=globalThis;IC.VoltomFaceGate=FC})();