Plugin Directory

Changeset 3336062


Ignore:
Timestamp:
07/29/2025 02:58:11 PM (7 months ago)
Author:
scampsadsmurai
Message:

v1.0.5

Location:
adsmurai-one-tag/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • adsmurai-one-tag/trunk/build/index.asset.php

    r3288476 r3336062  
    1 <?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7872e0c8988a14963dcb');
     1<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-components', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'bfccba4e7bde3e21fe64');
  • adsmurai-one-tag/trunk/build/index.js

    r3288476 r3336062  
    1 (()=>{var e={338:(e,t,s)=>{"use strict";var a=s(795);t.H=a.createRoot,a.hydrateRoot},20:(e,t,s)=>{"use strict";var a=s(609),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,s){var a,r={},l=null,c=null;for(a in void 0!==s&&(l=""+s),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,a)&&!d.hasOwnProperty(a)&&(r[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===r[a]&&(r[a]=t[a]);return{$$typeof:n,type:e,key:l,ref:c,props:r,_owner:o.current}}t.Fragment=r,t.jsx=l,t.jsxs=l},848:(e,t,s)=>{"use strict";e.exports=s(20)},609:e=>{"use strict";e.exports=window.React},795:e=>{"use strict";e.exports=window.ReactDOM},942:(e,t)=>{var s;!function(){"use strict";var a={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=i(e,r(s)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var s in e)a.call(e,s)&&e[s]&&(t=i(t,s));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):void 0===(s=function(){return n}.apply(t,[]))||(e.exports=s)}()}},t={};function s(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");if(a.length)for(var n=a.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=a[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),(()=>{"use strict";var e=s(338);const t=window.wp.apiFetch;var a=s.n(t);const n=window.wp.element,r="https://amp.adsmurai.com",i="https://st.adsmurai.com";var o=s(848);const d=(0,n.createContext)(null),l=({children:e})=>{const t=u();return(0,o.jsx)(d.Provider,{value:t,children:e})},c={token:"",pixels:[],forms:[]},u=()=>{const[e,t]=(0,n.useState)(c),[s,r]=(0,n.useState)(!1),[o,d]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),m=(0,n.useMemo)((()=>{var t;return!s&&!o&&!e?.token&&0===(null!==(t=e?.pixels)&&void 0!==t?t:[]).length}),[e,s,o]),h=(0,n.useMemo)((()=>{var t;return!e?.token||0===(null!==(t=e?.pixels)&&void 0!==t?t:[]).length}),[e]),p=(0,n.useMemo)((()=>{var t;return!!e?.token&&(null!==(t=e?.pixels)&&void 0!==t?t:[]).length>0}),[e]),f=(0,n.useMemo)((()=>`${i}/${e?.organizationId}/one-tag`),[e]),g=(0,n.useMemo)((()=>`https://feeds.adsmurai.com/v2/organization/${e?.organizationId}/feeds-manager/data-imports/list`),[e]),v=(0,n.useCallback)((()=>{r(!0),a()({path:"/wp/v2/settings"}).then((e=>{var s;r(!1),t(null!==(s=e.one_tag_settings)&&void 0!==s?s:c),u(!0)}))}),[t,r,u]),y=(0,n.useCallback)((async e=>{d(!0),await a()({path:"/wp/v2/settings",method:"POST",data:{one_tag_settings:e}}),await v(),d(!1)}),[d,d]),_=(0,n.useCallback)((async t=>{await y({...e,apiToken:null!=t?t:""})}),[e,y]),x=(0,n.useCallback)((async t=>{e.pixels.some((e=>e.id===t.id))||await y({...e,pixels:[...e.pixels,t]})}),[e,y]),b=(0,n.useCallback)((async(t,s)=>{e.pixels=e.pixels.map((e=>e.id===t?s:e)),await y(e)}),[e,y]),k=(0,n.useCallback)((async t=>{e.pixels=e.pixels.filter((e=>e.id!==t)),await y(e)}),[e,y]),w=(0,n.useCallback)((async(t,s,a)=>{var n;const r=(null!==(n=e.forms)&&void 0!==n?n:[]).find((e=>e.formId===t&&e.plugin===s));r?r.matches=a:(e.forms||(e.forms=[]),e.forms.push({formId:t,plugin:s,matches:a})),await y(e)}),[e,y]),j=(0,n.useCallback)((async t=>{await y({...e,gdprCookie:t})}),[e,y]),C=(0,n.useCallback)((async()=>{await y(null)}),[y]);return(0,n.useEffect)((()=>{v()}),[]),{isLoaded:l,showConnectScreen:m,showSingleTab:h,isBaseConfigDone:p,postSettings:y,saveApiToken:_,addPixel:x,modifyPixel:b,deletePixel:k,oneTagSettings:e,isRefreshing:s,isUpdating:o,modifyFieldsMatch:w,saveGDPRCookie:j,resetSettings:C,oneTagDashboardUrl:f,ampFeedsUrl:g}},m=(0,n.createContext)(null),h=({children:e})=>{const[t,s]=(0,n.useState)({}),[a,r]=(0,n.useState)(!1),[i,d]=(0,n.useState)(!1),l=(0,n.useCallback)((async()=>{try{r(!0);const e=await fetch("/index.php?rest_route=/one-tag/settings",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),t=await e.json();s(null!=t?t:{})}catch{}finally{r(!1)}}),[]);(0,n.useEffect)((()=>{l(),d("localhost"!==window.location.hostname)}),[]);const c={settings:t,isLoading:a,isProd:i};return(0,o.jsx)(m.Provider,{value:c,children:e})},p=(0,n.createContext)(null),f=({children:e})=>{const{isProd:t}=(0,n.useContext)(m),{oneTagSettings:s}=(0,n.useContext)(d),[a,r]=(0,n.useState)(null),[l,c]=(0,n.useState)(!1),[u,h]=(0,n.useState)(!1),f=(0,n.useCallback)((async(e=!0)=>{if(!s?.token)return;let a=null;try{c(!0);const n=await fetch((t?i:"https://localhost:3001")+"/api/customers/me?subscriptions="+e,{method:"GET",headers:{Authorization:s?.token}});a=await n.json(),r(a)}catch{r(null)}finally{c(!1)}return a}),[t,s]),g=(0,n.useCallback)((async(e,n=!0)=>{let r=a?.id;if(!r){const e=await f();if(r=e?.id,!r)return}h(!0);const o=await fetch((t?i:"https://localhost:3001")+`/api/customers/${r}/pixels/${e.pixelId}`,{headers:{"Content-Type":"application/json",Authorization:s.token},method:n?"POST":"PUT",body:JSON.stringify(e)});if(h(!1),200!==o.status){const e=await o.json();return e?.error}await f()}),[a,t,f,c,s,h]);(0,n.useEffect)((()=>{a||f()}),[s,a]);const v={otCustomer:a,isLoading:l,refresh:f,updateOtCustomerPixel:g,isUpdating:u};return(0,o.jsx)(p.Provider,{value:v,children:e})},g=window.wp.i18n,v=window.wp.components,y={fb:s.p+"images/fb-logo.6110350a.png",ga4:s.p+"images/ga4-logo.13aa694f.png",google:s.p+"images/google-logo.c963c457.png","google-merchant":s.p+"images/google_merchant-logo.d8d1b769.png",linkedin:s.p+"images/linkedin-logo.4adcaa71.png",microsoftads:s.p+"images/microsoftads-logo.6ac19bb0.png",pinterest:s.p+"images/pinterest-logo.c1904eec.png",postback:s.p+"images/postback-logo.ca45b8e6.png",quora:s.p+"images/quora-logo.a17e74d5.png",snapchat:s.p+"images/snapchat-logo.367899bd.png",tiktok:s.p+"images/tiktok-logo.c8a8ce07.png"};var _=s(609),x=e=>"checkbox"===e.type,b=e=>e instanceof Date,k=e=>null==e;const w=e=>"object"==typeof e;var j=e=>!k(e)&&!Array.isArray(e)&&w(e)&&!b(e),C=e=>j(e)&&e.target?x(e.target)?e.target.checked:e.target.value:e,S=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),N="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function T(e){let t;const s=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else{if(N&&(e instanceof Blob||a)||!s&&!j(e))return e;if(t=s?[]:{},s||(e=>{const t=e.constructor&&e.constructor.prototype;return j(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const s in e)e.hasOwnProperty(s)&&(t[s]=T(e[s]));else t=e}return t}var A=e=>Array.isArray(e)?e.filter(Boolean):[],O=e=>void 0===e,P=(e,t,s)=>{if(!t||!j(e))return s;const a=A(t.split(/[,[\].]+?/)).reduce(((e,t)=>k(e)?e:e[t]),e);return O(a)||a===e?O(e[t])?s:e[t]:a},F=e=>"boolean"==typeof e,Z=e=>/^\w*$/.test(e),E=e=>A(e.replace(/["|']|\]/g,"").split(/\.|\[/)),V=(e,t,s)=>{let a=-1;const n=Z(t)?[t]:E(t),r=n.length,i=r-1;for(;++a<r;){const t=n[a];let r=s;if(a!==i){const s=e[t];r=j(s)||Array.isArray(s)?s:isNaN(+n[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=r,e=e[t]}return e};const I="blur",M="onChange",D="onSubmit",R="all",$="pattern",L="required",z=_.createContext(null),B=()=>_.useContext(z);var U=(e,t,s,a=!0)=>{const n={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(n,r,{get:()=>{const n=r;return t._proxyFormState[n]!==R&&(t._proxyFormState[n]=!a||R),s&&(s[n]=!0),e[n]}});return n},W=e=>j(e)&&!Object.keys(e).length,G=(e,t,s,a)=>{s(e);const{name:n,...r}=e;return W(r)||Object.keys(r).length>=Object.keys(t).length||Object.keys(r).find((e=>t[e]===(!a||R)))},q=e=>Array.isArray(e)?e:[e],H=(e,t,s)=>!e||!t||e===t||q(e).some((e=>e&&(s?e===t:e.startsWith(t)||t.startsWith(e))));function K(e){const t=_.useRef(e);t.current=e,_.useEffect((()=>{const s=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{s&&s.unsubscribe()}}),[e.disabled])}var Y=e=>"string"==typeof e,J=(e,t,s,a,n)=>Y(e)?(a&&t.watch.add(e),P(s,e,n)):Array.isArray(e)?e.map((e=>(a&&t.watch.add(e),P(s,e)))):(a&&(t.watchAll=!0),s);const X=e=>e.render(function(e){const t=B(),{name:s,disabled:a,control:n=t.control,shouldUnregister:r}=e,i=S(n._names.array,s),o=function(e){const t=B(),{control:s=t.control,name:a,defaultValue:n,disabled:r,exact:i}=e||{},o=_.useRef(a);o.current=a,K({disabled:r,subject:s._subjects.values,next:e=>{H(o.current,e.name,i)&&l(T(J(o.current,s._names,e.values||s._formValues,!1,n)))}});const[d,l]=_.useState(s._getWatch(a,n));return _.useEffect((()=>s._removeUnmounted())),d}({control:n,name:s,defaultValue:P(n._formValues,s,P(n._defaultValues,s,e.defaultValue)),exact:!0}),d=function(e){const t=B(),{control:s=t.control,disabled:a,name:n,exact:r}=e||{},[i,o]=_.useState(s._formState),d=_.useRef(!0),l=_.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),c=_.useRef(n);return c.current=n,K({disabled:a,next:e=>d.current&&H(c.current,e.name,r)&&G(e,l.current,s._updateFormState)&&o({...s._formState,...e}),subject:s._subjects.state}),_.useEffect((()=>(d.current=!0,l.current.isValid&&s._updateValid(!0),()=>{d.current=!1})),[s]),_.useMemo((()=>U(i,s,l.current,!1)),[i,s])}({control:n,name:s,exact:!0}),l=_.useRef(n.register(s,{...e.rules,value:o,...F(e.disabled)?{disabled:e.disabled}:{}})),c=_.useMemo((()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!P(d.errors,s)},isDirty:{enumerable:!0,get:()=>!!P(d.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!P(d.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!P(d.validatingFields,s)},error:{enumerable:!0,get:()=>P(d.errors,s)}})),[d,s]),u=_.useMemo((()=>({name:s,value:o,...F(a)||d.disabled?{disabled:d.disabled||a}:{},onChange:e=>l.current.onChange({target:{value:C(e),name:s},type:"change"}),onBlur:()=>l.current.onBlur({target:{value:P(n._formValues,s),name:s},type:I}),ref:e=>{const t=P(n._fields,s);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}})),[s,n._formValues,a,d.disabled,o,n._fields]);return _.useEffect((()=>{const e=n._options.shouldUnregister||r,t=(e,t)=>{const s=P(n._fields,e);s&&s._f&&(s._f.mount=t)};if(t(s,!0),e){const e=T(P(n._options.defaultValues,s));V(n._defaultValues,s,e),O(P(n._formValues,s))&&V(n._formValues,s,e)}return!i&&n.register(s),()=>{(i?e&&!n._state.action:e)?n.unregister(s):t(s,!1)}}),[s,n,i,r]),_.useEffect((()=>{n._updateDisabledField({disabled:a,fields:n._fields,name:s})}),[a,s,n]),_.useMemo((()=>({field:u,formState:d,fieldState:c})),[u,d,c])}(e));var Q=(e,t,s,a,n)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:n||!0}}:{},ee=e=>({isOnSubmit:!e||e===D,isOnBlur:"onBlur"===e,isOnChange:e===M,isOnAll:e===R,isOnTouch:"onTouched"===e}),te=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some((t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))));const se=(e,t,s,a)=>{for(const n of s||Object.keys(e)){const s=P(e,n);if(s){const{_f:e,...r}=s;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],n)&&!a)return!0;if(e.ref&&t(e.ref,e.name)&&!a)return!0;if(se(r,t))break}else if(j(r)&&se(r,t))break}}};var ae=(e,t,s)=>{const a=q(P(e,s));return V(a,"root",t[s]),V(e,s,a),e},ne=e=>"file"===e.type,re=e=>"function"==typeof e,ie=e=>{if(!N)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},oe=e=>Y(e),de=e=>"radio"===e.type,le=e=>e instanceof RegExp;const ce={value:!1,isValid:!1},ue={value:!0,isValid:!0};var me=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter((e=>e&&e.checked&&!e.disabled)).map((e=>e.value));return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!O(e[0].attributes.value)?O(e[0].value)||""===e[0].value?ue:{value:e[0].value,isValid:!0}:ue:ce}return ce};const he={isValid:!1,value:null};var pe=e=>Array.isArray(e)?e.reduce(((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e),he):he;function fe(e,t,s="validate"){if(oe(e)||Array.isArray(e)&&e.every(oe)||F(e)&&!e)return{type:s,message:oe(e)?e:"",ref:t}}var ge=e=>j(e)&&!le(e)?e:{value:e,message:""},ve=async(e,t,s,a,n,r)=>{const{ref:i,refs:o,required:d,maxLength:l,minLength:c,min:u,max:m,pattern:h,validate:p,name:f,valueAsNumber:g,mount:v}=e._f,y=P(s,f);if(!v||t.has(f))return{};const _=o?o[0]:i,b=e=>{n&&_.reportValidity&&(_.setCustomValidity(F(e)?"":e||""),_.reportValidity())},w={},C=de(i),S=x(i),N=C||S,T=(g||ne(i))&&O(i.value)&&O(y)||ie(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,A=Q.bind(null,f,a,w),Z=(e,t,s,a="maxLength",n="minLength")=>{const r=e?t:s;w[f]={type:e?a:n,message:r,ref:i,...A(e?a:n,r)}};if(r?!Array.isArray(y)||!y.length:d&&(!N&&(T||k(y))||F(y)&&!y||S&&!me(o).isValid||C&&!pe(o).isValid)){const{value:e,message:t}=oe(d)?{value:!!d,message:d}:ge(d);if(e&&(w[f]={type:L,message:t,ref:_,...A(L,t)},!a))return b(t),w}if(!(T||k(u)&&k(m))){let e,t;const s=ge(m),n=ge(u);if(k(y)||isNaN(y)){const a=i.valueAsDate||new Date(y),r=e=>new Date((new Date).toDateString()+" "+e),o="time"==i.type,d="week"==i.type;Y(s.value)&&y&&(e=o?r(y)>r(s.value):d?y>s.value:a>new Date(s.value)),Y(n.value)&&y&&(t=o?r(y)<r(n.value):d?y<n.value:a<new Date(n.value))}else{const a=i.valueAsNumber||(y?+y:y);k(s.value)||(e=a>s.value),k(n.value)||(t=a<n.value)}if((e||t)&&(Z(!!e,s.message,n.message,"max","min"),!a))return b(w[f].message),w}if((l||c)&&!T&&(Y(y)||r&&Array.isArray(y))){const e=ge(l),t=ge(c),s=!k(e.value)&&y.length>+e.value,n=!k(t.value)&&y.length<+t.value;if((s||n)&&(Z(s,e.message,t.message),!a))return b(w[f].message),w}if(h&&!T&&Y(y)){const{value:e,message:t}=ge(h);if(le(e)&&!y.match(e)&&(w[f]={type:$,message:t,ref:i,...A($,t)},!a))return b(t),w}if(p)if(re(p)){const e=fe(await p(y,s),_);if(e&&(w[f]={...e,...A("validate",e.message)},!a))return b(e.message),w}else if(j(p)){let e={};for(const t in p){if(!W(e)&&!a)break;const n=fe(await p[t](y,s),_,t);n&&(e={...n,...A(t,n.message)},b(n.message),a&&(w[f]=e))}if(!W(e)&&(w[f]={ref:_,...e},!a))return w}return b(!0),w};function ye(e,t){const s=Array.isArray(t)?t:Z(t)?[t]:E(t),a=1===s.length?e:function(e,t){const s=t.slice(0,-1).length;let a=0;for(;a<s;)e=O(e)?a++:e[t[a++]];return e}(e,s),n=s.length-1,r=s[n];return a&&delete a[r],0!==n&&(j(a)&&W(a)||Array.isArray(a)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!O(e[t]))return!1;return!0}(a))&&ye(e,s.slice(0,-1)),e}var _e=()=>{let e=[];return{get observers(){return e},next:t=>{for(const s of e)s.next&&s.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter((e=>e!==t))}}),unsubscribe:()=>{e=[]}}},xe=e=>k(e)||!w(e);function be(e,t){if(xe(e)||xe(t))return e===t;if(b(e)&&b(t))return e.getTime()===t.getTime();const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;for(const n of s){const s=e[n];if(!a.includes(n))return!1;if("ref"!==n){const e=t[n];if(b(s)&&b(e)||j(s)&&j(e)||Array.isArray(s)&&Array.isArray(e)?!be(s,e):s!==e)return!1}}return!0}var ke=e=>"select-multiple"===e.type,we=e=>ie(e)&&e.isConnected,je=e=>{for(const t in e)if(re(e[t]))return!0;return!1};function Ce(e,t={}){const s=Array.isArray(e);if(j(e)||s)for(const s in e)Array.isArray(e[s])||j(e[s])&&!je(e[s])?(t[s]=Array.isArray(e[s])?[]:{},Ce(e[s],t[s])):k(e[s])||(t[s]=!0);return t}function Se(e,t,s){const a=Array.isArray(e);if(j(e)||a)for(const a in e)Array.isArray(e[a])||j(e[a])&&!je(e[a])?O(t)||xe(s[a])?s[a]=Array.isArray(e[a])?Ce(e[a],[]):{...Ce(e[a])}:Se(e[a],k(t)?{}:t[a],s[a]):s[a]=!be(e[a],t[a]);return s}var Ne=(e,t)=>Se(e,t,Ce(t)),Te=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:a})=>O(e)?e:t?""===e?NaN:e?+e:e:s&&Y(e)?new Date(e):a?a(e):e;function Ae(e){const t=e.ref;return ne(t)?t.files:de(t)?pe(e.refs).value:ke(t)?[...t.selectedOptions].map((({value:e})=>e)):x(t)?me(e.refs).value:Te(O(t.value)?e.ref.value:t.value,e)}var Oe=e=>O(e)?e:le(e)?e.source:j(e)?le(e.value)?e.value.source:e.value:e;const Pe="AsyncFunction";function Fe(e,t,s){const a=P(e,s);if(a||Z(s))return{error:a,name:s};const n=s.split(".");for(;n.length;){const a=n.join("."),r=P(t,a),i=P(e,a);if(r&&!Array.isArray(r)&&s!==a)return{name:s};if(i&&i.type)return{name:a,error:i};n.pop()}return{name:s}}const Ze={mode:D,reValidateMode:M,shouldFocusError:!0};function Ee(e={}){let t,s={...Ze,...e},a={submitCount:0,isDirty:!1,isLoading:re(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},n={},r=(j(s.defaultValues)||j(s.values))&&T(s.defaultValues||s.values)||{},i=s.shouldUnregister?{}:T(r),o={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={values:_e(),array:_e(),state:_e()},m=ee(s.mode),h=ee(s.reValidateMode),p=s.criteriaMode===R,f=async e=>{if(!s.disabled&&(c.isValid||e)){const e=s.resolver?W((await _()).errors):await w(n,!0);e!==a.isValid&&u.state.next({isValid:e})}},g=(e,t)=>{s.disabled||!c.isValidating&&!c.validatingFields||((e||Array.from(d.mount)).forEach((e=>{e&&(t?V(a.validatingFields,e,t):ye(a.validatingFields,e))})),u.state.next({validatingFields:a.validatingFields,isValidating:!W(a.validatingFields)}))},v=(e,t,s,a)=>{const d=P(n,e);if(d){const n=P(i,e,O(s)?P(r,e):s);O(n)||a&&a.defaultChecked||t?V(i,e,t?n:Ae(d._f)):M(e,n),o.mount&&f()}},y=(e,t,i,o,d)=>{let l=!1,m=!1;const h={name:e};if(!s.disabled){const s=!!(P(n,e)&&P(n,e)._f&&P(n,e)._f.disabled);if(!i||o){c.isDirty&&(m=a.isDirty,a.isDirty=h.isDirty=Z(),l=m!==h.isDirty);const n=s||be(P(r,e),t);m=!(s||!P(a.dirtyFields,e)),n||s?ye(a.dirtyFields,e):V(a.dirtyFields,e,!0),h.dirtyFields=a.dirtyFields,l=l||c.dirtyFields&&m!==!n}if(i){const t=P(a.touchedFields,e);t||(V(a.touchedFields,e,i),h.touchedFields=a.touchedFields,l=l||c.touchedFields&&t!==i)}l&&d&&u.state.next(h)}return l?h:{}},_=async e=>{g(e,!0);const t=await s.resolver(i,s.context,((e,t,s,a)=>{const n={};for(const s of e){const e=P(t,s);e&&V(n,s,e._f)}return{criteriaMode:s,names:[...e],fields:n,shouldUseNativeValidation:a}})(e||d.mount,n,s.criteriaMode,s.shouldUseNativeValidation));return g(e),t},w=async(e,t,n={valid:!0})=>{for(const o in e){const l=e[o];if(l){const{_f:e,...u}=l;if(e){const u=d.array.has(e.name),m=l._f&&!!(r=l._f)&&!!r.validate&&!!(re(r.validate)&&r.validate.constructor.name===Pe||j(r.validate)&&Object.values(r.validate).find((e=>e.constructor.name===Pe)));m&&c.validatingFields&&g([o],!0);const h=await ve(l,d.disabled,i,p,s.shouldUseNativeValidation&&!t,u);if(m&&c.validatingFields&&g([o]),h[e.name]&&(n.valid=!1,t))break;!t&&(P(h,e.name)?u?ae(a.errors,h,e.name):V(a.errors,e.name,h[e.name]):ye(a.errors,e.name))}!W(u)&&await w(u,t,n)}}var r;return n.valid},Z=(e,t)=>!s.disabled&&(e&&t&&V(i,e,t),!be(U(),r)),E=(e,t,s)=>J(e,d,{...o.mount?i:O(t)?r:Y(e)?{[e]:t}:t},s,t),M=(e,t,s={})=>{const a=P(n,e);let r=t;if(a){const s=a._f;s&&(!s.disabled&&V(i,e,Te(t,s)),r=ie(s.ref)&&k(t)?"":t,ke(s.ref)?[...s.ref.options].forEach((e=>e.selected=r.includes(e.value))):s.refs?x(s.ref)?s.refs.length>1?s.refs.forEach((e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(r)?!!r.find((t=>t===e.value)):r===e.value))):s.refs[0]&&(s.refs[0].checked=!!r):s.refs.forEach((e=>e.checked=e.value===r)):ne(s.ref)?s.ref.value="":(s.ref.value=r,s.ref.type||u.values.next({name:e,values:{...i}})))}(s.shouldDirty||s.shouldTouch)&&y(e,r,s.shouldTouch,s.shouldDirty,!0),s.shouldValidate&&B(e)},D=(e,t,s)=>{for(const a in t){const r=t[a],i=`${e}.${a}`,o=P(n,i);(d.array.has(e)||j(r)||o&&!o._f)&&!b(r)?D(i,r,s):M(i,r,s)}},$=(e,t,s={})=>{const l=P(n,e),m=d.array.has(e),h=T(t);V(i,e,h),m?(u.array.next({name:e,values:{...i}}),(c.isDirty||c.dirtyFields)&&s.shouldDirty&&u.state.next({name:e,dirtyFields:Ne(r,i),isDirty:Z(e,h)})):!l||l._f||k(h)?M(e,h,s):D(e,h,s),te(e,d)&&u.state.next({...a}),u.values.next({name:o.mount?e:void 0,values:{...i}})},L=async e=>{o.mount=!0;const r=e.target;let v=r.name,x=!0;const k=P(n,v),j=e=>{x=Number.isNaN(e)||b(e)&&isNaN(e.getTime())||be(e,P(i,v,e))};if(k){let o,b;const N=r.type?Ae(k._f):C(e),T=e.type===I||"focusout"===e.type,A=!((S=k._f).mount&&(S.required||S.min||S.max||S.maxLength||S.minLength||S.pattern||S.validate)||s.resolver||P(a.errors,v)||k._f.deps)||((e,t,s,a,n)=>!n.isOnAll&&(!s&&n.isOnTouch?!(t||e):(s?a.isOnBlur:n.isOnBlur)?!e:!(s?a.isOnChange:n.isOnChange)||e))(T,P(a.touchedFields,v),a.isSubmitted,h,m),O=te(v,d,T);V(i,v,N),T?(k._f.onBlur&&k._f.onBlur(e),t&&t(0)):k._f.onChange&&k._f.onChange(e);const Z=y(v,N,T,!1),E=!W(Z)||O;if(!T&&u.values.next({name:v,type:e.type,values:{...i}}),A)return c.isValid&&("onBlur"===s.mode&&T?f():T||f()),E&&u.state.next({name:v,...O?{}:Z});if(!T&&O&&u.state.next({...a}),s.resolver){const{errors:e}=await _([v]);if(j(N),x){const t=Fe(a.errors,n,v),s=Fe(e,n,t.name||v);o=s.error,v=s.name,b=W(e)}}else g([v],!0),o=(await ve(k,d.disabled,i,p,s.shouldUseNativeValidation))[v],g([v]),j(N),x&&(o?b=!1:c.isValid&&(b=await w(n,!0)));x&&(k._f.deps&&B(k._f.deps),((e,n,r,i)=>{const o=P(a.errors,e),d=c.isValid&&F(n)&&a.isValid!==n;var m;if(s.delayError&&r?(m=()=>((e,t)=>{V(a.errors,e,t),u.state.next({errors:a.errors})})(e,r),t=e=>{clearTimeout(l),l=setTimeout(m,e)},t(s.delayError)):(clearTimeout(l),t=null,r?V(a.errors,e,r):ye(a.errors,e)),(r?!be(o,r):o)||!W(i)||d){const t={...i,...d&&F(n)?{isValid:n}:{},errors:a.errors,name:e};a={...a,...t},u.state.next(t)}})(v,b,o,Z))}var S},z=(e,t)=>{if(P(a.errors,t)&&e.focus)return e.focus(),1},B=async(e,t={})=>{let r,i;const o=q(e);if(s.resolver){const t=await(async e=>{const{errors:t}=await _(e);if(e)for(const s of e){const e=P(t,s);e?V(a.errors,s,e):ye(a.errors,s)}else a.errors=t;return t})(O(e)?e:o);r=W(t),i=e?!o.some((e=>P(t,e))):r}else e?(i=(await Promise.all(o.map((async e=>{const t=P(n,e);return await w(t&&t._f?{[e]:t}:t)})))).every(Boolean),(i||a.isValid)&&f()):i=r=await w(n);return u.state.next({...!Y(e)||c.isValid&&r!==a.isValid?{}:{name:e},...s.resolver||!e?{isValid:r}:{},errors:a.errors}),t.shouldFocus&&!i&&se(n,z,e?o:d.mount),i},U=e=>{const t={...o.mount?i:r};return O(e)?t:Y(e)?P(t,e):e.map((e=>P(t,e)))},G=(e,t)=>({invalid:!!P((t||a).errors,e),isDirty:!!P((t||a).dirtyFields,e),error:P((t||a).errors,e),isValidating:!!P(a.validatingFields,e),isTouched:!!P((t||a).touchedFields,e)}),H=(e,t,s)=>{const r=(P(n,e,{_f:{}})._f||{}).ref,i=P(a.errors,e)||{},{ref:o,message:d,type:l,...c}=i;V(a.errors,e,{...c,...t,ref:r}),u.state.next({name:e,errors:a.errors,isValid:!1}),s&&s.shouldFocus&&r&&r.focus&&r.focus()},K=(e,t={})=>{for(const o of e?q(e):d.mount)d.mount.delete(o),d.array.delete(o),t.keepValue||(ye(n,o),ye(i,o)),!t.keepError&&ye(a.errors,o),!t.keepDirty&&ye(a.dirtyFields,o),!t.keepTouched&&ye(a.touchedFields,o),!t.keepIsValidating&&ye(a.validatingFields,o),!s.shouldUnregister&&!t.keepDefaultValue&&ye(r,o);u.values.next({values:{...i}}),u.state.next({...a,...t.keepDirty?{isDirty:Z()}:{}}),!t.keepIsValid&&f()},X=({disabled:e,name:t,field:s,fields:a})=>{(F(e)&&o.mount||e||d.disabled.has(t))&&(e?d.disabled.add(t):d.disabled.delete(t),y(t,Ae(s?s._f:P(a,t)._f),!1,!1,!0))},Q=(e,t={})=>{let a=P(n,e);const i=F(t.disabled)||F(s.disabled);return V(n,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...t}}),d.mount.add(e),a?X({field:a,disabled:F(t.disabled)?t.disabled:s.disabled,name:e}):v(e,!0,t.value),{...i?{disabled:t.disabled||s.disabled}:{},...s.progressive?{required:!!t.required,min:Oe(t.min),max:Oe(t.max),minLength:Oe(t.minLength),maxLength:Oe(t.maxLength),pattern:Oe(t.pattern)}:{},name:e,onChange:L,onBlur:L,ref:i=>{if(i){Q(e,t),a=P(n,e);const s=O(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,o=(e=>de(e)||x(e))(s),d=a._f.refs||[];if(o?d.find((e=>e===s)):s===a._f.ref)return;V(n,e,{_f:{...a._f,...o?{refs:[...d.filter(we),s,...Array.isArray(P(r,e))?[{}]:[]],ref:{type:s.type,name:e}}:{ref:s}}}),v(e,!1,void 0,s)}else a=P(n,e,{}),a._f&&(a._f.mount=!1),(s.shouldUnregister||t.shouldUnregister)&&(!S(d.array,e)||!o.action)&&d.unMount.add(e)}}},oe=()=>s.shouldFocusError&&se(n,z,d.mount),le=(e,t)=>async r=>{let o;r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let l=T(i);if(d.disabled.size)for(const e of d.disabled)V(l,e,void 0);if(u.state.next({isSubmitting:!0}),s.resolver){const{errors:e,values:t}=await _();a.errors=e,l=t}else await w(n);if(ye(a.errors,"root"),W(a.errors)){u.state.next({errors:{}});try{await e(l,r)}catch(e){o=e}}else t&&await t({...a.errors},r),oe(),setTimeout(oe);if(u.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:W(a.errors)&&!o,submitCount:a.submitCount+1,errors:a.errors}),o)throw o},ce=(e,t={})=>{const l=e?T(e):r,m=T(l),h=W(e),p=h?r:m;if(t.keepDefaultValues||(r=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...d.mount,...Object.keys(Ne(r,i))]);for(const t of Array.from(e))P(a.dirtyFields,t)?V(p,t,P(i,t)):$(t,P(p,t))}else{if(N&&O(e))for(const e of d.mount){const t=P(n,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ie(e)){const t=e.closest("form");if(t){t.reset();break}}}}n={}}i=s.shouldUnregister?t.keepDefaultValues?T(r):{}:T(p),u.array.next({values:{...p}}),u.values.next({values:{...p}})}d={mount:t.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,o.watch=!!s.shouldUnregister,u.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:!h&&(t.keepDirty?a.isDirty:!(!t.keepDefaultValues||be(e,r))),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:h?{}:t.keepDirtyValues?t.keepDefaultValues&&i?Ne(r,i):a.dirtyFields:t.keepDefaultValues&&e?Ne(r,e):t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&a.isSubmitSuccessful,isSubmitting:!1})},ue=(e,t)=>ce(re(e)?e(i):e,t);return{control:{register:Q,unregister:K,getFieldState:G,handleSubmit:le,setError:H,_executeSchema:_,_getWatch:E,_getDirty:Z,_updateValid:f,_removeUnmounted:()=>{for(const e of d.unMount){const t=P(n,e);t&&(t._f.refs?t._f.refs.every((e=>!we(e))):!we(t._f.ref))&&K(e)}d.unMount=new Set},_updateFieldArray:(e,t=[],d,l,m=!0,h=!0)=>{if(l&&d&&!s.disabled){if(o.action=!0,h&&Array.isArray(P(n,e))){const t=d(P(n,e),l.argA,l.argB);m&&V(n,e,t)}if(h&&Array.isArray(P(a.errors,e))){const t=d(P(a.errors,e),l.argA,l.argB);m&&V(a.errors,e,t),((e,t)=>{!A(P(e,t)).length&&ye(e,t)})(a.errors,e)}if(c.touchedFields&&h&&Array.isArray(P(a.touchedFields,e))){const t=d(P(a.touchedFields,e),l.argA,l.argB);m&&V(a.touchedFields,e,t)}c.dirtyFields&&(a.dirtyFields=Ne(r,i)),u.state.next({name:e,isDirty:Z(e,t),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else V(i,e,t)},_updateDisabledField:X,_getFieldArray:e=>A(P(o.mount?i:r,e,s.shouldUnregister?P(r,e,[]):[])),_reset:ce,_resetDefaultValues:()=>re(s.defaultValues)&&s.defaultValues().then((e=>{ue(e,s.resetOptions),u.state.next({isLoading:!1})})),_updateFormState:e=>{a={...a,...e}},_disableForm:e=>{F(e)&&(u.state.next({disabled:e}),se(n,((t,s)=>{const a=P(n,s);a&&(t.disabled=a._f.disabled||e,Array.isArray(a._f.refs)&&a._f.refs.forEach((t=>{t.disabled=a._f.disabled||e})))}),0,!1))},_subjects:u,_proxyFormState:c,_setErrors:e=>{a.errors=e,u.state.next({errors:a.errors,isValid:!1})},get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(e){o=e},get _defaultValues(){return r},get _names(){return d},set _names(e){d=e},get _formState(){return a},set _formState(e){a=e},get _options(){return s},set _options(e){s={...s,...e}}},trigger:B,register:Q,handleSubmit:le,watch:(e,t)=>re(e)?u.values.subscribe({next:s=>e(E(void 0,t),s)}):E(e,t,!0),setValue:$,getValues:U,reset:ue,resetField:(e,t={})=>{P(n,e)&&(O(t.defaultValue)?$(e,T(P(r,e))):($(e,t.defaultValue),V(r,e,T(t.defaultValue))),t.keepTouched||ye(a.touchedFields,e),t.keepDirty||(ye(a.dirtyFields,e),a.isDirty=t.defaultValue?Z(e,T(P(r,e))):Z()),t.keepError||(ye(a.errors,e),c.isValid&&f()),u.state.next({...a}))},clearErrors:e=>{e&&q(e).forEach((e=>ye(a.errors,e))),u.state.next({errors:e?a.errors:{}})},unregister:K,setError:H,setFocus:(e,t={})=>{const s=P(n,e),a=s&&s._f;if(a){const e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&re(e.select)&&e.select())}},getFieldState:G}}function Ve(e={}){const t=_.useRef(void 0),s=_.useRef(void 0),[a,n]=_.useState({isDirty:!1,isValidating:!1,isLoading:re(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:re(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Ee(e),formState:a});const r=t.current.control;return r._options=e,K({subject:r._subjects.state,next:e=>{G(e,r._proxyFormState,r._updateFormState,!0)&&n({...r._formState})}}),_.useEffect((()=>r._disableForm(e.disabled)),[r,e.disabled]),_.useEffect((()=>{if(r._proxyFormState.isDirty){const e=r._getDirty();e!==a.isDirty&&r._subjects.state.next({isDirty:e})}}),[r,a.isDirty]),_.useEffect((()=>{e.values&&!be(e.values,s.current)?(r._reset(e.values,r._options.resetOptions),s.current=e.values,n((e=>({...e})))):r._resetDefaultValues()}),[e.values,r]),_.useEffect((()=>{e.errors&&r._setErrors(e.errors)}),[e.errors,r]),_.useEffect((()=>{r._state.mount||(r._updateValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()})),_.useEffect((()=>{e.shouldUnregister&&r._subjects.values.next({values:r._getWatch()})}),[e.shouldUnregister,r]),t.current.formState=U(a,r),t.current}const Ie=window.wp.primitives,Me=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z"})});var De,Re;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(De||(De={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Re||(Re={}));const $e=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Le=e=>{switch(typeof e){case"undefined":return $e.undefined;case"string":return $e.string;case"number":return isNaN(e)?$e.nan:$e.number;case"boolean":return $e.boolean;case"function":return $e.function;case"bigint":return $e.bigint;case"symbol":return $e.symbol;case"object":return Array.isArray(e)?$e.array:null===e?$e.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?$e.promise:"undefined"!=typeof Map&&e instanceof Map?$e.map:"undefined"!=typeof Set&&e instanceof Set?$e.set:"undefined"!=typeof Date&&e instanceof Date?$e.date:$e.object;default:return $e.unknown}},ze=De.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Be extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof Be))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}Be.create=e=>new Be(e);const Ue=(e,t)=>{let s;switch(e.code){case ze.invalid_type:s=e.received===$e.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ze.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,De.jsonStringifyReplacer)}`;break;case ze.unrecognized_keys:s=`Unrecognized key(s) in object: ${De.joinValues(e.keys,", ")}`;break;case ze.invalid_union:s="Invalid input";break;case ze.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${De.joinValues(e.options)}`;break;case ze.invalid_enum_value:s=`Invalid enum value. Expected ${De.joinValues(e.options)}, received '${e.received}'`;break;case ze.invalid_arguments:s="Invalid function arguments";break;case ze.invalid_return_type:s="Invalid function return type";break;case ze.invalid_date:s="Invalid date";break;case ze.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:De.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ze.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ze.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ze.custom:s="Invalid input";break;case ze.invalid_intersection_types:s="Intersection results could not be merged";break;case ze.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case ze.not_finite:s="Number must be finite";break;default:s=t.defaultError,De.assertNever(e)}return{message:s}};let We=Ue;function Ge(){return We}const qe=e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=a.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}};function He(e,t){const s=Ge(),a=qe({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===Ue?void 0:Ue].filter((e=>!!e))});e.common.issues.push(a)}class Ke{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return Ye;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return Ke.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return Ye;if("aborted"===n.status)return Ye;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const Ye=Object.freeze({status:"aborted"}),Je=e=>({status:"dirty",value:e}),Xe=e=>({status:"valid",value:e}),Qe=e=>"aborted"===e.status,et=e=>"dirty"===e.status,tt=e=>"valid"===e.status,st=e=>"undefined"!=typeof Promise&&e instanceof Promise;function at(e,t,s,a){if("a"===s&&!a)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?a:"a"===s?a.call(e):a?a.value:t.get(e)}function nt(e,t,s,a,n){if("m"===a)throw new TypeError("Private method is not writable");if("a"===a&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?n.call(e,s):n?n.value=s:t.set(e,s),s}var rt,it,ot;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(rt||(rt={}));class dt{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const lt=(e,t)=>{if(tt(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Be(e.common.issues);return this._error=t,this._error}}};function ct(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{var r,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:n.defaultError}:void 0===n.data?{message:null!==(r=null!=o?o:a)&&void 0!==r?r:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!==(i=null!=o?o:s)&&void 0!==i?i:n.defaultError}},description:n}}class ut{get description(){return this._def.description}_getType(e){return Le(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ke,ctx:{common:e.parent.common,data:e.data,parsedType:Le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(st(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const a={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},n=this._parseSync({data:e,path:a.path,parent:a});return lt(a,n)}"~validate"(e){var t,s;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return tt(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null===(s=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===s?void 0:s.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then((e=>tt(e)?{value:e.value}:{issues:a.common.issues}))}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Le(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(st(a)?a:Promise.resolve(a));return lt(s,n)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),r=()=>a.addIssue({code:ze.custom,...s(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(r(),!1))):!!n||(r(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new us({schema:this,typeName:js.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ms.create(this,this._def)}nullable(){return hs.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Gt.create(this)}promise(){return cs.create(this,this._def)}or(e){return Kt.create([this,e],this._def)}and(e){return Qt.create(this,e,this._def)}transform(e){return new us({...ct(this._def),schema:this,typeName:js.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ps({...ct(this._def),innerType:this,defaultValue:t,typeName:js.ZodDefault})}brand(){return new ys({typeName:js.ZodBranded,type:this,...ct(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new fs({...ct(this._def),innerType:this,catchValue:t,typeName:js.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return _s.create(this,e)}readonly(){return xs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const mt=/^c[^\s-]{8,}$/i,ht=/^[0-9a-z]+$/,pt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ft=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gt=/^[a-z0-9_-]{21}$/i,vt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,yt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_t=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let xt;const bt=/^(?:(?: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])$/,kt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,wt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,jt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ct=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,St=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nt="((\\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])))",Tt=new RegExp(`^${Nt}$`);function At(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function Ot(e){let t=`${Nt}T${At(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function Pt(e,t){if(!vt.test(e))return!1;try{const[s]=e.split("."),a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return!("object"!=typeof n||null===n||!n.typ||!n.alg||t&&n.alg!==t)}catch(e){return!1}}function Ft(e,t){return!("v4"!==t&&t||!kt.test(e))||!("v6"!==t&&t||!jt.test(e))}class Zt extends ut{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==$e.string){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.string,received:t.parsedType}),Ye}const t=new Ke;let s;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),He(s,{code:ze.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),He(s,{code:ze.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const a=e.data.length>r.value,n=e.data.length<r.value;(a||n)&&(s=this._getOrReturnCtx(e,s),a?He(s,{code:ze.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):n&&He(s,{code:ze.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)_t.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"email",code:ze.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)xt||(xt=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),xt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"emoji",code:ze.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)ft.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"uuid",code:ze.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)gt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"nanoid",code:ze.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)mt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"cuid",code:ze.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)ht.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"cuid2",code:ze.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)pt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"ulid",code:ze.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(a){s=this._getOrReturnCtx(e,s),He(s,{validation:"url",code:ze.invalid_string,message:r.message}),t.dirty()}else"regex"===r.kind?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"regex",code:ze.invalid_string,message:r.message}),t.dirty())):"trim"===r.kind?e.data=e.data.trim():"includes"===r.kind?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):"toLowerCase"===r.kind?e.data=e.data.toLowerCase():"toUpperCase"===r.kind?e.data=e.data.toUpperCase():"startsWith"===r.kind?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):"endsWith"===r.kind?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):"datetime"===r.kind?Ot(r).test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:"datetime",message:r.message}),t.dirty()):"date"===r.kind?Tt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:"date",message:r.message}),t.dirty()):"time"===r.kind?new RegExp(`^${At(r)}$`).test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{code:ze.invalid_string,validation:"time",message:r.message}),t.dirty()):"duration"===r.kind?yt.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"duration",code:ze.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?(a=e.data,("v4"!==(n=r.version)&&n||!bt.test(a))&&("v6"!==n&&n||!wt.test(a))&&(s=this._getOrReturnCtx(e,s),He(s,{validation:"ip",code:ze.invalid_string,message:r.message}),t.dirty())):"jwt"===r.kind?Pt(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"jwt",code:ze.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?Ft(e.data,r.version)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"cidr",code:ze.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?Ct.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"base64",code:ze.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?St.test(e.data)||(s=this._getOrReturnCtx(e,s),He(s,{validation:"base64url",code:ze.invalid_string,message:r.message}),t.dirty()):De.assertNever(r);var a,n;return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:ze.invalid_string,...rt.errToObj(s)})}_addCheck(e){return new Zt({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...rt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...rt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...rt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...rt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...rt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...rt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...rt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...rt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...rt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...rt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...rt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...rt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...rt.errToObj(e)})}datetime(e){var t,s;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(s=null==e?void 0:e.local)&&void 0!==s&&s,...rt.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...rt.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...rt.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...rt.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...rt.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...rt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...rt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...rt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...rt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...rt.errToObj(t)})}nonempty(e){return this.min(1,rt.errToObj(e))}trim(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Zt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Et(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}Zt.create=e=>{var t;return new Zt({checks:[],typeName:js.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ct(e)})};class Vt extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==$e.number){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.number,received:t.parsedType}),Ye}let t;const s=new Ke;for(const a of this._def.checks)"int"===a.kind?De.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),He(t,{code:ze.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"multipleOf"===a.kind?0!==Et(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),He(t,{code:ze.not_finite,message:a.message}),s.dirty()):De.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,rt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,rt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,rt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,rt.toString(t))}setLimit(e,t,s,a){return new Vt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:rt.toString(a)}]})}_addCheck(e){return new Vt({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:rt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:rt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:rt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:rt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:rt.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&De.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Vt.create=e=>new Vt({checks:[],typeName:js.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...ct(e)});class It extends ut{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==$e.bigint)return this._getInvalidInput(e);let t;const s=new Ke;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),He(t,{code:ze.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):De.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.bigint,received:t.parsedType}),Ye}gte(e,t){return this.setLimit("min",e,!0,rt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,rt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,rt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,rt.toString(t))}setLimit(e,t,s,a){return new It({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:rt.toString(a)}]})}_addCheck(e){return new It({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:rt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:rt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:rt.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}It.create=e=>{var t;return new It({checks:[],typeName:js.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...ct(e)})};class Mt extends ut{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==$e.boolean){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.boolean,received:t.parsedType}),Ye}return Xe(e.data)}}Mt.create=e=>new Mt({typeName:js.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...ct(e)});class Dt extends ut{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==$e.date){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.date,received:t.parsedType}),Ye}if(isNaN(e.data.getTime()))return He(this._getOrReturnCtx(e),{code:ze.invalid_date}),Ye;const t=new Ke;let s;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),He(s,{code:ze.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),He(s,{code:ze.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):De.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Dt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:rt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:rt.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Dt.create=e=>new Dt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:js.ZodDate,...ct(e)});class Rt extends ut{_parse(e){if(this._getType(e)!==$e.symbol){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.symbol,received:t.parsedType}),Ye}return Xe(e.data)}}Rt.create=e=>new Rt({typeName:js.ZodSymbol,...ct(e)});class $t extends ut{_parse(e){if(this._getType(e)!==$e.undefined){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.undefined,received:t.parsedType}),Ye}return Xe(e.data)}}$t.create=e=>new $t({typeName:js.ZodUndefined,...ct(e)});class Lt extends ut{_parse(e){if(this._getType(e)!==$e.null){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.null,received:t.parsedType}),Ye}return Xe(e.data)}}Lt.create=e=>new Lt({typeName:js.ZodNull,...ct(e)});class zt extends ut{constructor(){super(...arguments),this._any=!0}_parse(e){return Xe(e.data)}}zt.create=e=>new zt({typeName:js.ZodAny,...ct(e)});class Bt extends ut{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Xe(e.data)}}Bt.create=e=>new Bt({typeName:js.ZodUnknown,...ct(e)});class Ut extends ut{_parse(e){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.never,received:t.parsedType}),Ye}}Ut.create=e=>new Ut({typeName:js.ZodNever,...ct(e)});class Wt extends ut{_parse(e){if(this._getType(e)!==$e.undefined){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.void,received:t.parsedType}),Ye}return Xe(e.data)}}Wt.create=e=>new Wt({typeName:js.ZodVoid,...ct(e)});class Gt extends ut{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==$e.array)return He(t,{code:ze.invalid_type,expected:$e.array,received:t.parsedType}),Ye;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(He(t,{code:e?ze.too_big:ze.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(He(t,{code:ze.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(He(t,{code:ze.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>a.type._parseAsync(new dt(t,e,t.path,s))))).then((e=>Ke.mergeArray(s,e)));const n=[...t.data].map(((e,s)=>a.type._parseSync(new dt(t,e,t.path,s))));return Ke.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new Gt({...this._def,minLength:{value:e,message:rt.toString(t)}})}max(e,t){return new Gt({...this._def,maxLength:{value:e,message:rt.toString(t)}})}length(e,t){return new Gt({...this._def,exactLength:{value:e,message:rt.toString(t)}})}nonempty(e){return this.min(1,e)}}function qt(e){if(e instanceof Ht){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=ms.create(qt(a))}return new Ht({...e._def,shape:()=>t})}return e instanceof Gt?new Gt({...e._def,type:qt(e.element)}):e instanceof ms?ms.create(qt(e.unwrap())):e instanceof hs?hs.create(qt(e.unwrap())):e instanceof es?es.create(e.items.map((e=>qt(e)))):e}Gt.create=(e,t)=>new Gt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:js.ZodArray,...ct(t)});class Ht extends ut{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=De.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==$e.object){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.object,received:t.parsedType}),Ye}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),r=[];if(!(this._def.catchall instanceof Ut&&"strip"===this._def.unknownKeys))for(const e in s.data)n.includes(e)||r.push(e);const i=[];for(const e of n){const t=a[e],n=s.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new dt(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof Ut){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)i.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)r.length>0&&(He(s,{code:ze.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new dt(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>Ke.mergeObjectSync(t,e))):Ke.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return rt.errToObj,new Ht({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var a,n,r,i;const o=null!==(r=null===(n=(a=this._def).errorMap)||void 0===n?void 0:n.call(a,t,s).message)&&void 0!==r?r:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=rt.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new Ht({...this._def,unknownKeys:"strip"})}passthrough(){return new Ht({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ht({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ht({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:js.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ht({...this._def,catchall:e})}pick(e){const t={};return De.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new Ht({...this._def,shape:()=>t})}omit(e){const t={};return De.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new Ht({...this._def,shape:()=>t})}deepPartial(){return qt(this)}partial(e){const t={};return De.objectKeys(this.shape).forEach((s=>{const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()})),new Ht({...this._def,shape:()=>t})}required(e){const t={};return De.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof ms;)e=e._def.innerType;t[s]=e}})),new Ht({...this._def,shape:()=>t})}keyof(){return os(De.objectKeys(this.shape))}}Ht.create=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strip",catchall:Ut.create(),typeName:js.ZodObject,...ct(t)}),Ht.strictCreate=(e,t)=>new Ht({shape:()=>e,unknownKeys:"strict",catchall:Ut.create(),typeName:js.ZodObject,...ct(t)}),Ht.lazycreate=(e,t)=>new Ht({shape:e,unknownKeys:"strip",catchall:Ut.create(),typeName:js.ZodObject,...ct(t)});class Kt extends ut{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new Be(e.ctx.common.issues)));return He(t,{code:ze.invalid_union,unionErrors:s}),Ye}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new Be(e)));return He(t,{code:ze.invalid_union,unionErrors:n}),Ye}}get options(){return this._def.options}}Kt.create=(e,t)=>new Kt({options:e,typeName:js.ZodUnion,...ct(t)});const Yt=e=>e instanceof rs?Yt(e.schema):e instanceof us?Yt(e.innerType()):e instanceof is?[e.value]:e instanceof ds?e.options:e instanceof ls?De.objectValues(e.enum):e instanceof ps?Yt(e._def.innerType):e instanceof $t?[void 0]:e instanceof Lt?[null]:e instanceof ms?[void 0,...Yt(e.unwrap())]:e instanceof hs?[null,...Yt(e.unwrap())]:e instanceof ys||e instanceof xs?Yt(e.unwrap()):e instanceof fs?Yt(e._def.innerType):[];class Jt extends ut{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$e.object)return He(t,{code:ze.invalid_type,expected:$e.object,received:t.parsedType}),Ye;const s=this.discriminator,a=t.data[s],n=this.optionsMap.get(a);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(He(t,{code:ze.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Ye)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const a=new Map;for(const s of t){const t=Yt(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(a.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);a.set(n,s)}}return new Jt({typeName:js.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...ct(s)})}}function Xt(e,t){const s=Le(e),a=Le(t);if(e===t)return{valid:!0,data:e};if(s===$e.object&&a===$e.object){const s=De.objectKeys(t),a=De.objectKeys(e).filter((e=>-1!==s.indexOf(e))),n={...e,...t};for(const s of a){const a=Xt(e[s],t[s]);if(!a.valid)return{valid:!1};n[s]=a.data}return{valid:!0,data:n}}if(s===$e.array&&a===$e.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const n=Xt(e[a],t[a]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return s===$e.date&&a===$e.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Qt extends ut{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(Qe(e)||Qe(a))return Ye;const n=Xt(e.value,a.value);return n.valid?((et(e)||et(a))&&t.dirty(),{status:t.value,value:n.data}):(He(s,{code:ze.invalid_intersection_types}),Ye)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Qt.create=(e,t,s)=>new Qt({left:e,right:t,typeName:js.ZodIntersection,...ct(s)});class es extends ut{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==$e.array)return He(s,{code:ze.invalid_type,expected:$e.array,received:s.parsedType}),Ye;if(s.data.length<this._def.items.length)return He(s,{code:ze.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ye;!this._def.rest&&s.data.length>this._def.items.length&&(He(s,{code:ze.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new dt(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(a).then((e=>Ke.mergeArray(t,e))):Ke.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new es({...this._def,rest:e})}}es.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new es({items:e,typeName:js.ZodTuple,rest:null,...ct(t)})};class ts extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==$e.object)return He(s,{code:ze.invalid_type,expected:$e.object,received:s.parsedType}),Ye;const a=[],n=this._def.keyType,r=this._def.valueType;for(const e in s.data)a.push({key:n._parse(new dt(s,e,s.path,e)),value:r._parse(new dt(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?Ke.mergeObjectAsync(t,a):Ke.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,s){return new ts(t instanceof ut?{keyType:e,valueType:t,typeName:js.ZodRecord,...ct(s)}:{keyType:Zt.create(),valueType:e,typeName:js.ZodRecord,...ct(t)})}}class ss extends ut{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==$e.map)return He(s,{code:ze.invalid_type,expected:$e.map,received:s.parsedType}),Ye;const a=this._def.keyType,n=this._def.valueType,r=[...s.data.entries()].map((([e,t],r)=>({key:a._parse(new dt(s,e,s.path,[r,"key"])),value:n._parse(new dt(s,t,s.path,[r,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of r){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return Ye;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of r){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return Ye;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}ss.create=(e,t,s)=>new ss({valueType:t,keyType:e,typeName:js.ZodMap,...ct(s)});class as extends ut{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==$e.set)return He(s,{code:ze.invalid_type,expected:$e.set,received:s.parsedType}),Ye;const a=this._def;null!==a.minSize&&s.data.size<a.minSize.value&&(He(s,{code:ze.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&s.data.size>a.maxSize.value&&(He(s,{code:ze.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function r(e){const s=new Set;for(const a of e){if("aborted"===a.status)return Ye;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map(((e,t)=>n._parse(new dt(s,e,s.path,t))));return s.common.async?Promise.all(i).then((e=>r(e))):r(i)}min(e,t){return new as({...this._def,minSize:{value:e,message:rt.toString(t)}})}max(e,t){return new as({...this._def,maxSize:{value:e,message:rt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}as.create=(e,t)=>new as({valueType:e,minSize:null,maxSize:null,typeName:js.ZodSet,...ct(t)});class ns extends ut{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$e.function)return He(t,{code:ze.invalid_type,expected:$e.function,received:t.parsedType}),Ye;function s(e,s){return qe({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ge(),Ue].filter((e=>!!e)),issueData:{code:ze.invalid_arguments,argumentsError:s}})}function a(e,s){return qe({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ge(),Ue].filter((e=>!!e)),issueData:{code:ze.invalid_return_type,returnTypeError:s}})}const n={errorMap:t.common.contextualErrorMap},r=t.data;if(this._def.returns instanceof cs){const e=this;return Xe((async function(...t){const i=new Be([]),o=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(s(t,e)),i})),d=await Reflect.apply(r,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch((e=>{throw i.addIssue(a(d,e)),i}))}))}{const e=this;return Xe((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new Be([s(t,i.error)]);const o=Reflect.apply(r,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new Be([a(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ns({...this._def,args:es.create(e).rest(Bt.create())})}returns(e){return new ns({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new ns({args:e||es.create([]).rest(Bt.create()),returns:t||Bt.create(),typeName:js.ZodFunction,...ct(s)})}}class rs extends ut{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rs.create=(e,t)=>new rs({getter:e,typeName:js.ZodLazy,...ct(t)});class is extends ut{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return He(t,{received:t.data,code:ze.invalid_literal,expected:this._def.value}),Ye}return{status:"valid",value:e.data}}get value(){return this._def.value}}function os(e,t){return new ds({values:e,typeName:js.ZodEnum,...ct(t)})}is.create=(e,t)=>new is({value:e,typeName:js.ZodLiteral,...ct(t)});class ds extends ut{constructor(){super(...arguments),it.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return He(t,{expected:De.joinValues(s),received:t.parsedType,code:ze.invalid_type}),Ye}if(at(this,it,"f")||nt(this,it,new Set(this._def.values),"f"),!at(this,it,"f").has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return He(t,{received:t.data,code:ze.invalid_enum_value,options:s}),Ye}return Xe(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ds.create(e,{...this._def,...t})}exclude(e,t=this._def){return ds.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}it=new WeakMap,ds.create=os;class ls extends ut{constructor(){super(...arguments),ot.set(this,void 0)}_parse(e){const t=De.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==$e.string&&s.parsedType!==$e.number){const e=De.objectValues(t);return He(s,{expected:De.joinValues(e),received:s.parsedType,code:ze.invalid_type}),Ye}if(at(this,ot,"f")||nt(this,ot,new Set(De.getValidEnumValues(this._def.values)),"f"),!at(this,ot,"f").has(e.data)){const e=De.objectValues(t);return He(s,{received:s.data,code:ze.invalid_enum_value,options:e}),Ye}return Xe(e.data)}get enum(){return this._def.values}}ot=new WeakMap,ls.create=(e,t)=>new ls({values:e,typeName:js.ZodNativeEnum,...ct(t)});class cs extends ut{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==$e.promise&&!1===t.common.async)return He(t,{code:ze.invalid_type,expected:$e.promise,received:t.parsedType}),Ye;const s=t.parsedType===$e.promise?t.data:Promise.resolve(t.data);return Xe(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}cs.create=(e,t)=>new cs({type:e,typeName:js.ZodPromise,...ct(t)});class us extends ut{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===js.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{He(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(s.data,n);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return Ye;const a=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===a.status?Ye:"dirty"===a.status||"dirty"===t.value?Je(a.value):a}));{if("aborted"===t.value)return Ye;const a=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===a.status?Ye:"dirty"===a.status||"dirty"===t.value?Je(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===a.status?Ye:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?Ye:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!tt(e))return e;const r=a.transform(e.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>tt(e)?Promise.resolve(a.transform(e.value,n)).then((e=>({status:t.value,value:e}))):e))}De.assertNever(a)}}us.create=(e,t,s)=>new us({schema:e,typeName:js.ZodEffects,effect:t,...ct(s)}),us.createWithPreprocess=(e,t,s)=>new us({schema:t,effect:{type:"preprocess",transform:e},typeName:js.ZodEffects,...ct(s)});class ms extends ut{_parse(e){return this._getType(e)===$e.undefined?Xe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ms.create=(e,t)=>new ms({innerType:e,typeName:js.ZodOptional,...ct(t)});class hs extends ut{_parse(e){return this._getType(e)===$e.null?Xe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}hs.create=(e,t)=>new hs({innerType:e,typeName:js.ZodNullable,...ct(t)});class ps extends ut{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===$e.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ps.create=(e,t)=>new ps({innerType:e,typeName:js.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...ct(t)});class fs extends ut{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return st(a)?a.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Be(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Be(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}fs.create=(e,t)=>new fs({innerType:e,typeName:js.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...ct(t)});class gs extends ut{_parse(e){if(this._getType(e)!==$e.nan){const t=this._getOrReturnCtx(e);return He(t,{code:ze.invalid_type,expected:$e.nan,received:t.parsedType}),Ye}return{status:"valid",value:e.data}}}gs.create=e=>new gs({typeName:js.ZodNaN,...ct(e)});const vs=Symbol("zod_brand");class ys extends ut{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class _s extends ut{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?Ye:"dirty"===e.status?(t.dirty(),Je(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?Ye:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new _s({in:e,out:t,typeName:js.ZodPipeline})}}class xs extends ut{_parse(e){const t=this._def.innerType._parse(e),s=e=>(tt(e)&&(e.value=Object.freeze(e.value)),e);return st(t)?t.then((e=>s(e))):s(t)}unwrap(){return this._def.innerType}}function bs(e,t){const s="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof s?{message:s}:s}function ks(e,t={},s){return e?zt.create().superRefine(((a,n)=>{var r,i;const o=e(a);if(o instanceof Promise)return o.then((e=>{var r,i;if(!e){const e=bs(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}}));if(!o){const e=bs(t,a),o=null===(i=null!==(r=e.fatal)&&void 0!==r?r:s)||void 0===i||i;n.addIssue({code:"custom",...e,fatal:o})}})):zt.create()}xs.create=(e,t)=>new xs({innerType:e,typeName:js.ZodReadonly,...ct(t)});const ws={object:Ht.lazycreate};var js;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(js||(js={}));const Cs=Zt.create,Ss=Vt.create,Ns=gs.create,Ts=It.create,As=Mt.create,Os=Dt.create,Ps=Rt.create,Fs=$t.create,Zs=Lt.create,Es=zt.create,Vs=Bt.create,Is=Ut.create,Ms=Wt.create,Ds=Gt.create,Rs=Ht.create,$s=Ht.strictCreate,Ls=Kt.create,zs=Jt.create,Bs=Qt.create,Us=es.create,Ws=ts.create,Gs=ss.create,qs=as.create,Hs=ns.create,Ks=rs.create,Ys=is.create,Js=ds.create,Xs=ls.create,Qs=cs.create,ea=us.create,ta=ms.create,sa=hs.create,aa=us.createWithPreprocess,na=_s.create,ra={string:e=>Zt.create({...e,coerce:!0}),number:e=>Vt.create({...e,coerce:!0}),boolean:e=>Mt.create({...e,coerce:!0}),bigint:e=>It.create({...e,coerce:!0}),date:e=>Dt.create({...e,coerce:!0})},ia=Ye;var oa=Object.freeze({__proto__:null,defaultErrorMap:Ue,setErrorMap:function(e){We=e},getErrorMap:Ge,makeIssue:qe,EMPTY_PATH:[],addIssueToContext:He,ParseStatus:Ke,INVALID:Ye,DIRTY:Je,OK:Xe,isAborted:Qe,isDirty:et,isValid:tt,isAsync:st,get util(){return De},get objectUtil(){return Re},ZodParsedType:$e,getParsedType:Le,ZodType:ut,datetimeRegex:Ot,ZodString:Zt,ZodNumber:Vt,ZodBigInt:It,ZodBoolean:Mt,ZodDate:Dt,ZodSymbol:Rt,ZodUndefined:$t,ZodNull:Lt,ZodAny:zt,ZodUnknown:Bt,ZodNever:Ut,ZodVoid:Wt,ZodArray:Gt,ZodObject:Ht,ZodUnion:Kt,ZodDiscriminatedUnion:Jt,ZodIntersection:Qt,ZodTuple:es,ZodRecord:ts,ZodMap:ss,ZodSet:as,ZodFunction:ns,ZodLazy:rs,ZodLiteral:is,ZodEnum:ds,ZodNativeEnum:ls,ZodPromise:cs,ZodEffects:us,ZodTransformer:us,ZodOptional:ms,ZodNullable:hs,ZodDefault:ps,ZodCatch:fs,ZodNaN:gs,BRAND:vs,ZodBranded:ys,ZodPipeline:_s,ZodReadonly:xs,custom:ks,Schema:ut,ZodSchema:ut,late:ws,get ZodFirstPartyTypeKind(){return js},coerce:ra,any:Es,array:Ds,bigint:Ts,boolean:As,date:Os,discriminatedUnion:zs,effect:ea,enum:Js,function:Hs,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ks((t=>t instanceof e),t),intersection:Bs,lazy:Ks,literal:Ys,map:Gs,nan:Ns,nativeEnum:Xs,never:Is,null:Zs,nullable:sa,number:Ss,object:Rs,oboolean:()=>As().optional(),onumber:()=>Ss().optional(),optional:ta,ostring:()=>Cs().optional(),pipeline:na,preprocess:aa,promise:Qs,record:Ws,set:qs,strictObject:$s,string:Cs,symbol:Ps,transformer:ea,tuple:Us,undefined:Fs,union:Ls,unknown:Vs,void:Ms,NEVER:ia,ZodIssueCode:ze,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:Be});const da=(e,t,s)=>{if(e&&"reportValidity"in e){const a=P(s,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}},la=(e,t)=>{for(const s in t.fields){const a=t.fields[s];a&&a.ref&&"reportValidity"in a.ref?da(a.ref,s,e):a&&a.refs&&a.refs.forEach((t=>da(t,s,e)))}},ca=(e,t)=>{t.shouldUseNativeValidation&&la(e,t);const s={};for(const a in e){const n=P(t.fields,a),r=Object.assign(e[a]||{},{ref:n&&n.ref});if(ua(t.names||Object.keys(e),a)){const e=Object.assign({},P(s,a));V(e,"root",r),V(s,a,e)}else V(s,a,r)}return s},ua=(e,t)=>e.some((e=>e.match(`^${t}\\.\\d+`)));var ma=function(e,t){for(var s={};e.length;){var a=e[0],n=a.code,r=a.message,i=a.path.join(".");if(!s[i])if("unionErrors"in a){var o=a.unionErrors[0].errors[0];s[i]={message:o.message,type:o.code}}else s[i]={message:r,type:n};if("unionErrors"in a&&a.unionErrors.forEach((function(t){return t.errors.forEach((function(t){return e.push(t)}))})),t){var d=s[i].types,l=d&&d[a.code];s[i]=Q(i,t,s,n,l?[].concat(l,a.message):a.message)}e.shift()}return s},ha=function(e,t,s){return void 0===s&&(s={}),function(a,n,r){try{return Promise.resolve(function(n,i){try{var o=Promise.resolve(e["sync"===s.mode?"parse":"parseAsync"](a,t)).then((function(e){return r.shouldUseNativeValidation&&la({},r),{errors:{},values:s.raw?Object.assign({},a):e}}))}catch(e){return i(e)}return o&&o.then?o.then(void 0,i):o}(0,(function(e){if(function(e){return Array.isArray(null==e?void 0:e.errors)}(e))return{values:{},errors:ca(ma(e.errors,!r.shouldUseNativeValidation&&"all"===r.criteriaMode),r)};throw e})))}catch(e){return Promise.reject(e)}}};const pa=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),fa=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});var ga=s(942),va=s.n(ga);const ya=(0,n.createContext)(null),_a=({children:e})=>{const[t,s]=(0,n.useState)([]),a=(0,n.useCallback)(((e,a="success")=>{const n=Date.now();s([...t,{id:n,message:e,type:a}]),setTimeout((()=>{r(n)}),3e3)}),[s,t]),r=e=>{s((t=>t.filter((t=>t.id!==e))))},i={addToast:a,toasts:t};return(0,o.jsxs)(ya.Provider,{value:i,children:[(0,o.jsx)("div",{className:"absolute w-full top-0 flex-row flex-row justify-center",style:{zIndex:100001},children:(0,o.jsx)("div",{className:"flex-col",children:t.map((e=>(0,o.jsxs)("div",{className:va()("mt-1 px-2 py-1 rounded-sm text-center text-white p-2 rounded-md flex-row items-center gap-x-1",{"bg-green-light":"success"===e.type,"bg-red-light":"error"===e.type}),children:["success"===e.type&&(0,o.jsx)(v.Icon,{icon:pa,className:"fill-green"}),"error"===e.type&&(0,o.jsx)(v.Icon,{icon:fa,className:"fill-red"}),(0,o.jsx)("span",{className:va()({"text-green":"success"===e.type,"text-red":"error"===e.type}),children:e.message})]},e.id)))})}),e]})},xa=[{key:"fb",name:"Facebook",regex_error_message:"Pixel IDs must only contain numbers"},{key:"ga4",name:"Google Analytics 4",regex_error_message:"Pixel IDs format is like G-H34Y45Y4"},{key:"google",name:"Google Ads",regex_error_message:"Pixel IDs format is like AW-857837465656/h3fawt68rjk"},{key:"google-merchant",name:"Google Merchant"},{key:"linkedin",name:"LinkedIn",regex_error_message:"Pixel IDs format is like 345345"},{key:"microsoftads",name:"Microsoft Ads",regex_error_message:"Pixel IDs format is like 345345"},{key:"pinterest",name:"Pinterest",regex_error_message:"Pixel IDs format is TAG_ID|ADVERTISER_ID Ex:2612489213258|549766677910"},{key:"postback",name:"Postback",regex_error_message:"Pixel IDs format is like 345345"},{key:"quora",name:"Quora",regex_error_message:"Pixel IDs format is ACCOUNT_ID|PIXEL_ID Ex:123456|78980fef424"},{key:"snapchat",name:"Snapchat",regex_error_message:"Pixel IDs format is like 867f406d-330d-49d7-8425-21434f5c778c"},{key:"tiktok",name:"TikTok",regex_error_message:"Pixel IDs must only contain alphabetical and numerical characters"}],ba=[{key:"AddPaymentInfo",name:"Add payment info"},{key:"AddToCart",name:"Add to cart"},{key:"AddToWishlist",name:"Add to wishlist"},{key:"CompleteRegistration",name:"Complete registration"},{key:"Contact",name:"Contact"},{key:"CustomizeProduct",name:"Customize product"},{key:"Donate",name:"Donate"},{key:"FindLocation",name:"Find location"},{key:"InitiateCheckout",name:"Initiate checkout"},{key:"Lead",name:"Lead"},{key:"PageView",name:"Page view"},{key:"Purchase",name:"Purchase"},{key:"Schedule",name:"Schedule"},{key:"Search",name:"Search"},{key:"StartTrial",name:"Start trial"},{key:"SubmitApplication",name:"Submit application"},{key:"Subscribe",name:"Subscribe"},{key:"ViewContent",name:"View content"},{key:"customEvent",name:"Custom event"}],ka=["PageView"],wa=({onClose:e,editingPixel:t})=>{var s,a,r,i,l;const{addPixel:c,modifyPixel:u,isRefreshing:h,isUpdating:f,oneTagDashboardUrl:y}=(0,n.useContext)(d),{settings:_}=(0,n.useContext)(m),{updateOtCustomerPixel:x,isUpdating:b}=(0,n.useContext)(p),{addToast:k}=(0,n.useContext)(ya),w=(0,n.useMemo)((()=>ba.filter((e=>{var t;return(null!==(t=_?.available_events)&&void 0!==t?t:[]).includes(e.key)}))),[_]),j=(0,n.useMemo)((()=>!!t),[t]),C=(0,n.useMemo)((()=>oa.object({id:oa.string().min(5,(0,g.__)("This field is required and min characters are 5.","adsmurai-one-tag")),name:oa.string(),type:oa.any(),access_token:oa.string(),events:oa.array(oa.boolean()).refine((e=>0===e.length||e.some((e=>!0===e))),{message:(0,g.__)("At least one event type must be selected.","adsmurai-one-tag")})})),[]),{control:S,handleSubmit:N,setValue:T,getValues:A,trigger:O,formState:{errors:P,isSubmitting:F}}=Ve({defaultValues:{id:null!==(s=t?.id)&&void 0!==s?s:"",type:null!==(a=t?.type)&&void 0!==a?a:xa[0].key,name:null!==(r=t?.name)&&void 0!==r?r:"",access_token:null!==(i=t?.access_token)&&void 0!==i?i:"",events:w.map((e=>t?t.events.includes(e.key):w.includes(e.key)))},mode:"onSubmit",resolver:ha(C)}),Z=A(),E=Object.keys(P).length>0,V=(0,n.useCallback)((async s=>{const a=s.events.map(((e,t)=>e?w[t]?.key:null)).filter((e=>!!e)),n={...s,events:a};if(j)await u(t.id,n);else{const e=await x({pixelId:s.id,accessToken:s.access_token,name:s.name,type:s.type});if(e)return void k(e,"error");await c(n)}e()}),[e,c,u,t,j,x,w,k]),I=(0,n.useCallback)((async e=>{T("events",w.map((()=>e))),await O("events")}),[T,O,w]),M=(0,n.useMemo)((()=>Z.events.filter((e=>e)).length===w.length),[Z,w]);return(0,o.jsx)(v.Modal,{title:(0,g.__)(j?"Modify Pixel":"Add New Pixel","adsmurai-one-tag"),onRequestClose:e,size:"large",isDismissible:!0,shouldCloseOnClickOutside:!0,children:(0,o.jsxs)("div",{children:[j&&(0,o.jsx)("a",{href:y,target:"_blank",children:(0,o.jsxs)("div",{className:"p-2 bg-blue-light mb-2 flex-row items-center gap-x-1",children:[(0,o.jsx)(v.Icon,{size:24,icon:Me}),(0,g.__)("Pixel details can be edited on One Tag dashboard.","adsmurai-one-tag")]})}),(0,o.jsxs)("form",{className:"flex-col gap-y-2",onSubmit:N(V),noValidate:!0,children:[(0,o.jsx)(X,{render:({field:e})=>(0,o.jsxs)("div",{children:[(0,o.jsx)(v.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Pixel ID","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:F||j}),!!P.id?.message&&(0,o.jsx)("div",{className:"pt-1 text-red",children:P.id.message})]}),name:"id",control:S}),(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Pixel Name","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:F||j}),name:"name",control:S}),(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.CustomSelectControl,{name:e.name,label:(0,g.__)("Pixel Type","adsmurai-one-tag"),value:xa.find((t=>t.key===e.value)),onChange:t=>e.onChange(t.selectedItem.key),options:xa,disabled:F||j}),name:"type",control:S}),(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Access Token","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:F||j}),name:"access_token",control:S}),w.length>0?(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-row gap-x-2",children:[(0,o.jsx)("div",{className:"input-label mb-1",children:(0,g.__)("Run on the following events","adsmurai-one-tag")}),(0,o.jsx)(v.ToggleControl,{label:(0,g.__)("Check all","adsmurai-one-tag"),checked:M,onChange:e=>{I(e)},disabled:F})]}),(0,o.jsx)("div",{className:"flex-row flex-wrap gap-x-1 gap-y-1",children:w.map((({key:e,name:t},s)=>(0,o.jsx)("div",{className:"w-5.5 shrink-0",children:(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.ToggleControl,{label:t,checked:e.value,onChange:t=>{e.onChange(t),O("events")},disabled:F}),name:`events.${s}`,control:S})},`event-type-${e}`)))}),!!P.events&&(0,o.jsx)("div",{className:"pt-1 text-red",children:null!==(l=P.events.message)&&void 0!==l?l:P.events.root?.message})]}):(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"input-label mb-1",children:(0,g.__)("Run on the following events","adsmurai-one-tag")}),(0,o.jsxs)("div",{children:[(0,o.jsx)(v.Icon,{icon:"warning",size:20})," ",(0,o.jsx)("span",{children:(0,g.__)("No event types available","adsmurai-one-tag")})]})]}),(0,o.jsxs)("div",{className:"flex-row-reverse items-center",children:[(0,o.jsx)(v.Button,{type:"submit",variant:"primary",disabled:F||E||h,children:(0,g.__)(j?"Modify Pixel":"Add Pixel","adsmurai-one-tag")}),(f||b)&&(0,o.jsx)(v.Spinner,{className:"size-2"})]})]})]})})},ja=({show:e,title:t,message:s,options:a,onClose:n})=>e?(0,o.jsxs)(v.Modal,{title:t,onRequestClose:n,size:"small",isDismissible:!0,shouldCloseOnClickOutside:!0,children:[(0,o.jsx)("div",{children:s}),(null!=a?a:[]).length>0?(0,o.jsx)("div",{className:"mt-3 flex-row-reverse gap-x-1",children:a.reverse().map(((e,t)=>(0,o.jsxs)(v.Button,{...e.props,children:[e.isLoading&&(0,o.jsx)(v.Spinner,{}),e.label]},`dialog-option-${t}}`)))}):null]}):null,Ca=()=>{const{oneTagSettings:e,deletePixel:t,isRefreshing:s,isUpdating:a,postSettings:r}=(0,n.useContext)(d),{refresh:i}=(0,n.useContext)(p),{settings:l}=(0,n.useContext)(m),[c,u]=(0,n.useState)(!1),[h,f]=(0,n.useState)(null),[_,x]=(0,n.useState)(null),[b,k]=(0,n.useState)(!1),w=(0,n.useMemo)((()=>{var t;return(null!==(t=e?.pixels)&&void 0!==t?t:[]).length>0}),[e]),j=(0,n.useCallback)((async()=>{k(!0);const t=await i(!1);if(t){var s;const i=[];for(const s of e.pixels){var a;const e=(null!==(a=t.pixels)&&void 0!==a?a:[]).find((e=>e.id===s.id));e?i.push({...s,access_token:e.access_token,type:e.type,name:e.name}):i.push(s)}const o=null!==(s=l?.available_events)&&void 0!==s?s:ka,d=[];for(const e of null!==(n=t?.pixels)&&void 0!==n?n:[]){var n;i.every((t=>t.id!==e.id))&&d.push({id:e.id,access_token:e.access_token,type:e.type,name:e.name,events:o})}await r({...e,pixels:[...i,...d]})}k(!1)}),[i,e,l,r,k]);return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-row justify-between items-center",children:[(0,o.jsx)("h1",{className:"text-lg font-bold w-full",children:(0,g.__)("Your Pixels","adsmurai-one-tag")}),w&&(0,o.jsxs)("div",{className:"flex-row-reverse pb-2 gap-x-1",children:[(0,o.jsx)(v.Button,{variant:"secondary",onClick:()=>u(!0),children:(0,g.__)("Add New Pixel","adsmurai-one-tag")}),(0,o.jsxs)(v.Button,{variant:"secondary",onClick:()=>j(),disabled:b,children:[b&&(0,o.jsx)(v.Spinner,{}),(0,g.__)("Import from One Tag","adsmurai-one-tag")]})]})]}),(0,o.jsx)(v.Card,{className:"p-2",children:s?(0,o.jsx)(v.Spinner,{className:"size-4"}):w?(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("table",{className:"w-full text-md",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"text-left uppercase",children:[(0,o.jsx)("th",{}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("ID","adsmurai-one-tag")})}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("Name","adsmurai-one-tag")})}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("Trigger On","adsmurai-one-tag")})}),(0,o.jsx)("th",{})]})}),(0,o.jsx)("tbody",{children:e.pixels.map((e=>{var t;return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"py-1 pe-1",children:(0,o.jsx)("img",{className:"size-3",src:y[e.type],alt:e.name})})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"px-1",children:e.id})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"px-1",children:null!==(t=e.name)&&void 0!==t?t:"-"})}),(0,o.jsx)("td",{className:"italic",children:(0,o.jsx)("div",{className:"px-1",children:e.events.join(", ")})}),(0,o.jsx)("td",{className:"text-right",children:(0,o.jsxs)("div",{className:"ps-1",style:{minWidth:"5rem"},children:[(0,o.jsx)(v.Button,{icon:"trash",onClick:()=>{x(e)}}),(0,o.jsx)(v.Button,{icon:"edit",onClick:()=>{f(e),u(!0)}})]})})]},`added-pixel-${e.id}`)}))})]})}):(0,o.jsxs)(v.Card,{variant:"secondary",className:"py-2 px-2",children:[(0,o.jsxs)("p",{className:"text-lg text-center",children:[(0,o.jsx)(v.Icon,{icon:"warning",size:"20"})," ",(0,g.__)("You don't have any pixels added","adsmurai-one-tag")]}),(0,o.jsx)("div",{className:"mt-3 flex-row justify-center",children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)("div",{children:(0,o.jsx)(v.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>u(!0),children:(0,g.__)("Add Pixels","adsmurai-one-tag")})}),(0,o.jsx)("div",{children:(0,o.jsx)(v.Button,{className:"w-full block",style:{textAlign:"center"},variant:"link",onClick:()=>j(),disabled:b,children:(0,g.__)("Import from One Tag","adsmurai-one-tag")})})]})})]})}),c&&(0,o.jsx)(wa,{onClose:()=>{u(!1),f(null)},editingPixel:h}),(0,o.jsx)(ja,{show:!!_,title:(0,g.__)("Delete Pixel","adsmurai-one-tag"),message:(0,g.__)("Are you sure to delete this pixel?","adsmurai-one-tag"),onClose:()=>x(null),options:[{props:{onClick:()=>x(null),variant:"secondary"},label:(0,g.__)("Cancel","adsmurai-one-tag")},{props:{onClick:async()=>{await t(_.id),x(null)},variant:"primary",disabled:s||a},isLoading:a,label:(0,g.__)("Delete","adsmurai-one-tag")}]})]})},Sa=(0,n.createContext)(null),Na=({children:e})=>{const[t,s]=(0,n.useState)([]),[a,r]=(0,n.useState)(!1),i=(0,n.useCallback)((async()=>{try{r(!0);const e=await fetch("/index.php?rest_route=/one-tag/forms",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),t=(await e.json()).map((e=>({...e,id:e.id.toString()})));s(null!=t?t:[])}catch{}finally{r(!1)}}),[]);(0,n.useEffect)((()=>{i()}),[]);const d={forms:t,isLoading:a};return(0,o.jsx)(Sa.Provider,{value:d,children:e})},Ta=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Aa=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})}),Oa=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Pa=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),Fa=({className:e,items:t,defaultExpanded:s})=>{const[a,r]=(0,n.useState)(null!=s?s:null);return(0,o.jsx)("div",{className:e,children:t.map(((e,t)=>{const s=e.name===a;return(0,o.jsxs)(v.Card,{className:"p-2",children:[(0,o.jsxs)("div",{onClick:()=>r(s?null:e.name),className:"cursor-pointer flex-row items-center justify-between gap-x-1",children:[e.title,s?(0,o.jsx)(v.Icon,{icon:Oa,size:28}):(0,o.jsx)(v.Icon,{icon:Pa,size:28})]}),s&&(0,o.jsx)("div",{className:"mt-2",children:e.children})]},`${e.name}_${t}`)}))})},Za=()=>{const{oneTagSettings:e,saveApiToken:t,isRefreshing:s,isUpdating:a}=(0,n.useContext)(d),[r,i]=(0,n.useState)(""),[l,c]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{s||e?.apiToken===r||i(e?.apiToken)}),[s]),(0,o.jsx)("div",{className:"mt-4",children:(0,o.jsx)(Fa,{defaultExpanded:e.token?null:"token",items:[{name:"token",title:(0,o.jsxs)("div",{className:"flex-row items-center gap-x-2",children:[(0,o.jsx)("span",{className:"text-xl",children:(0,g.__)("One Tag Token","adsmurai-one-tag")}),!!e.apiToken&&(0,o.jsx)(v.Icon,{className:"fill-green",icon:pa,size:40})]}),children:(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)(v.__experimentalInputControl,{type:l?"text":"password",label:(0,g.__)("Token","adsmurai-one-tag"),value:r,onChange:i,disabled:a||s,suffix:(0,o.jsx)(v.Button,{onClick:()=>c(!l),icon:l?Ta:Aa})}),(0,o.jsxs)("div",{className:"flex-row-reverse items-center",children:[(0,o.jsx)(v.Button,{variant:"primary",disabled:a||r===e?.token,onClick:()=>t(r),children:(0,g.__)("Set Token","adsmurai-one-tag")}),a&&(0,o.jsx)(v.Spinner,{className:"size-2"})]})]}),(0,o.jsx)(v.Card,{variant:"secondary",className:"mt-2 px-2 py-0.5",children:(0,o.jsxs)("p",{children:[(0,o.jsx)(v.Icon,{icon:"info",size:"20"})," ",(0,g.__)("OneTag token lets this plugin access your configured pixels. Get your token by visiting","adsmurai-one-tag")," ",(0,o.jsx)("a",{href:"https://st.adsmurai.com",target:"_blank",children:(0,g.__)("OneTag dashboard","adsmurai-one-tag")}),"."]})})]})}]})})},Ea=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),Va=[{field:"ph",name:(0,g.__)("Phone Number","adsmurai-one-tag")},{field:"em",name:(0,g.__)("Email","adsmurai-one-tag")},{field:"fn",name:(0,g.__)("First Name","adsmurai-one-tag")},{field:"ln",name:(0,g.__)("Last Name","adsmurai-one-tag")},{field:"db",name:(0,g.__)("Date of Birth","adsmurai-one-tag")},{field:"ge",name:(0,g.__)("Gender","adsmurai-one-tag")},{field:"ct",name:(0,g.__)("City","adsmurai-one-tag")},{field:"st",name:(0,g.__)("State","adsmurai-one-tag")},{field:"zp",name:(0,g.__)("Zip Code","adsmurai-one-tag")},{field:"country",name:(0,g.__)("Country","adsmurai-one-tag")},{field:"tz",name:(0,g.__)("Time Zone","adsmurai-one-tag")},{field:"item_id",name:(0,g.__)("Item ID","adsmurai-one-tag")},{field:"id",name:(0,g.__)("Event ID","adsmurai-one-tag")},{field:"quantity",name:(0,g.__)("Item Number","adsmurai-one-tag")},{field:"item_price",name:(0,g.__)("Price of the Item","adsmurai-one-tag")},{field:"delivery_category",name:(0,g.__)("Type of Delivery","adsmurai-one-tag")},{field:"content_type",name:(0,g.__)("Content Type","adsmurai-one-tag")},{field:"content_id",name:(0,g.__)("Content / Product ID","adsmurai-one-tag")}],Ia=()=>{const{addToast:e}=(0,n.useContext)(ya),{forms:t,isLoading:s}=(0,n.useContext)(Sa),{oneTagSettings:a,modifyFieldsMatch:r}=(0,n.useContext)(d),[i,l]=(0,n.useState)([]),[c,u]=(0,n.useState)(null),m=(0,n.useMemo)((()=>{var e;return null!==(e=a?.forms?.find((e=>e.formId===c?.id&&e.plugin===c?.plugin)))&&void 0!==e?e:null}),[a,c]),h=(0,n.useMemo)((()=>t.map((e=>({key:`${e.id}-${e.plugin}`,name:`[${e.plugin}] ${e.title}`})))),[t]),p=(0,n.useMemo)((()=>[{name:(0,g.__)("- Unmapped -","adsmurai-one-tag"),key:null},...i.map((({formField:e,formFieldLabel:t})=>({key:e,name:t===e?t:`${t} (${e})`})))]),[i]),f=(0,n.useCallback)(((t,s)=>{var a;const n=(null!==(a=m?.matches)&&void 0!==a?a:[]).filter((e=>e.otField!==t&&e.formField!==s)),i=Va.find((e=>e.field===t))?.name;s?(r(c?.id,c?.plugin,[...n,{formField:s,otField:t}]),e((0,g.__)(i+" is assigned to "+s,"adsmurai-one-tag"),"success")):(r(c?.id,c?.plugin,n),e((0,g.__)(i+" is unassigned","adsmurai-one-tag"),"success"))}),[r,m,c,e]);return(0,n.useEffect)((()=>{!c&&(null!=t?t:[]).length>0&&u({id:t[0].id,plugin:t[0].plugin});const e=t.find((e=>e.id===c?.id&&e.plugin===c?.plugin));e&&l(e.fields.map((e=>({formField:e.name,formFieldLabel:e.label}))))}),[c,t,l]),(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Field Matcher","adsmurai-one-tag")}),(0,o.jsx)(v.Card,{className:"p-2",children:s?(0,o.jsx)(v.Spinner,{className:"size-4"}):t.length>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"mb-3 flex-row-reverse",children:(0,o.jsx)("div",{className:"w-6",children:(0,o.jsx)(v.CustomSelectControl,{label:(0,g.__)("Select Your Form","adsmurai-one-tag"),value:t.find((e=>e.id===c?.id&&e.plugin===c?.plugin)),onChange:e=>{const[t,s]=e.selectedItem.key.split("-");u({id:t,plugin:s})},options:h})})}),(0,o.jsxs)("table",{className:"w-full",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"text-left",children:[(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"pe-1",children:(0,g.__)("Event Details","adsmurai-one-tag")})}),(0,o.jsx)("th",{}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"ps-1",children:(0,g.__)("Form Field Assignment","adsmurai-one-tag")})})]})}),(0,o.jsx)("tbody",{children:Va.map((({field:e,name:t},s)=>{var a;const n=m?.matches?.find((t=>t.otField===e)),r=null!==(a=p.find((e=>e.key===n?.formField)))&&void 0!==a?a:p[0];return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{className:"border-b border-gray-light",children:(0,o.jsxs)("div",{className:"pe-1 pt-2",children:[t," ",(0,o.jsxs)("span",{className:"font-courier",children:["(",e,")"]})]})}),(0,o.jsx)("td",{className:"w-3",children:(0,o.jsx)("div",{className:"px-1 pt-2",children:(0,o.jsx)(v.Icon,{className:va()({"fill-gray-light":!n,"fill-green":n}),icon:Ea,size:40})})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"ps-1 pb-1",children:(0,o.jsx)(v.CustomSelectControl,{options:p,value:r,onChange:t=>f(e,t.selectedItem.key)})})})]},`ot-field-${e}-${t}-${s}`)}))})]},`form-fields_${c?.id}_${c?.plugin}`)]}):(0,o.jsx)("div",{children:(0,g.__)("No Forms Detected!","one.tag")})})]})},Ma=()=>{const{isProd:e}=(0,n.useContext)(m),{otCustomer:t,isLoading:s}=(0,n.useContext)(p),a=(0,n.useMemo)((()=>{var e;return(null!==(e=t?.subscriptions)&&void 0!==e?e:[]).length>0}),[t]),r=(0,n.useMemo)((()=>t?`${e?i:"https://localhost:3001"}/${t.organization_id}/add_subscription/one-tag`:null),[e]),d=(0,n.useMemo)((()=>t?t.stripe_customer_id?`${e?i:"https://localhost:3001"}/api/stripe/portal?id=${t.stripe_customer_id}&organization_id=${t.organization_id}`:`${e?i:"https://localhost:3001"}/${t.organization_id}/one-tag`:null),[e,t]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Your Subscriptions","adsmurai-one-tag")}),a?(0,o.jsx)("div",{className:"flex flex-row flex-wrap gap-x-2",children:t.subscriptions.map((e=>{const t=["trialing","active"].includes(e.status)&&!1===e.cancelAtPeriodEnd;return(0,o.jsx)(v.Card,{className:"p-2 w-6",children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsxs)("div",{className:"flex-row items-center gap-x-1 mb-2",children:[(0,o.jsx)("strong",{className:"text-lg",children:e.name}),(0,o.jsx)("div",{className:va()("px-1 py-0.5",{"text-green bg-green-light":t,"text-red bg-red-light":!t}),children:e.cancelAtPeriodEnd?(0,g.__)("Cancelled","adsmurai-one-tag"):e.status})]}),!!e.description&&(0,o.jsx)("div",{children:e.description}),(0,o.jsxs)("div",{className:"text-gray",children:[(0,o.jsxs)("span",{children:[e.cancelAtPeriodEnd?(0,g.__)("Ends on","adsmurai-one-tag"):(0,g.__)("Renews on","adsmurai-one-tag"),":"]})," ",(0,o.jsx)("span",{children:e.renewsAt})]})]})},e.id)}))}):(0,o.jsx)(v.Card,{className:"p-2",children:s?(0,o.jsx)(v.Spinner,{className:"size-4"}):(0,o.jsx)("div",{children:(0,g.__)("No subscriptions found.","adsmurai-one-tag")})}),!s&&(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-end",children:[(0,o.jsx)("a",{href:r,target:"_blank",children:(0,o.jsx)(v.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Add subscription","adsmurai-one-tag")})}),(0,o.jsx)("a",{href:d,target:"_blank",children:(0,o.jsx)(v.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Manage subscriptions","adsmurai-one-tag")})})]})]})},Da=()=>{const{isProd:e,settings:t}=(0,n.useContext)(m),{postSettings:s,isUpdating:a,isRefreshing:r}=(0,n.useContext)(d),[i,l]=(0,n.useState)("main"),c=(0,n.useCallback)((async()=>{const a=await $a(e);if(a){var n,r,i,o,d;const e=null!==(n=t?.available_events)&&void 0!==n?n:ka;await s({token:null!==(r=a.token)&&void 0!==r?r:null,apiToken:null!==(i=a.key)&&void 0!==i?i:null,organizationId:null!==(o=a.organization?.id)&&void 0!==o?o:null,pixels:(null!==(d=a.pixels)&&void 0!==d?d:[]).map((t=>({id:t.id,type:t.type,name:t.name,access_token:t.access_token,events:e})))})}}),[e,s,t]);return(0,o.jsx)("div",{className:"flex-col justify-center",style:{height:"calc(100vh - 200px)"},children:(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"text-center text-xl",children:(0,g.__)("Time to link your AMP account!","adsmurai-one-tag")}),(0,o.jsx)("div",{className:"text-center text-lg mt-2",children:(0,g.__)("You need an AMP account to use this plugin","adsmurai-one-tag")}),"main"===i&&(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-center",children:[(0,o.jsx)(v.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>l("create_account"),disabled:a||r,children:(0,g.__)("Create Account","adsmurai-one-tag")}),(0,o.jsx)(v.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},onClick:()=>c(),disabled:a||r,children:(0,g.__)("Sign In","adsmurai-one-tag")})]}),"create_account"===i&&(0,o.jsxs)("div",{className:"mt-4 flex-col gap-y-3 justify-center",children:[(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-lg font-bold mb-2",children:(0,g.__)("1. Create an Adsmurai account")}),(0,o.jsx)(v.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>Ra(),disabled:a||r,children:(0,g.__)("Create Account","adsmurai-one-tag")})]}),(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-lg font-bold mb-2",children:(0,g.__)("2. Once you have an account, click on Sign in")}),(0,o.jsx)(v.Button,{variant:"secondary",style:{padding:"2rem 6rem",fontSize:"1.5rem"},onClick:()=>c(),disabled:a||r,children:(0,g.__)("Sign In","adsmurai-one-tag")})]})]}),(a||r)&&(0,o.jsx)("div",{className:"mt-2 text-center",children:(0,o.jsx)(v.Spinner,{className:"size-4"})})]})})},Ra=()=>{window.open(`${r}/register/organizations?http_referer_code=onetag&utm_source=plugin&utm_medium=wp`)},$a=async e=>new Promise((t=>{const s=new URLSearchParams({origin:location.href,utm_source:"wp"}),a=function(e,t){const s=t.top.outerHeight/2+t.top.screenY-350,a=t.top.outerWidth/2+t.top.screenX-300;return t.open(e,"_blank",` copyhistory=no, width=600, height=700, top=${s}, left=${a}`)}(`${r}/login?redirectTo=${encodeURIComponent((e?i:"https://localhost:3001")+"/en/connect?"+s.toString())}`,window);window.addEventListener("message",(e=>{[r,i,"https://localhost:3001"].includes(e.origin)&&e.source===a?(console.log("MESSAGE",e,JSON.stringify(e?.data,null,2)),e?.data&&(a.close(),t(e.data))):t(null)}),!1)})),La=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM12.75 8V13H11.25V8H12.75ZM12.75 14.5V16H11.25V14.5H12.75Z"})}),za=[["WOOCOMMERCE","WooCommerce"],["WPCF7","Contact Form 7"],["WP_FORMS","WPForms Lite"],["NINJA_FORMS","Ninja Forms"],["FORMINATOR","Forminator"],["FLUENT_FORMS","Fluent Forms"]],Ba=()=>{const{settings:e,isLoading:t}=(0,n.useContext)(m),s=(0,n.useMemo)((()=>{var t;return(null!==(t=e?.compatible_plugins)&&void 0!==t?t:[]).length>0}),[e]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Detected Compatible Plugins","adsmurai-one-tag")}),(0,o.jsx)(v.Card,{className:"p-2",children:t?(0,o.jsx)(v.Spinner,{className:"size-4"}):(0,o.jsxs)("div",{children:[za.map((([t,s],a)=>{const n=e.compatible_plugins.includes(t),r=`cp_${t}_${a}`;return(0,o.jsxs)("div",{className:"flex-row items-center",children:[n?(0,o.jsx)(v.Icon,{icon:pa,className:"fill-green",size:24}):(0,o.jsx)(v.Icon,{icon:fa,className:"fill-red",size:24}),(0,o.jsx)("span",{children:s})," ",Object.entries(e.events_per_plugin).filter((([e,s])=>e===t)).map((([e,t],s)=>(0,o.jsxs)("span",{className:"italic",children:["(",t.join(", "),")"]},`${r}_${s}`)))]},r)})),!s&&(0,o.jsxs)("div",{className:"mt-2 p-2 bg-orange-light flex-row items-center gap-x-1",children:[(0,o.jsx)(v.Icon,{size:24,icon:La}),(0,o.jsx)("span",{children:(0,g.__)("No compatible plugins found.","adsmurai-one-tag")})]})]})})]})},Ua=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})}),Wa=()=>{const{ampFeedsUrl:e}=(0,n.useContext)(d),[t,s]=(0,n.useState)(!1),[a,r]=(0,n.useState)(null),[i,l]=(0,n.useState)(!1);(0,n.useEffect)((()=>{a||(async()=>{try{var e;s(!0);const t=await fetch("/index.php?rest_route=/one-tag/feed",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),a=await t.json();r(null!==(e=a?.url)&&void 0!==e?e:null)}catch{}finally{s(!1)}})()}),[a,r,s]);const c=(0,n.useCallback)((async()=>{await Ga(a),l(!0),setTimeout((()=>{l(!1)}),2e3)}),[a,l]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Feed","adsmurai-one-tag")}),(0,o.jsx)(v.Card,{className:"p-2",children:t?(0,o.jsx)(v.Spinner,{className:"size-4"}):(0,o.jsxs)("div",{className:"flex-row items-center gap-x-1",children:[(0,o.jsx)(v.Icon,{size:20,icon:Ua}),a,(0,o.jsx)(v.Button,{className:"ms-auto",variant:i?"success":"primary",onClick:()=>c(),children:(0,g.__)(i?"Copied!":"Copy","adsmurai-one-tag")})]})}),(0,o.jsx)("div",{className:"mt-2 flex-row justify-center",children:(0,o.jsx)("a",{href:e,target:"_blank",children:(0,o.jsx)(v.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Open AMP Feeds","adsmurai-one-tag")})})}),(0,o.jsxs)(v.Card,{className:"mt-3 p-2",children:[(0,o.jsx)("span",{className:"text-xl font-bold",children:(0,g.__)("Adsmurai Feed Generator for WooCommerce – FAQ","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Adsmurai Feed Generator for WooCommerce is a plugin that automatically creates a product feed including all your WooCommerce products. This feed is updated once per day to ensure that your product data remains accurate and up-to-date.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How does the plugin work?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Once installed and activated, the plugin automatically generates a comprehensive product feed containing product titles, descriptions, prices, images, stock status, and more. The feed updates daily to reflect any changes in your WooCommerce store.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("What can I use the product feed for?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The product feed can be used to share your WooCommerce product catalog with various marketing channels such as Google Merchant Center, Meta (Facebook and Instagram), Pinterest, and more. This helps you run dynamic product ads and improve the visibility of your products across different platforms.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Can I filter or optimize the product feed?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The Adsmurai Feed Generator plugin creates a basic product feed with all WooCommerce products. To filter, optimize, or customize your feed further, we recommend using Adsmurai Marketing Platform. With this platform, you can apply custom rules, exclude out-of-stock products, map categories, and create thousands of personalized ad creatives from your product catalog.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How often is the product feed updated?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The product feed is automatically updated once per day to ensure your product information remains accurate and consistent across channels.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Is there any configuration needed?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The plugin requires minimal configuration. Once installed, it automatically generates the product feed without any manual input. However, if you need advanced customization or filtering, you should integrate the feed with Adsmurai Marketing Platform.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How do I connect the product feed with Adsmurai Marketing Platform?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Once the feed is generated, you can import it into Adsmurai Marketing Platform by providing the feed URL. From there, you can optimize, filter, and distribute your feed to different advertising platforms.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("What channels are supported by Adsmurai Marketing Platform?","adsmurai-one-tag")}),(0,o.jsx)("p",{children:(0,g.__)("Adsmurai Marketing Platform supports various advertising channels, including:","adsmurai-one-tag")}),(0,o.jsxs)("ul",{className:"mb-3 list-disc",children:[(0,o.jsx)("li",{children:(0,g.__)("Google Merchant Center (Google Shopping Ads)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Meta (Facebook and Instagram Ads)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Pinterest (Product Pins)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("TikTok Ads","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Snapchat Ads","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("And more","adsmurai-one-tag")})]}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Does the plugin support large product catalogs?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Yes, the plugin is designed to handle both small and large product catalogs efficiently.\n","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Is there any cost associated with Adsmurai Feed Generator for WooCommerce?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The Adsmurai Feed Generator plugin itself is free to install and use. However, Adsmurai Marketing Platform is a paid service that offers advanced feed management and advertising features.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How can I get support?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("For support with the Adsmurai Feed Generator plugin, please visit our support page. For assistance with Adsmurai Marketing Platform, please contact our sales team or visit our website.","one-tag")}),(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-center",children:[(0,o.jsx)("a",{href:"https://www.adsmurai.com/en/product#book-demo?utm_source=plugin&utm_medium=wp",target:"_blank",children:(0,o.jsx)(v.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Contact our sales team","adsmurai-one-tag")})}),(0,o.jsx)("a",{href:"https://www.adsmurai.com/en/product?utm_source=plugin&utm_medium=wp",target:"_blank",children:(0,o.jsx)(v.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Visit our site","adsmurai-one-tag")})})]})]})]})},Ga=async e=>{await navigator.clipboard.writeText(e)},qa=[{key:"custom",name:"Custom Cookie",cookie:""},{key:"cookiebot",name:"Cookiebot",cookie:"CookieConsent"},{key:"cookieyes",name:"CookieYes",cookie:"cookieyes-consent"},{key:"cookiefirst",name:"CookieFirst",cookie:"cookieconsent_status"},{key:"cookiehub",name:"CookieHub",cookie:"cookieconsent_status"},{key:"consentmanager",name:"Consentmanager",cookie:"consentmanager"}],Ha=()=>{var e,t;const{oneTagSettings:s,saveGDPRCookie:a}=(0,n.useContext)(d),[r,i]=(0,n.useState)(""),l=(0,n.useMemo)((()=>oa.object({enabled:oa.boolean(),cmp:oa.string(),cookie:oa.string()}).refine((e=>!e.enabled||e.enabled&&!!e.cookie),{message:(0,g.__)("This field is required.","adsmurai-one-tag"),path:["cookie"]})),[]),{control:c,handleSubmit:u,watch:m,setValue:h,trigger:p,formState:{isSubmitting:f,errors:y,isValid:_,isDirty:x}}=Ve({defaultValues:{enabled:!!s?.gdprCookie,cmp:s?.gdprCookie&&null!==(e=qa.find((e=>e.cookie===s?.gdprCookie))?.key)&&void 0!==e?e:qa[0].key,cookie:null!==(t=s?.gdprCookie)&&void 0!==t?t:""},mode:"onChange",resolver:ha(l)}),b=m("enabled"),k=m("cmp"),w=(0,n.useMemo)((()=>k===qa[0].key),[k]);(0,n.useEffect)((()=>{if(x){if(b&&!w){const e=qa.find((e=>e.key===k))?.cookie;h("cookie",e),i(e)}else h("cookie",""),i("");p("cookie")}}),[x,s,k,w,b,h,p,i]);const j=(0,n.useCallback)((async e=>{await a(e.cookie)}),[a]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("GDPR Consent","adsmurai-one-tag")}),(0,o.jsx)(v.Card,{className:"p-2",children:(0,o.jsx)("form",{onSubmit:u(j),noValidate:!0,children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.ToggleControl,{label:(0,g.__)("Make One Tag send events only when visitor has consented to.","one-tag"),checked:e.value,onChange:t=>e.onChange(t)}),name:"enabled",control:c}),b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"flex-row gap-x-2",children:[(0,o.jsx)(X,{render:({field:e})=>(0,o.jsx)(v.CustomSelectControl,{className:"w-6",name:e.name,label:(0,g.__)("CMP Provider","adsmurai-one-tag"),value:qa.find((t=>t.key===e.value)),onChange:t=>e.onChange(t.selectedItem.key),options:qa,disabled:f}),name:"cmp",control:c}),(0,o.jsx)(X,{render:({field:e})=>(0,o.jsxs)("div",{children:[(0,o.jsx)(v.__experimentalInputControl,{className:"w-6",name:e.name,type:"text",label:(0,g.__)("Cookie","adsmurai-one-tag"),value:e.value,onChange:t=>{i(t),e.onChange(t)},disabled:f}),!!y.cookie?.message&&(0,o.jsx)("div",{className:"pt-1 text-red",children:y.cookie.message})]}),name:"cookie",control:c})]}),(0,o.jsxs)("div",{className:"p-2 bg-orange-light mb-2 flex-row items-center gap-x-1",children:[(0,o.jsx)(v.Icon,{size:24,icon:La}),(0,g.__)('One Tag will only send events if cookie "'+(r||"?")+'" is set.',"one-tag")]})]}),(0,o.jsx)("div",{className:"flex-row-reverse",children:(0,o.jsx)(v.Button,{type:"submit",variant:"primary",disabled:f||!_,children:(0,g.__)("Save","adsmurai-one-tag")})})]})})})]})},Ka=()=>{const{resetSettings:e,isUpdating:t}=(0,n.useContext)(d),[s,a]=(0,n.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)("hr",{className:"w-full"}),(0,o.jsx)("div",{className:"w-full flex-row-reverse",children:(0,o.jsx)(v.Button,{variant:"secondary",onClick:()=>a(!0),children:"Reset Settings"})})]}),(0,o.jsx)(ja,{show:s,title:(0,g.__)("Reset settings","adsmurai-one-tag"),message:(0,g.__)("Are you sure you want to reset your settings? This action cannot be undone.","adsmurai-one-tag"),onClose:()=>a(!1),options:[{props:{onClick:()=>a(!1),variant:"secondary"},label:(0,g.__)("Cancel","adsmurai-one-tag")},{props:{onClick:async()=>{await e(),a(!1)},variant:"primary",disabled:t},isLoading:t,label:(0,g.__)("Reset my settings","adsmurai-one-tag")}]})]})},Ya=()=>{var e;const{isLoaded:t,showConnectScreen:s,showSingleTab:a,oneTagSettings:r}=(0,n.useContext)(d),{settings:i}=(0,n.useContext)(m);return t?s?(0,o.jsx)(Da,{}):a?(0,o.jsxs)(o.Fragment,{children:[0===(null!==(l=r?.pixels)&&void 0!==l?l:[]).length&&(0,o.jsx)(Ca,{}),!r?.token&&(0,o.jsx)(Za,{})]}):(0,o.jsx)(v.TabPanel,{onSelect:()=>{},tabs:[{name:"main",title:(0,g.__)("Main","adsmurai-one-tag")},{name:"fieldMatcher",title:(0,g.__)("Forms","adsmurai-one-tag")},...(null!==(e=i?.compatible_plugins)&&void 0!==e?e:[]).includes("WOOCOMMERCE")?[{name:"feed",title:(0,g.__)("Feed","adsmurai-one-tag")}]:[],{name:"subscriptions",title:(0,g.__)("Subscriptions","adsmurai-one-tag")}],children:({name:e})=>(0,o.jsxs)("div",{children:["main"===e&&(0,o.jsxs)("div",{className:"flex-col gap-y-3",children:[(0,o.jsx)(Ca,{}),(0,o.jsx)(Ba,{}),(0,o.jsx)(Ha,{}),(0,o.jsx)(Za,{}),(0,o.jsx)(Ka,{})]}),"fieldMatcher"===e&&(0,o.jsx)(Na,{children:(0,o.jsx)(Ia,{})}),"feed"===e&&(0,o.jsx)(Wa,{}),"subscriptions"===e&&(0,o.jsx)(Ma,{})]})}):(0,o.jsx)("div",{className:"flex-row justify-center",children:(0,o.jsx)(v.Spinner,{className:"size-4"})});var l},Ja=()=>(0,o.jsx)(_a,{children:(0,o.jsx)(l,{children:(0,o.jsx)(h,{children:(0,o.jsx)(f,{children:(0,o.jsx)("div",{className:"py-2",children:(0,o.jsx)(Ya,{})})})})})});document.addEventListener("DOMContentLoaded",(function(){const t=document.getElementById("one-tag");t&&(0,e.H)(t).render((0,o.jsx)(Ja,{}))})),"undefined"!=typeof wpData&&(window._oneTagWpToken=wpData.oneTagWpToken)})()})();
     1(()=>{var e={20:(e,t,s)=>{"use strict";var a=s(609),n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,o=a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,s){var a,r={},l=null,c=null;for(a in void 0!==s&&(l=""+s),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,a)&&!d.hasOwnProperty(a)&&(r[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===r[a]&&(r[a]=t[a]);return{$$typeof:n,type:e,key:l,ref:c,props:r,_owner:o.current}}t.Fragment=r,t.jsx=l,t.jsxs=l},338:(e,t,s)=>{"use strict";var a=s(795);t.H=a.createRoot,a.hydrateRoot},500:(e,t)=>{var s;!function(){"use strict";var a={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(e=i(e,r(s)))}return e}function r(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var s in e)a.call(e,s)&&e[s]&&(t=i(t,s));return t}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):void 0===(s=function(){return n}.apply(t,[]))||(e.exports=s)}()},609:e=>{"use strict";e.exports=window.React},795:e=>{"use strict";e.exports=window.ReactDOM},848:(e,t,s)=>{"use strict";e.exports=s(20)}},t={};function s(a){var n=t[a];if(void 0!==n)return n.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,s),r.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;s.g.importScripts&&(e=s.g.location+"");var t=s.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var a=t.getElementsByTagName("script");if(a.length)for(var n=a.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=a[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),s.p=e})(),(()=>{"use strict";var e=s(338);const t=window.wp.apiFetch;var a=s.n(t);const n=window.wp.element,r="https://amp.adsmurai.com",i="https://st.adsmurai.com";var o=s(848);const d=(0,n.createContext)(null),l=({children:e})=>{const t=u();return(0,o.jsx)(d.Provider,{value:t,children:e})},c={token:"",pixels:[],forms:[]},u=()=>{const[e,t]=(0,n.useState)(c),[s,r]=(0,n.useState)(!1),[o,d]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),m=(0,n.useMemo)(()=>{var t;return!s&&!o&&!e?.token&&0===(null!==(t=e?.pixels)&&void 0!==t?t:[]).length},[e,s,o]),h=(0,n.useMemo)(()=>{var t;return!e?.token||0===(null!==(t=e?.pixels)&&void 0!==t?t:[]).length},[e]),p=(0,n.useMemo)(()=>{var t;return!!e?.token&&(null!==(t=e?.pixels)&&void 0!==t?t:[]).length>0},[e]),f=(0,n.useMemo)(()=>`${i}/${e?.organizationId}/one-tag`,[e]),g=(0,n.useMemo)(()=>`https://feeds.adsmurai.com/v2/organization/${e?.organizationId}/feeds-manager/data-imports/list`,[e]),_=(0,n.useCallback)(()=>{r(!0),a()({path:"/wp/v2/settings"}).then(e=>{var s;r(!1),t(null!==(s=e.one_tag_settings)&&void 0!==s?s:c),u(!0)})},[t,r,u]),y=(0,n.useCallback)(async e=>{d(!0),await a()({path:"/wp/v2/settings",method:"POST",data:{one_tag_settings:e}}),await _(),d(!1)},[d,d]),v=(0,n.useCallback)(async t=>{await y({...e,apiToken:null!=t?t:""})},[e,y]),x=(0,n.useCallback)(async t=>{e.pixels.some(e=>e.id===t.id)||await y({...e,pixels:[...e.pixels,t]})},[e,y]),b=(0,n.useCallback)(async(t,s)=>{e.pixels=e.pixels.map(e=>e.id===t?s:e),await y(e)},[e,y]),k=(0,n.useCallback)(async t=>{e.pixels=e.pixels.filter(e=>e.id!==t),await y(e)},[e,y]),w=(0,n.useCallback)(async(t,s,a)=>{var n;const r=(null!==(n=e.forms)&&void 0!==n?n:[]).find(e=>e.formId===t&&e.plugin===s);r?r.matches=a:(e.forms||(e.forms=[]),e.forms.push({formId:t,plugin:s,matches:a})),await y(e)},[e,y]),j=(0,n.useCallback)(async t=>{await y({...e,gdprCookie:t})},[e,y]),C=(0,n.useCallback)(async()=>{await y(null)},[y]);return(0,n.useEffect)(()=>{_()},[]),{isLoaded:l,showConnectScreen:m,showSingleTab:h,isBaseConfigDone:p,postSettings:y,saveApiToken:v,addPixel:x,modifyPixel:b,deletePixel:k,oneTagSettings:e,isRefreshing:s,isUpdating:o,modifyFieldsMatch:w,saveGDPRCookie:j,resetSettings:C,oneTagDashboardUrl:f,ampFeedsUrl:g}},m=(0,n.createContext)(null),h=({children:e})=>{const[t,s]=(0,n.useState)({}),[a,r]=(0,n.useState)(!1),[i,d]=(0,n.useState)(!1),l=(0,n.useCallback)(async()=>{try{r(!0);const e=await fetch("/index.php?rest_route=/one-tag/settings",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),t=await e.json();s(null!=t?t:{})}catch{}finally{r(!1)}},[]);(0,n.useEffect)(()=>{l(),d("localhost"!==window.location.hostname)},[]);const c={settings:t,isLoading:a,isProd:i};return(0,o.jsx)(m.Provider,{value:c,children:e})},p=(0,n.createContext)(null),f=({children:e})=>{const{isProd:t}=(0,n.useContext)(m),{oneTagSettings:s}=(0,n.useContext)(d),[a,r]=(0,n.useState)(null),[l,c]=(0,n.useState)(!1),[u,h]=(0,n.useState)(!1),f=(0,n.useCallback)(async(e=!0)=>{if(!s?.token)return;let a=null;try{c(!0);const n=await fetch((t?i:"https://localhost:3001")+"/api/customers/me?subscriptions="+e,{method:"GET",headers:{Authorization:s?.token}});a=await n.json(),r(a)}catch{r(null)}finally{c(!1)}return a},[t,s]),g=(0,n.useCallback)(async(e,n=!0)=>{let r=a?.id;if(!r){const e=await f();if(r=e?.id,!r)return}h(!0);const o=await fetch((t?i:"https://localhost:3001")+`/api/customers/${r}/pixels/${e.pixelId}`,{headers:{"Content-Type":"application/json",Authorization:s.token},method:n?"POST":"PUT",body:JSON.stringify(e)});if(h(!1),200!==o.status){const e=await o.json();return e?.error}await f()},[a,t,f,c,s,h]);(0,n.useEffect)(()=>{a||f()},[s,a]);const _={otCustomer:a,isLoading:l,refresh:f,updateOtCustomerPixel:g,isUpdating:u};return(0,o.jsx)(p.Provider,{value:_,children:e})},g=window.wp.i18n,_=window.wp.components,y={fb:s.p+"images/fb-logo.6110350a.png",ga4:s.p+"images/ga4-logo.13aa694f.png",google:s.p+"images/google-logo.c963c457.png","google-merchant":s.p+"images/google_merchant-logo.d8d1b769.png",linkedin:s.p+"images/linkedin-logo.4adcaa71.png",microsoftads:s.p+"images/microsoftads-logo.6ac19bb0.png",pinterest:s.p+"images/pinterest-logo.c1904eec.png",postback:s.p+"images/postback-logo.ca45b8e6.png",quora:s.p+"images/quora-logo.a17e74d5.png",snapchat:s.p+"images/snapchat-logo.367899bd.png",tiktok:s.p+"images/tiktok-logo.c8a8ce07.png"};var v=s(609),x=e=>"checkbox"===e.type,b=e=>e instanceof Date,k=e=>null==e;const w=e=>"object"==typeof e;var j=e=>!k(e)&&!Array.isArray(e)&&w(e)&&!b(e),C=e=>j(e)&&e.target?x(e.target)?e.target.checked:e.target.value:e,S=(e,t)=>e.has((e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e)(t)),N="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function A(e){let t;const s=Array.isArray(e),a="undefined"!=typeof FileList&&e instanceof FileList;if(e instanceof Date)t=new Date(e);else{if(N&&(e instanceof Blob||a)||!s&&!j(e))return e;if(t=s?[]:{},s||(e=>{const t=e.constructor&&e.constructor.prototype;return j(t)&&t.hasOwnProperty("isPrototypeOf")})(e))for(const s in e)e.hasOwnProperty(s)&&(t[s]=A(e[s]));else t=e}return t}var T=e=>/^\w*$/.test(e),O=e=>void 0===e,F=e=>Array.isArray(e)?e.filter(Boolean):[],V=e=>F(e.replace(/["|']|\]/g,"").split(/\.|\[/)),P=(e,t,s)=>{if(!t||!j(e))return s;const a=(T(t)?[t]:V(t)).reduce((e,t)=>k(e)?e:e[t],e);return O(a)||a===e?O(e[t])?s:e[t]:a},E=e=>"boolean"==typeof e,I=(e,t,s)=>{let a=-1;const n=T(t)?[t]:V(t),r=n.length,i=r-1;for(;++a<r;){const t=n[a];let r=s;if(a!==i){const s=e[t];r=j(s)||Array.isArray(s)?s:isNaN(+n[a+1])?{}:[]}if("__proto__"===t||"constructor"===t||"prototype"===t)return;e[t]=r,e=e[t]}};const Z="blur",D="onChange",M="onSubmit",R="all",$="pattern",L="required",z=v.createContext(null);z.displayName="HookFormContext";const B=()=>v.useContext(z);var U=(e,t,s,a=!0)=>{const n={defaultValues:t._defaultValues};for(const r in e)Object.defineProperty(n,r,{get:()=>{const n=r;return t._proxyFormState[n]!==R&&(t._proxyFormState[n]=!a||R),s&&(s[n]=!0),e[n]}});return n};const W="undefined"!=typeof window?v.useLayoutEffect:v.useEffect;var G=e=>"string"==typeof e,H=(e,t,s,a,n)=>G(e)?(a&&t.watch.add(e),P(s,e,n)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),P(s,e))):(a&&(t.watchAll=!0),s),q=e=>k(e)||!w(e);function K(e,t,s=new WeakSet){if(q(e)||q(t))return e===t;if(b(e)&&b(t))return e.getTime()===t.getTime();const a=Object.keys(e),n=Object.keys(t);if(a.length!==n.length)return!1;if(s.has(e)||s.has(t))return!0;s.add(e),s.add(t);for(const r of a){const a=e[r];if(!n.includes(r))return!1;if("ref"!==r){const e=t[r];if(b(a)&&b(e)||j(a)&&j(e)||Array.isArray(a)&&Array.isArray(e)?!K(a,e,s):a!==e)return!1}}return!0}const Y=e=>e.render(function(e){const t=B(),{name:s,disabled:a,control:n=t.control,shouldUnregister:r,defaultValue:i}=e,o=S(n._names.array,s),d=v.useMemo(()=>P(n._formValues,s,P(n._defaultValues,s,i)),[n,s,i]),l=function(e){const t=B(),{control:s=t.control,name:a,defaultValue:n,disabled:r,exact:i,compute:o}=e||{},d=v.useRef(n),l=v.useRef(o),c=v.useRef(void 0);l.current=o;const u=v.useMemo(()=>s._getWatch(a,d.current),[s,a]),[m,h]=v.useState(l.current?l.current(u):u);return W(()=>s._subscribe({name:a,formState:{values:!0},exact:i,callback:e=>{if(!r){const t=H(a,s._names,e.values||s._formValues,!1,d.current);if(l.current){const e=l.current(t);K(e,c.current)||(h(e),c.current=e)}else h(t)}}}),[s,r,a,i]),v.useEffect(()=>s._removeUnmounted()),m}({control:n,name:s,defaultValue:d,exact:!0}),c=function(e){const t=B(),{control:s=t.control,disabled:a,name:n,exact:r}=e||{},[i,o]=v.useState(s._formState),d=v.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return W(()=>s._subscribe({name:n,formState:d.current,exact:r,callback:e=>{!a&&o({...s._formState,...e})}}),[n,a,r]),v.useEffect(()=>{d.current.isValid&&s._setValid(!0)},[s]),v.useMemo(()=>U(i,s,d.current,!1),[i,s])}({control:n,name:s,exact:!0}),u=v.useRef(e),m=v.useRef(n.register(s,{...e.rules,value:l,...E(e.disabled)?{disabled:e.disabled}:{}}));u.current=e;const h=v.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!P(c.errors,s)},isDirty:{enumerable:!0,get:()=>!!P(c.dirtyFields,s)},isTouched:{enumerable:!0,get:()=>!!P(c.touchedFields,s)},isValidating:{enumerable:!0,get:()=>!!P(c.validatingFields,s)},error:{enumerable:!0,get:()=>P(c.errors,s)}}),[c,s]),p=v.useCallback(e=>m.current.onChange({target:{value:C(e),name:s},type:"change"}),[s]),f=v.useCallback(()=>m.current.onBlur({target:{value:P(n._formValues,s),name:s},type:Z}),[s,n._formValues]),g=v.useCallback(e=>{const t=P(n._fields,s);t&&e&&(t._f.ref={focus:()=>e.focus&&e.focus(),select:()=>e.select&&e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})},[n._fields,s]),_=v.useMemo(()=>({name:s,value:l,...E(a)||c.disabled?{disabled:c.disabled||a}:{},onChange:p,onBlur:f,ref:g}),[s,a,c.disabled,p,f,g,l]);return v.useEffect(()=>{const e=n._options.shouldUnregister||r;n.register(s,{...u.current.rules,...E(u.current.disabled)?{disabled:u.current.disabled}:{}});const t=(e,t)=>{const s=P(n._fields,e);s&&s._f&&(s._f.mount=t)};if(t(s,!0),e){const e=A(P(n._options.defaultValues,s));I(n._defaultValues,s,e),O(P(n._formValues,s))&&I(n._formValues,s,e)}return!o&&n.register(s),()=>{(o?e&&!n._state.action:e)?n.unregister(s):t(s,!1)}},[s,n,o,r]),v.useEffect(()=>{n._setDisabledField({disabled:a,name:s})},[a,s,n]),v.useMemo(()=>({field:_,formState:c,fieldState:h}),[_,c,h])}(e));var J=(e,t,s,a,n)=>t?{...s[e],types:{...s[e]&&s[e].types?s[e].types:{},[a]:n||!0}}:{},X=e=>Array.isArray(e)?e:[e],Q=()=>{let e=[];return{get observers(){return e},next:t=>{for(const s of e)s.next&&s.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),unsubscribe:()=>{e=[]}}},ee=e=>j(e)&&!Object.keys(e).length,te=e=>"file"===e.type,se=e=>"function"==typeof e,ae=e=>{if(!N)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ne=e=>"select-multiple"===e.type,re=e=>"radio"===e.type,ie=e=>ae(e)&&e.isConnected;function oe(e,t){const s=Array.isArray(t)?t:T(t)?[t]:V(t),a=1===s.length?e:function(e,t){const s=t.slice(0,-1).length;let a=0;for(;a<s;)e=O(e)?a++:e[t[a++]];return e}(e,s),n=s.length-1,r=s[n];return a&&delete a[r],0!==n&&(j(a)&&ee(a)||Array.isArray(a)&&function(e){for(const t in e)if(e.hasOwnProperty(t)&&!O(e[t]))return!1;return!0}(a))&&oe(e,s.slice(0,-1)),e}var de=e=>{for(const t in e)if(se(e[t]))return!0;return!1};function le(e,t={}){const s=Array.isArray(e);if(j(e)||s)for(const s in e)Array.isArray(e[s])||j(e[s])&&!de(e[s])?(t[s]=Array.isArray(e[s])?[]:{},le(e[s],t[s])):k(e[s])||(t[s]=!0);return t}function ce(e,t,s){const a=Array.isArray(e);if(j(e)||a)for(const a in e)Array.isArray(e[a])||j(e[a])&&!de(e[a])?O(t)||q(s[a])?s[a]=Array.isArray(e[a])?le(e[a],[]):{...le(e[a])}:ce(e[a],k(t)?{}:t[a],s[a]):s[a]=!K(e[a],t[a]);return s}var ue=(e,t)=>ce(e,t,le(t));const me={value:!1,isValid:!1},he={value:!0,isValid:!0};var pe=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!O(e[0].attributes.value)?O(e[0].value)||""===e[0].value?he:{value:e[0].value,isValid:!0}:he:me}return me},fe=(e,{valueAsNumber:t,valueAsDate:s,setValueAs:a})=>O(e)?e:t?""===e?NaN:e?+e:e:s&&G(e)?new Date(e):a?a(e):e;const ge={isValid:!1,value:null};var _e=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,ge):ge;function ye(e){const t=e.ref;return te(t)?t.files:re(t)?_e(e.refs).value:ne(t)?[...t.selectedOptions].map(({value:e})=>e):x(t)?pe(e.refs).value:fe(O(t.value)?e.ref.value:t.value,e)}var ve=e=>e instanceof RegExp,xe=e=>O(e)?e:ve(e)?e.source:j(e)?ve(e.value)?e.value.source:e.value:e,be=e=>({isOnSubmit:!e||e===M,isOnBlur:"onBlur"===e,isOnChange:e===D,isOnAll:e===R,isOnTouch:"onTouched"===e});const ke="AsyncFunction";var we=e=>!!e&&!!e.validate&&!!(se(e.validate)&&e.validate.constructor.name===ke||j(e.validate)&&Object.values(e.validate).find(e=>e.constructor.name===ke)),je=(e,t,s)=>!s&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const Ce=(e,t,s,a)=>{for(const n of s||Object.keys(e)){const s=P(e,n);if(s){const{_f:e,...r}=s;if(e){if(e.refs&&e.refs[0]&&t(e.refs[0],n)&&!a)return!0;if(e.ref&&t(e.ref,e.name)&&!a)return!0;if(Ce(r,t))break}else if(j(r)&&Ce(r,t))break}}};function Se(e,t,s){const a=P(e,s);if(a||T(s))return{error:a,name:s};const n=s.split(".");for(;n.length;){const a=n.join("."),r=P(t,a),i=P(e,a);if(r&&!Array.isArray(r)&&s!==a)return{name:s};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};n.pop()}return{name:s}}var Ne=(e,t,s)=>{const a=X(P(e,s));return I(a,"root",t[s]),I(e,s,a),e},Ae=e=>G(e);function Te(e,t,s="validate"){if(Ae(e)||Array.isArray(e)&&e.every(Ae)||E(e)&&!e)return{type:s,message:Ae(e)?e:"",ref:t}}var Oe=e=>j(e)&&!ve(e)?e:{value:e,message:""},Fe=async(e,t,s,a,n,r)=>{const{ref:i,refs:o,required:d,maxLength:l,minLength:c,min:u,max:m,pattern:h,validate:p,name:f,valueAsNumber:g,mount:_}=e._f,y=P(s,f);if(!_||t.has(f))return{};const v=o?o[0]:i,b=e=>{n&&v.reportValidity&&(v.setCustomValidity(E(e)?"":e||""),v.reportValidity())},w={},C=re(i),S=x(i),N=C||S,A=(g||te(i))&&O(i.value)&&O(y)||ae(i)&&""===i.value||""===y||Array.isArray(y)&&!y.length,T=J.bind(null,f,a,w),F=(e,t,s,a="maxLength",n="minLength")=>{const r=e?t:s;w[f]={type:e?a:n,message:r,ref:i,...T(e?a:n,r)}};if(r?!Array.isArray(y)||!y.length:d&&(!N&&(A||k(y))||E(y)&&!y||S&&!pe(o).isValid||C&&!_e(o).isValid)){const{value:e,message:t}=Ae(d)?{value:!!d,message:d}:Oe(d);if(e&&(w[f]={type:L,message:t,ref:v,...T(L,t)},!a))return b(t),w}if(!(A||k(u)&&k(m))){let e,t;const s=Oe(m),n=Oe(u);if(k(y)||isNaN(y)){const a=i.valueAsDate||new Date(y),r=e=>new Date((new Date).toDateString()+" "+e),o="time"==i.type,d="week"==i.type;G(s.value)&&y&&(e=o?r(y)>r(s.value):d?y>s.value:a>new Date(s.value)),G(n.value)&&y&&(t=o?r(y)<r(n.value):d?y<n.value:a<new Date(n.value))}else{const a=i.valueAsNumber||(y?+y:y);k(s.value)||(e=a>s.value),k(n.value)||(t=a<n.value)}if((e||t)&&(F(!!e,s.message,n.message,"max","min"),!a))return b(w[f].message),w}if((l||c)&&!A&&(G(y)||r&&Array.isArray(y))){const e=Oe(l),t=Oe(c),s=!k(e.value)&&y.length>+e.value,n=!k(t.value)&&y.length<+t.value;if((s||n)&&(F(s,e.message,t.message),!a))return b(w[f].message),w}if(h&&!A&&G(y)){const{value:e,message:t}=Oe(h);if(ve(e)&&!y.match(e)&&(w[f]={type:$,message:t,ref:i,...T($,t)},!a))return b(t),w}if(p)if(se(p)){const e=Te(await p(y,s),v);if(e&&(w[f]={...e,...T("validate",e.message)},!a))return b(e.message),w}else if(j(p)){let e={};for(const t in p){if(!ee(e)&&!a)break;const n=Te(await p[t](y,s),v,t);n&&(e={...n,...T(t,n.message)},b(n.message),a&&(w[f]=e))}if(!ee(e)&&(w[f]={ref:v,...e},!a))return w}return b(!0),w};const Ve={mode:M,reValidateMode:D,shouldFocusError:!0};function Pe(e={}){let t,s={...Ve,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:se(s.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:s.errors||{},disabled:s.disabled||!1},n={},r=(j(s.defaultValues)||j(s.values))&&A(s.defaultValues||s.values)||{},i=s.shouldUnregister?{}:A(r),o={action:!1,mount:!1,watch:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},l=0;const c={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let u={...c};const m={array:Q(),state:Q()},h=s.criteriaMode===R,p=async e=>{if(!s.disabled&&(c.isValid||u.isValid||e)){const e=s.resolver?ee((await y()).errors):await v(n,!0);e!==a.isValid&&m.state.next({isValid:e})}},f=(e,t)=>{!s.disabled&&(c.isValidating||c.validatingFields||u.isValidating||u.validatingFields)&&((e||Array.from(d.mount)).forEach(e=>{e&&(t?I(a.validatingFields,e,t):oe(a.validatingFields,e))}),m.state.next({validatingFields:a.validatingFields,isValidating:!ee(a.validatingFields)}))},g=(e,t,s,a)=>{const d=P(n,e);if(d){const n=P(i,e,O(s)?P(r,e):s);O(n)||a&&a.defaultChecked||t?I(i,e,t?n:ye(d._f)):V(e,n),o.mount&&p()}},_=(e,t,n,i,o)=>{let d=!1,l=!1;const h={name:e};if(!s.disabled){if(!n||i){(c.isDirty||u.isDirty)&&(l=a.isDirty,a.isDirty=h.isDirty=w(),d=l!==h.isDirty);const s=K(P(r,e),t);l=!!P(a.dirtyFields,e),s?oe(a.dirtyFields,e):I(a.dirtyFields,e,!0),h.dirtyFields=a.dirtyFields,d=d||(c.dirtyFields||u.dirtyFields)&&l!==!s}if(n){const t=P(a.touchedFields,e);t||(I(a.touchedFields,e,n),h.touchedFields=a.touchedFields,d=d||(c.touchedFields||u.touchedFields)&&t!==n)}d&&o&&m.state.next(h)}return d?h:{}},y=async e=>{f(e,!0);const t=await s.resolver(i,s.context,((e,t,s,a)=>{const n={};for(const s of e){const e=P(t,s);e&&I(n,s,e._f)}return{criteriaMode:s,names:[...e],fields:n,shouldUseNativeValidation:a}})(e||d.mount,n,s.criteriaMode,s.shouldUseNativeValidation));return f(e),t},v=async(e,t,n={valid:!0})=>{for(const r in e){const o=e[r];if(o){const{_f:e,...l}=o;if(e){const l=d.array.has(e.name),u=o._f&&we(o._f);u&&c.validatingFields&&f([r],!0);const m=await Fe(o,d.disabled,i,h,s.shouldUseNativeValidation&&!t,l);if(u&&c.validatingFields&&f([r]),m[e.name]&&(n.valid=!1,t))break;!t&&(P(m,e.name)?l?Ne(a.errors,m,e.name):I(a.errors,e.name,m[e.name]):oe(a.errors,e.name))}!ee(l)&&await v(l,t,n)}}return n.valid},w=(e,t)=>!s.disabled&&(e&&t&&I(i,e,t),!K(B(),r)),T=(e,t,s)=>H(e,d,{...o.mount?i:O(t)?r:G(e)?{[e]:t}:t},s,t),V=(e,t,s={})=>{const a=P(n,e);let r=t;if(a){const s=a._f;s&&(!s.disabled&&I(i,e,fe(t,s)),r=ae(s.ref)&&k(t)?"":t,ne(s.ref)?[...s.ref.options].forEach(e=>e.selected=r.includes(e.value)):s.refs?x(s.ref)?s.refs.forEach(e=>{e.defaultChecked&&e.disabled||(Array.isArray(r)?e.checked=!!r.find(t=>t===e.value):e.checked=r===e.value||!!r)}):s.refs.forEach(e=>e.checked=e.value===r):te(s.ref)?s.ref.value="":(s.ref.value=r,s.ref.type||m.state.next({name:e,values:A(i)})))}(s.shouldDirty||s.shouldTouch)&&_(e,r,s.shouldTouch,s.shouldDirty,!0),s.shouldValidate&&z(e)},D=(e,t,s)=>{for(const a in t){if(!t.hasOwnProperty(a))return;const r=t[a],i=e+"."+a,o=P(n,i);(d.array.has(e)||j(r)||o&&!o._f)&&!b(r)?D(i,r,s):V(i,r,s)}},M=(e,t,s={})=>{const l=P(n,e),h=d.array.has(e),p=A(t);I(i,e,p),h?(m.array.next({name:e,values:A(i)}),(c.isDirty||c.dirtyFields||u.isDirty||u.dirtyFields)&&s.shouldDirty&&m.state.next({name:e,dirtyFields:ue(r,i),isDirty:w(e,p)})):!l||l._f||k(p)?V(e,p,s):D(e,p,s),je(e,d)&&m.state.next({...a,name:e}),m.state.next({name:o.mount?e:void 0,values:A(i)})},$=async e=>{o.mount=!0;const r=e.target;let g=r.name,x=!0;const k=P(n,g),w=e=>{x=Number.isNaN(e)||b(e)&&isNaN(e.getTime())||K(e,P(i,g,e))},j=be(s.mode),S=be(s.reValidateMode);if(k){let o,b;const T=r.type?ye(k._f):C(e),O=e.type===Z||"focusout"===e.type,F=!((N=k._f).mount&&(N.required||N.min||N.max||N.maxLength||N.minLength||N.pattern||N.validate)||s.resolver||P(a.errors,g)||k._f.deps)||((e,t,s,a,n)=>!n.isOnAll&&(!s&&n.isOnTouch?!(t||e):(s?a.isOnBlur:n.isOnBlur)?!e:!(s?a.isOnChange:n.isOnChange)||e))(O,P(a.touchedFields,g),a.isSubmitted,S,j),V=je(g,d,O);I(i,g,T),O?(k._f.onBlur&&k._f.onBlur(e),t&&t(0)):k._f.onChange&&k._f.onChange(e);const D=_(g,T,O),M=!ee(D)||V;if(!O&&m.state.next({name:g,type:e.type,values:A(i)}),F)return(c.isValid||u.isValid)&&("onBlur"===s.mode?O&&p():O||p()),M&&m.state.next({name:g,...V?{}:D});if(!O&&V&&m.state.next({...a}),s.resolver){const{errors:e}=await y([g]);if(w(T),x){const t=Se(a.errors,n,g),s=Se(e,n,t.name||g);o=s.error,g=s.name,b=ee(e)}}else f([g],!0),o=(await Fe(k,d.disabled,i,h,s.shouldUseNativeValidation))[g],f([g]),w(T),x&&(o?b=!1:(c.isValid||u.isValid)&&(b=await v(n,!0)));x&&(k._f.deps&&z(k._f.deps),((e,n,r,i)=>{const o=P(a.errors,e),d=(c.isValid||u.isValid)&&E(n)&&a.isValid!==n;var h;if(s.delayError&&r?(h=()=>((e,t)=>{I(a.errors,e,t),m.state.next({errors:a.errors})})(e,r),t=e=>{clearTimeout(l),l=setTimeout(h,e)},t(s.delayError)):(clearTimeout(l),t=null,r?I(a.errors,e,r):oe(a.errors,e)),(r?!K(o,r):o)||!ee(i)||d){const t={...i,...d&&E(n)?{isValid:n}:{},errors:a.errors,name:e};a={...a,...t},m.state.next(t)}})(g,b,o,D))}var N},L=(e,t)=>{if(P(a.errors,t)&&e.focus)return e.focus(),1},z=async(e,t={})=>{let r,i;const o=X(e);if(s.resolver){const t=await(async e=>{const{errors:t}=await y(e);if(e)for(const s of e){const e=P(t,s);e?I(a.errors,s,e):oe(a.errors,s)}else a.errors=t;return t})(O(e)?e:o);r=ee(t),i=e?!o.some(e=>P(t,e)):r}else e?(i=(await Promise.all(o.map(async e=>{const t=P(n,e);return await v(t&&t._f?{[e]:t}:t)}))).every(Boolean),(i||a.isValid)&&p()):i=r=await v(n);return m.state.next({...!G(e)||(c.isValid||u.isValid)&&r!==a.isValid?{}:{name:e},...s.resolver||!e?{isValid:r}:{},errors:a.errors}),t.shouldFocus&&!i&&Ce(n,L,e?o:d.mount),i},B=e=>{const t={...o.mount?i:r};return O(e)?t:G(e)?P(t,e):e.map(e=>P(t,e))},U=(e,t)=>({invalid:!!P((t||a).errors,e),isDirty:!!P((t||a).dirtyFields,e),error:P((t||a).errors,e),isValidating:!!P(a.validatingFields,e),isTouched:!!P((t||a).touchedFields,e)}),W=(e,t,s)=>{const r=(P(n,e,{_f:{}})._f||{}).ref,i=P(a.errors,e)||{},{ref:o,message:d,type:l,...c}=i;I(a.errors,e,{...c,...t,ref:r}),m.state.next({name:e,errors:a.errors,isValid:!1}),s&&s.shouldFocus&&r&&r.focus&&r.focus()},q=e=>m.state.subscribe({next:t=>{var s,n,o;s=e.name,n=t.name,o=e.exact,s&&n&&s!==n&&!X(s).some(e=>e&&(o?e===n:e.startsWith(n)||n.startsWith(e)))||!((e,t,s,a)=>{s(e);const{name:n,...r}=e;return ee(r)||Object.keys(r).length>=Object.keys(t).length||Object.keys(r).find(e=>t[e]===(!a||R))})(t,e.formState||c,pe,e.reRenderRoot)||e.callback({values:{...i},...a,...t,defaultValues:r})}}).unsubscribe,Y=(e,t={})=>{for(const o of e?X(e):d.mount)d.mount.delete(o),d.array.delete(o),t.keepValue||(oe(n,o),oe(i,o)),!t.keepError&&oe(a.errors,o),!t.keepDirty&&oe(a.dirtyFields,o),!t.keepTouched&&oe(a.touchedFields,o),!t.keepIsValidating&&oe(a.validatingFields,o),!s.shouldUnregister&&!t.keepDefaultValue&&oe(r,o);m.state.next({values:A(i)}),m.state.next({...a,...t.keepDirty?{isDirty:w()}:{}}),!t.keepIsValid&&p()},J=({disabled:e,name:t})=>{(E(e)&&o.mount||e||d.disabled.has(t))&&(e?d.disabled.add(t):d.disabled.delete(t))},de=(e,t={})=>{let a=P(n,e);const i=E(t.disabled)||E(s.disabled);return I(n,e,{...a||{},_f:{...a&&a._f?a._f:{ref:{name:e}},name:e,mount:!0,...t}}),d.mount.add(e),a?J({disabled:E(t.disabled)?t.disabled:s.disabled,name:e}):g(e,!0,t.value),{...i?{disabled:t.disabled||s.disabled}:{},...s.progressive?{required:!!t.required,min:xe(t.min),max:xe(t.max),minLength:xe(t.minLength),maxLength:xe(t.maxLength),pattern:xe(t.pattern)}:{},name:e,onChange:$,onBlur:$,ref:i=>{if(i){de(e,t),a=P(n,e);const s=O(i.value)&&i.querySelectorAll&&i.querySelectorAll("input,select,textarea")[0]||i,o=(e=>re(e)||x(e))(s),d=a._f.refs||[];if(o?d.find(e=>e===s):s===a._f.ref)return;I(n,e,{_f:{...a._f,...o?{refs:[...d.filter(ie),s,...Array.isArray(P(r,e))?[{}]:[]],ref:{type:s.type,name:e}}:{ref:s}}}),g(e,!1,void 0,s)}else a=P(n,e,{}),a._f&&(a._f.mount=!1),(s.shouldUnregister||t.shouldUnregister)&&(!S(d.array,e)||!o.action)&&d.unMount.add(e)}}},le=()=>s.shouldFocusError&&Ce(n,L,d.mount),ce=(e,t)=>async r=>{let o;r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let l=A(i);if(m.state.next({isSubmitting:!0}),s.resolver){const{errors:e,values:t}=await y();a.errors=e,l=A(t)}else await v(n);if(d.disabled.size)for(const e of d.disabled)oe(l,e);if(oe(a.errors,"root"),ee(a.errors)){m.state.next({errors:{}});try{await e(l,r)}catch(e){o=e}}else t&&await t({...a.errors},r),le(),setTimeout(le);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ee(a.errors)&&!o,submitCount:a.submitCount+1,errors:a.errors}),o)throw o},me=(e,t={})=>{const l=e?A(e):r,u=A(l),h=ee(e),p=h?r:u;if(t.keepDefaultValues||(r=l),!t.keepValues){if(t.keepDirtyValues){const e=new Set([...d.mount,...Object.keys(ue(r,i))]);for(const t of Array.from(e))P(a.dirtyFields,t)?I(p,t,P(i,t)):M(t,P(p,t))}else{if(N&&O(e))for(const e of d.mount){const t=P(n,e);if(t&&t._f){const e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(ae(e)){const t=e.closest("form");if(t){t.reset();break}}}}if(t.keepFieldsRef)for(const e of d.mount)M(e,P(p,e));else n={}}i=s.shouldUnregister?t.keepDefaultValues?A(r):{}:A(p),m.array.next({values:{...p}}),m.state.next({values:{...p}})}d={mount:t.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!c.isValid||!!t.keepIsValid||!!t.keepDirtyValues,o.watch=!!s.shouldUnregister,m.state.next({submitCount:t.keepSubmitCount?a.submitCount:0,isDirty:!h&&(t.keepDirty?a.isDirty:!(!t.keepDefaultValues||K(e,r))),isSubmitted:!!t.keepIsSubmitted&&a.isSubmitted,dirtyFields:h?{}:t.keepDirtyValues?t.keepDefaultValues&&i?ue(r,i):a.dirtyFields:t.keepDefaultValues&&e?ue(r,e):t.keepDirty?a.dirtyFields:{},touchedFields:t.keepTouched?a.touchedFields:{},errors:t.keepErrors?a.errors:{},isSubmitSuccessful:!!t.keepIsSubmitSuccessful&&a.isSubmitSuccessful,isSubmitting:!1})},he=(e,t)=>me(se(e)?e(i):e,t),pe=e=>{a={...a,...e}},ge={control:{register:de,unregister:Y,getFieldState:U,handleSubmit:ce,setError:W,_subscribe:q,_runSchema:y,_focusError:le,_getWatch:T,_getDirty:w,_setValid:p,_setFieldArray:(e,t=[],d,l,h=!0,p=!0)=>{if(l&&d&&!s.disabled){if(o.action=!0,p&&Array.isArray(P(n,e))){const t=d(P(n,e),l.argA,l.argB);h&&I(n,e,t)}if(p&&Array.isArray(P(a.errors,e))){const t=d(P(a.errors,e),l.argA,l.argB);h&&I(a.errors,e,t),((e,t)=>{!F(P(e,t)).length&&oe(e,t)})(a.errors,e)}if((c.touchedFields||u.touchedFields)&&p&&Array.isArray(P(a.touchedFields,e))){const t=d(P(a.touchedFields,e),l.argA,l.argB);h&&I(a.touchedFields,e,t)}(c.dirtyFields||u.dirtyFields)&&(a.dirtyFields=ue(r,i)),m.state.next({name:e,isDirty:w(e,t),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else I(i,e,t)},_setDisabledField:J,_setErrors:e=>{a.errors=e,m.state.next({errors:a.errors,isValid:!1})},_getFieldArray:e=>F(P(o.mount?i:r,e,s.shouldUnregister?P(r,e,[]):[])),_reset:me,_resetDefaultValues:()=>se(s.defaultValues)&&s.defaultValues().then(e=>{he(e,s.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:()=>{for(const e of d.unMount){const t=P(n,e);t&&(t._f.refs?t._f.refs.every(e=>!ie(e)):!ie(t._f.ref))&&Y(e)}d.unMount=new Set},_disableForm:e=>{E(e)&&(m.state.next({disabled:e}),Ce(n,(t,s)=>{const a=P(n,s);a&&(t.disabled=a._f.disabled||e,Array.isArray(a._f.refs)&&a._f.refs.forEach(t=>{t.disabled=a._f.disabled||e}))},0,!1))},_subjects:m,_proxyFormState:c,get _fields(){return n},get _formValues(){return i},get _state(){return o},set _state(e){o=e},get _defaultValues(){return r},get _names(){return d},set _names(e){d=e},get _formState(){return a},get _options(){return s},set _options(e){s={...s,...e}}},subscribe:e=>(o.mount=!0,u={...u,...e.formState},q({...e,formState:u})),trigger:z,register:de,handleSubmit:ce,watch:(e,t)=>se(e)?m.state.subscribe({next:s=>"values"in s&&e(T(void 0,t),s)}):T(e,t,!0),setValue:M,getValues:B,reset:he,resetField:(e,t={})=>{P(n,e)&&(O(t.defaultValue)?M(e,A(P(r,e))):(M(e,t.defaultValue),I(r,e,A(t.defaultValue))),t.keepTouched||oe(a.touchedFields,e),t.keepDirty||(oe(a.dirtyFields,e),a.isDirty=t.defaultValue?w(e,A(P(r,e))):w()),t.keepError||(oe(a.errors,e),c.isValid&&p()),m.state.next({...a}))},clearErrors:e=>{e&&X(e).forEach(e=>oe(a.errors,e)),m.state.next({errors:e?a.errors:{}})},unregister:Y,setError:W,setFocus:(e,t={})=>{const s=P(n,e),a=s&&s._f;if(a){const e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&se(e.select)&&e.select())}},getFieldState:U};return{...ge,formControl:ge}}function Ee(e={}){const t=v.useRef(void 0),s=v.useRef(void 0),[a,n]=v.useState({isDirty:!1,isValidating:!1,isLoading:se(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:se(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:a},e.defaultValues&&!se(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...n}=Pe(e);t.current={...n,formState:a}}const r=t.current.control;return r._options=e,W(()=>{const e=r._subscribe({formState:r._proxyFormState,callback:()=>n({...r._formState}),reRenderRoot:!0});return n(e=>({...e,isReady:!0})),r._formState.isReady=!0,e},[r]),v.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),v.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),v.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),v.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),v.useEffect(()=>{if(r._proxyFormState.isDirty){const e=r._getDirty();e!==a.isDirty&&r._subjects.state.next({isDirty:e})}},[r,a.isDirty]),v.useEffect(()=>{e.values&&!K(e.values,s.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),s.current=e.values,n(e=>({...e}))):r._resetDefaultValues()},[r,e.values]),v.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),t.current.formState=U(a,r),t.current}const Ie=window.wp.primitives,Ze=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z"})});var De,Me;!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(_x){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(De||(De={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(Me||(Me={}));const Re=De.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$e=e=>{switch(typeof e){case"undefined":return Re.undefined;case"string":return Re.string;case"number":return Number.isNaN(e)?Re.nan:Re.number;case"boolean":return Re.boolean;case"function":return Re.function;case"bigint":return Re.bigint;case"symbol":return Re.symbol;case"object":return Array.isArray(e)?Re.array:null===e?Re.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Re.promise:"undefined"!=typeof Map&&e instanceof Map?Re.map:"undefined"!=typeof Set&&e instanceof Set?Re.set:"undefined"!=typeof Date&&e instanceof Date?Re.date:Re.object;default:return Re.unknown}},Le=De.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ze extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof ze))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,De.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)if(a.path.length>0){const s=a.path[0];t[s]=t[s]||[],t[s].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}ze.create=e=>new ze(e);const Be=(e,t)=>{let s;switch(e.code){case Le.invalid_type:s=e.received===Re.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Le.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,De.jsonStringifyReplacer)}`;break;case Le.unrecognized_keys:s=`Unrecognized key(s) in object: ${De.joinValues(e.keys,", ")}`;break;case Le.invalid_union:s="Invalid input";break;case Le.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${De.joinValues(e.options)}`;break;case Le.invalid_enum_value:s=`Invalid enum value. Expected ${De.joinValues(e.options)}, received '${e.received}'`;break;case Le.invalid_arguments:s="Invalid function arguments";break;case Le.invalid_return_type:s="Invalid function return type";break;case Le.invalid_date:s="Invalid date";break;case Le.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:De.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Le.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Le.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Le.custom:s="Invalid input";break;case Le.invalid_intersection_types:s="Intersection results could not be merged";break;case Le.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case Le.not_finite:s="Number must be finite";break;default:s=t.defaultError,De.assertNever(e)}return{message:s}};let Ue=Be;var We;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(We||(We={}));function Ge(e,t){const s=Ue,a=(e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=a.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===Be?void 0:Be].filter(e=>!!e)});e.common.issues.push(a)}class He{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return qe;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return He.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return qe;if("aborted"===n.status)return qe;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const qe=Object.freeze({status:"aborted"}),Ke=e=>({status:"dirty",value:e}),Ye=e=>({status:"valid",value:e}),Je=e=>"aborted"===e.status,Xe=e=>"dirty"===e.status,Qe=e=>"valid"===e.status,et=e=>"undefined"!=typeof Promise&&e instanceof Promise;class tt{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const st=(e,t)=>{if(Qe(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ze(e.common.issues);return this._error=t,this._error}}};function at(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(t,n)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??n.defaultError}:void 0===n.data?{message:r??a??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:r??s??n.defaultError}},description:n}}class nt{get description(){return this._def.description}_getType(e){return $e(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$e(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new He,ctx:{common:e.parent.common,data:e.data,parsedType:$e(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(et(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$e(e)},a=this._parseSync({data:e,path:s.path,parent:s});return st(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$e(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return Qe(s)?{value:s.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Qe(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$e(e)},a=this._parse({data:e,path:s.path,parent:s}),n=await(et(a)?a:Promise.resolve(a));return st(s,n)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const n=e(t),r=()=>a.addIssue({code:Le.custom,...s(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(r(),!1)):!!n||(r(),!1)})}refinement(e,t){return this._refinement((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1))}_refinement(e){return new ss({schema:this,typeName:us.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return as.create(this,this._def)}nullable(){return ns.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lt.create(this)}promise(){return ts.create(this,this._def)}or(e){return Ut.create([this,e],this._def)}and(e){return Gt.create(this,e,this._def)}transform(e){return new ss({...at(this._def),schema:this,typeName:us.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new rs({...at(this._def),innerType:this,defaultValue:t,typeName:us.ZodDefault})}brand(){return new ds({typeName:us.ZodBranded,type:this,...at(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new is({...at(this._def),innerType:this,catchValue:t,typeName:us.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ls.create(this,e)}readonly(){return cs.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const rt=/^c[^\s-]{8,}$/i,it=/^[0-9a-z]+$/,ot=/^[0-9A-HJKMNP-TV-Z]{26}$/i,dt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,lt=/^[a-z0-9_-]{21}$/i,ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ut=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,mt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ht;const pt=/^(?:(?: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])$/,ft=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,gt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,_t=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,yt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xt="((\\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])))",bt=new RegExp(`^${xt}$`);function kt(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function wt(e){return new RegExp(`^${kt(e)}$`)}function jt(e){let t=`${xt}T${kt(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function Ct(e,t){return!("v4"!==t&&t||!pt.test(e))||!("v6"!==t&&t||!gt.test(e))}function St(e,t){if(!ct.test(e))return!1;try{const[s]=e.split(".");if(!s)return!1;const a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return!("object"!=typeof n||null===n||"typ"in n&&"JWT"!==n?.typ||!n.alg||t&&n.alg!==t)}catch{return!1}}function Nt(e,t){return!("v4"!==t&&t||!ft.test(e))||!("v6"!==t&&t||!_t.test(e))}class At extends nt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Re.string){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.string,received:t.parsedType}),qe}const t=new He;let s;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const n=e.data.length>a.value,r=e.data.length<a.value;(n||r)&&(s=this._getOrReturnCtx(e,s),n?Ge(s,{code:Le.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):r&&Ge(s,{code:Le.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)mt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"email",code:Le.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)ht||(ht=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ht.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"emoji",code:Le.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)dt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"uuid",code:Le.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)lt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"nanoid",code:Le.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)rt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"cuid",code:Le.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)it.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"cuid2",code:Le.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)ot.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"ulid",code:Le.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Ge(s,{validation:"url",code:Le.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"regex",code:Le.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?jt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?bt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?wt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?ut.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"duration",code:Le.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?Ct(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"ip",code:Le.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?St(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"jwt",code:Le.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?Nt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"cidr",code:Le.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?yt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"base64",code:Le.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?vt.test(e.data)||(s=this._getOrReturnCtx(e,s),Ge(s,{validation:"base64url",code:Le.invalid_string,message:a.message}),t.dirty()):De.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement(t=>e.test(t),{validation:t,code:Le.invalid_string,...We.errToObj(s)})}_addCheck(e){return new At({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...We.errToObj(e)})}url(e){return this._addCheck({kind:"url",...We.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...We.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...We.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...We.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...We.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...We.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...We.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...We.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...We.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...We.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...We.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...We.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...We.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...We.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...We.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...We.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...We.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...We.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...We.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...We.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...We.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...We.errToObj(t)})}nonempty(e){return this.min(1,We.errToObj(e))}trim(){return new At({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new At({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new At({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Tt(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}At.create=e=>new At({checks:[],typeName:us.ZodString,coerce:e?.coerce??!1,...at(e)});class Ot extends nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Re.number){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.number,received:t.parsedType}),qe}let t;const s=new He;for(const a of this._def.checks)"int"===a.kind?De.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):"multipleOf"===a.kind?0!==Tt(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.not_finite,message:a.message}),s.dirty()):De.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,We.toString(t))}gt(e,t){return this.setLimit("min",e,!1,We.toString(t))}lte(e,t){return this.setLimit("max",e,!0,We.toString(t))}lt(e,t){return this.setLimit("max",e,!1,We.toString(t))}setLimit(e,t,s,a){return new Ot({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:We.toString(a)}]})}_addCheck(e){return new Ot({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:We.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:We.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:We.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:We.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:We.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:We.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:We.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:We.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:We.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&De.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Ot.create=e=>new Ot({checks:[],typeName:us.ZodNumber,coerce:e?.coerce||!1,...at(e)});class Ft extends nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Re.bigint)return this._getInvalidInput(e);let t;const s=new He;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ge(t,{code:Le.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):De.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.bigint,received:t.parsedType}),qe}gte(e,t){return this.setLimit("min",e,!0,We.toString(t))}gt(e,t){return this.setLimit("min",e,!1,We.toString(t))}lte(e,t){return this.setLimit("max",e,!0,We.toString(t))}lt(e,t){return this.setLimit("max",e,!1,We.toString(t))}setLimit(e,t,s,a){return new Ft({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:We.toString(a)}]})}_addCheck(e){return new Ft({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:We.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:We.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:We.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:We.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:We.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Ft.create=e=>new Ft({checks:[],typeName:us.ZodBigInt,coerce:e?.coerce??!1,...at(e)});class Vt extends nt{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Re.boolean){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.boolean,received:t.parsedType}),qe}return Ye(e.data)}}Vt.create=e=>new Vt({typeName:us.ZodBoolean,coerce:e?.coerce||!1,...at(e)});class Pt extends nt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Re.date){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.date,received:t.parsedType}),qe}if(Number.isNaN(e.data.getTime()))return Ge(this._getOrReturnCtx(e),{code:Le.invalid_date}),qe;const t=new He;let s;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),Ge(s,{code:Le.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):De.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Pt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:We.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:We.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Pt.create=e=>new Pt({checks:[],coerce:e?.coerce||!1,typeName:us.ZodDate,...at(e)});class Et extends nt{_parse(e){if(this._getType(e)!==Re.symbol){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.symbol,received:t.parsedType}),qe}return Ye(e.data)}}Et.create=e=>new Et({typeName:us.ZodSymbol,...at(e)});class It extends nt{_parse(e){if(this._getType(e)!==Re.undefined){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.undefined,received:t.parsedType}),qe}return Ye(e.data)}}It.create=e=>new It({typeName:us.ZodUndefined,...at(e)});class Zt extends nt{_parse(e){if(this._getType(e)!==Re.null){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.null,received:t.parsedType}),qe}return Ye(e.data)}}Zt.create=e=>new Zt({typeName:us.ZodNull,...at(e)});class Dt extends nt{constructor(){super(...arguments),this._any=!0}_parse(e){return Ye(e.data)}}Dt.create=e=>new Dt({typeName:us.ZodAny,...at(e)});class Mt extends nt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ye(e.data)}}Mt.create=e=>new Mt({typeName:us.ZodUnknown,...at(e)});class Rt extends nt{_parse(e){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.never,received:t.parsedType}),qe}}Rt.create=e=>new Rt({typeName:us.ZodNever,...at(e)});class $t extends nt{_parse(e){if(this._getType(e)!==Re.undefined){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.void,received:t.parsedType}),qe}return Ye(e.data)}}$t.create=e=>new $t({typeName:us.ZodVoid,...at(e)});class Lt extends nt{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),a=this._def;if(t.parsedType!==Re.array)return Ge(t,{code:Le.invalid_type,expected:Re.array,received:t.parsedType}),qe;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(Ge(t,{code:e?Le.too_big:Le.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),s.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Ge(t,{code:Le.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),s.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Ge(t,{code:Le.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((e,s)=>a.type._parseAsync(new tt(t,e,t.path,s)))).then(e=>He.mergeArray(s,e));const n=[...t.data].map((e,s)=>a.type._parseSync(new tt(t,e,t.path,s)));return He.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new Lt({...this._def,minLength:{value:e,message:We.toString(t)}})}max(e,t){return new Lt({...this._def,maxLength:{value:e,message:We.toString(t)}})}length(e,t){return new Lt({...this._def,exactLength:{value:e,message:We.toString(t)}})}nonempty(e){return this.min(1,e)}}function zt(e){if(e instanceof Bt){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=as.create(zt(a))}return new Bt({...e._def,shape:()=>t})}return e instanceof Lt?new Lt({...e._def,type:zt(e.element)}):e instanceof as?as.create(zt(e.unwrap())):e instanceof ns?ns.create(zt(e.unwrap())):e instanceof Ht?Ht.create(e.items.map(e=>zt(e))):e}Lt.create=(e,t)=>new Lt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:us.ZodArray,...at(t)});class Bt extends nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=De.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Re.object){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.object,received:t.parsedType}),qe}const{status:t,ctx:s}=this._processInputParams(e),{shape:a,keys:n}=this._getCached(),r=[];if(!(this._def.catchall instanceof Rt&&"strip"===this._def.unknownKeys))for(const e in s.data)n.includes(e)||r.push(e);const i=[];for(const e of n){const t=a[e],n=s.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new tt(s,n,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof Rt){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of r)i.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)r.length>0&&(Ge(s,{code:Le.unrecognized_keys,keys:r}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of r){const a=s.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new tt(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>He.mergeObjectSync(t,e)):He.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return We.errToObj,new Bt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return"unrecognized_keys"===t.code?{message:We.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Bt({...this._def,unknownKeys:"strip"})}passthrough(){return new Bt({...this._def,unknownKeys:"passthrough"})}extend(e){return new Bt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Bt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:us.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Bt({...this._def,catchall:e})}pick(e){const t={};for(const s of De.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new Bt({...this._def,shape:()=>t})}omit(e){const t={};for(const s of De.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new Bt({...this._def,shape:()=>t})}deepPartial(){return zt(this)}partial(e){const t={};for(const s of De.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?t[s]=a:t[s]=a.optional()}return new Bt({...this._def,shape:()=>t})}required(e){const t={};for(const s of De.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof as;)e=e._def.innerType;t[s]=e}return new Bt({...this._def,shape:()=>t})}keyof(){return Xt(De.objectKeys(this.shape))}}Bt.create=(e,t)=>new Bt({shape:()=>e,unknownKeys:"strip",catchall:Rt.create(),typeName:us.ZodObject,...at(t)}),Bt.strictCreate=(e,t)=>new Bt({shape:()=>e,unknownKeys:"strict",catchall:Rt.create(),typeName:us.ZodObject,...at(t)}),Bt.lazycreate=(e,t)=>new Bt({shape:e,unknownKeys:"strip",catchall:Rt.create(),typeName:us.ZodObject,...at(t)});class Ut extends nt{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map(async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map(e=>new ze(e.ctx.common.issues));return Ge(t,{code:Le.invalid_union,unionErrors:s}),qe});{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map(e=>new ze(e));return Ge(t,{code:Le.invalid_union,unionErrors:n}),qe}}get options(){return this._def.options}}function Wt(e,t){const s=$e(e),a=$e(t);if(e===t)return{valid:!0,data:e};if(s===Re.object&&a===Re.object){const s=De.objectKeys(t),a=De.objectKeys(e).filter(e=>-1!==s.indexOf(e)),n={...e,...t};for(const s of a){const a=Wt(e[s],t[s]);if(!a.valid)return{valid:!1};n[s]=a.data}return{valid:!0,data:n}}if(s===Re.array&&a===Re.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a<e.length;a++){const n=Wt(e[a],t[a]);if(!n.valid)return{valid:!1};s.push(n.data)}return{valid:!0,data:s}}return s===Re.date&&a===Re.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}Ut.create=(e,t)=>new Ut({options:e,typeName:us.ZodUnion,...at(t)});class Gt extends nt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(Je(e)||Je(a))return qe;const n=Wt(e.value,a.value);return n.valid?((Xe(e)||Xe(a))&&t.dirty(),{status:t.value,value:n.data}):(Ge(s,{code:Le.invalid_intersection_types}),qe)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Gt.create=(e,t,s)=>new Gt({left:e,right:t,typeName:us.ZodIntersection,...at(s)});class Ht extends nt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Re.array)return Ge(s,{code:Le.invalid_type,expected:Re.array,received:s.parsedType}),qe;if(s.data.length<this._def.items.length)return Ge(s,{code:Le.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),qe;!this._def.rest&&s.data.length>this._def.items.length&&(Ge(s,{code:Le.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new tt(s,e,s.path,t)):null}).filter(e=>!!e);return s.common.async?Promise.all(a).then(e=>He.mergeArray(t,e)):He.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new Ht({...this._def,rest:e})}}Ht.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ht({items:e,typeName:us.ZodTuple,rest:null,...at(t)})};class qt extends nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Re.map)return Ge(s,{code:Le.invalid_type,expected:Re.map,received:s.parsedType}),qe;const a=this._def.keyType,n=this._def.valueType,r=[...s.data.entries()].map(([e,t],r)=>({key:a._parse(new tt(s,e,s.path,[r,"key"])),value:n._parse(new tt(s,t,s.path,[r,"value"]))}));if(s.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const s of r){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return qe;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const s of r){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return qe;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}qt.create=(e,t,s)=>new qt({valueType:t,keyType:e,typeName:us.ZodMap,...at(s)});class Kt extends nt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==Re.set)return Ge(s,{code:Le.invalid_type,expected:Re.set,received:s.parsedType}),qe;const a=this._def;null!==a.minSize&&s.data.size<a.minSize.value&&(Ge(s,{code:Le.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&s.data.size>a.maxSize.value&&(Ge(s,{code:Le.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function r(e){const s=new Set;for(const a of e){if("aborted"===a.status)return qe;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const i=[...s.data.values()].map((e,t)=>n._parse(new tt(s,e,s.path,t)));return s.common.async?Promise.all(i).then(e=>r(e)):r(i)}min(e,t){return new Kt({...this._def,minSize:{value:e,message:We.toString(t)}})}max(e,t){return new Kt({...this._def,maxSize:{value:e,message:We.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Kt.create=(e,t)=>new Kt({valueType:e,minSize:null,maxSize:null,typeName:us.ZodSet,...at(t)});class Yt extends nt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Yt.create=(e,t)=>new Yt({getter:e,typeName:us.ZodLazy,...at(t)});class Jt extends nt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ge(t,{received:t.data,code:Le.invalid_literal,expected:this._def.value}),qe}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Xt(e,t){return new Qt({values:e,typeName:us.ZodEnum,...at(t)})}Jt.create=(e,t)=>new Jt({value:e,typeName:us.ZodLiteral,...at(t)});class Qt extends nt{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return Ge(t,{expected:De.joinValues(s),received:t.parsedType,code:Le.invalid_type}),qe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return Ge(t,{received:t.data,code:Le.invalid_enum_value,options:s}),qe}return Ye(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Qt.create(e,{...this._def,...t})}exclude(e,t=this._def){return Qt.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Qt.create=Xt;class es extends nt{_parse(e){const t=De.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Re.string&&s.parsedType!==Re.number){const e=De.objectValues(t);return Ge(s,{expected:De.joinValues(e),received:s.parsedType,code:Le.invalid_type}),qe}if(this._cache||(this._cache=new Set(De.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=De.objectValues(t);return Ge(s,{received:s.data,code:Le.invalid_enum_value,options:e}),qe}return Ye(e.data)}get enum(){return this._def.values}}es.create=(e,t)=>new es({values:e,typeName:us.ZodNativeEnum,...at(t)});class ts extends nt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Re.promise&&!1===t.common.async)return Ge(t,{code:Le.invalid_type,expected:Re.promise,received:t.parsedType}),qe;const s=t.parsedType===Re.promise?t.data:Promise.resolve(t.data);return Ye(s.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ts.create=(e,t)=>new ts({type:e,typeName:us.ZodPromise,...at(t)});class ss extends nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===us.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:e=>{Ge(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===a.type){const e=a.transform(s.data,n);if(s.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return qe;const a=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===a.status?qe:"dirty"===a.status||"dirty"===t.value?Ke(a.value):a});{if("aborted"===t.value)return qe;const a=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===a.status?qe:"dirty"===a.status||"dirty"===t.value?Ke(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,n);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const a=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===a.status?qe:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(s=>"aborted"===s.status?qe:("dirty"===s.status&&t.dirty(),e(s.value).then(()=>({status:t.value,value:s.value}))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Qe(e))return qe;const r=a.transform(e.value,n);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(e=>Qe(e)?Promise.resolve(a.transform(e.value,n)).then(e=>({status:t.value,value:e})):qe)}De.assertNever(a)}}ss.create=(e,t,s)=>new ss({schema:e,typeName:us.ZodEffects,effect:t,...at(s)}),ss.createWithPreprocess=(e,t,s)=>new ss({schema:t,effect:{type:"preprocess",transform:e},typeName:us.ZodEffects,...at(s)});class as extends nt{_parse(e){return this._getType(e)===Re.undefined?Ye(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}as.create=(e,t)=>new as({innerType:e,typeName:us.ZodOptional,...at(t)});class ns extends nt{_parse(e){return this._getType(e)===Re.null?Ye(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ns.create=(e,t)=>new ns({innerType:e,typeName:us.ZodNullable,...at(t)});class rs extends nt{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===Re.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}rs.create=(e,t)=>new rs({innerType:e,typeName:us.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...at(t)});class is extends nt{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return et(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ze(s.common.issues)},input:s.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new ze(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}is.create=(e,t)=>new is({innerType:e,typeName:us.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...at(t)});class os extends nt{_parse(e){if(this._getType(e)!==Re.nan){const t=this._getOrReturnCtx(e);return Ge(t,{code:Le.invalid_type,expected:Re.nan,received:t.parsedType}),qe}return{status:"valid",value:e.data}}}os.create=e=>new os({typeName:us.ZodNaN,...at(e)}),Symbol("zod_brand");class ds extends nt{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class ls extends nt{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?qe:"dirty"===e.status?(t.dirty(),Ke(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?qe:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new ls({in:e,out:t,typeName:us.ZodPipeline})}}class cs extends nt{_parse(e){const t=this._def.innerType._parse(e),s=e=>(Qe(e)&&(e.value=Object.freeze(e.value)),e);return et(t)?t.then(e=>s(e)):s(t)}unwrap(){return this._def.innerType}}var us;cs.create=(e,t)=>new cs({innerType:e,typeName:us.ZodReadonly,...at(t)}),Bt.lazycreate,function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(us||(us={}));const ms=At.create,hs=(Ot.create,os.create,Ft.create,Vt.create),ps=(Pt.create,Et.create,It.create,Zt.create,Dt.create),fs=(Mt.create,Rt.create,$t.create,Lt.create),gs=Bt.create,_s=(Bt.strictCreate,Ut.create,Gt.create,Ht.create,qt.create,Kt.create,Yt.create,Jt.create,Qt.create,es.create,ts.create,ss.create,as.create,ns.create,ss.createWithPreprocess,ls.create,(e,t,s)=>{if(e&&"reportValidity"in e){const a=P(s,t);e.setCustomValidity(a&&a.message||""),e.reportValidity()}}),ys=(e,t)=>{for(const s in t.fields){const a=t.fields[s];a&&a.ref&&"reportValidity"in a.ref?_s(a.ref,s,e):a&&a.refs&&a.refs.forEach(t=>_s(t,s,e))}},vs=(e,t)=>{t.shouldUseNativeValidation&&ys(e,t);const s={};for(const a in e){const n=P(t.fields,a),r=Object.assign(e[a]||{},{ref:n&&n.ref});if(xs(t.names||Object.keys(e),a)){const e=Object.assign({},P(s,a));I(e,"root",r),I(s,a,e)}else I(s,a,r)}return s},xs=(e,t)=>{const s=bs(t);return e.some(e=>bs(e).match(`^${s}\\.\\d+`))};function bs(e){return e.replace(/\]|\[/g,"")}function ks(e,t){for(var s={};e.length;){var a=e[0],n=a.code,r=a.message,i=a.path.join(".");if(!s[i])if("unionErrors"in a){var o=a.unionErrors[0].errors[0];s[i]={message:o.message,type:o.code}}else s[i]={message:r,type:n};if("unionErrors"in a&&a.unionErrors.forEach(function(t){return t.errors.forEach(function(t){return e.push(t)})}),t){var d=s[i].types,l=d&&d[a.code];s[i]=J(i,t,s,n,l?[].concat(l,a.message):a.message)}e.shift()}return s}function ws(e,t,s){return void 0===s&&(s={}),function(a,n,r){try{return Promise.resolve(function(n,i){try{var o=Promise.resolve(e["sync"===s.mode?"parse":"parseAsync"](a,t)).then(function(e){return r.shouldUseNativeValidation&&ys({},r),{errors:{},values:s.raw?Object.assign({},a):e}})}catch(e){return i(e)}return o&&o.then?o.then(void 0,i):o}(0,function(e){if(function(e){return Array.isArray(null==e?void 0:e.errors)}(e))return{values:{},errors:vs(ks(e.errors,!r.shouldUseNativeValidation&&"all"===r.criteriaMode),r)};throw e}))}catch(e){return Promise.reject(e)}}}const js=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})}),Cs=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})});var Ss=s(500),Ns=s.n(Ss);const As=(0,n.createContext)(null),Ts=({children:e})=>{const[t,s]=(0,n.useState)([]),a=(0,n.useCallback)((e,a="success")=>{const n=Date.now();s([...t,{id:n,message:e,type:a}]),setTimeout(()=>{r(n)},3e3)},[s,t]),r=e=>{s(t=>t.filter(t=>t.id!==e))},i={addToast:a,toasts:t};return(0,o.jsxs)(As.Provider,{value:i,children:[(0,o.jsx)("div",{className:"absolute w-full top-0 flex-row flex-row justify-center",style:{zIndex:100001},children:(0,o.jsx)("div",{className:"flex-col",children:t.map(e=>(0,o.jsxs)("div",{className:Ns()("mt-1 px-2 py-1 rounded-sm text-center text-white p-2 rounded-md flex-row items-center gap-x-1",{"bg-green-light":"success"===e.type,"bg-red-light":"error"===e.type}),children:["success"===e.type&&(0,o.jsx)(_.Icon,{icon:js,className:"fill-green"}),"error"===e.type&&(0,o.jsx)(_.Icon,{icon:Cs,className:"fill-red"}),(0,o.jsx)("span",{className:Ns()({"text-green":"success"===e.type,"text-red":"error"===e.type}),children:e.message})]},e.id))})}),e]})},Os=[{key:"fb",name:"Facebook",regex_error_message:"Pixel IDs must only contain numbers"},{key:"ga4",name:"Google Analytics 4",regex_error_message:"Pixel IDs format is like G-H34Y45Y4"},{key:"google",name:"Google Ads",regex_error_message:"Pixel IDs format is like AW-857837465656/h3fawt68rjk"},{key:"google-merchant",name:"Google Merchant"},{key:"linkedin",name:"LinkedIn",regex_error_message:"Pixel IDs format is like 345345"},{key:"microsoftads",name:"Microsoft Ads",regex_error_message:"Pixel IDs format is like 345345"},{key:"pinterest",name:"Pinterest",regex_error_message:"Pixel IDs format is TAG_ID|ADVERTISER_ID Ex:2612489213258|549766677910"},{key:"postback",name:"Postback",regex_error_message:"Pixel IDs format is like 345345"},{key:"quora",name:"Quora",regex_error_message:"Pixel IDs format is ACCOUNT_ID|PIXEL_ID Ex:123456|78980fef424"},{key:"snapchat",name:"Snapchat",regex_error_message:"Pixel IDs format is like 867f406d-330d-49d7-8425-21434f5c778c"},{key:"tiktok",name:"TikTok",regex_error_message:"Pixel IDs must only contain alphabetical and numerical characters"}],Fs=[{key:"AddPaymentInfo",name:"Add payment info"},{key:"AddToCart",name:"Add to cart"},{key:"AddToWishlist",name:"Add to wishlist"},{key:"CompleteRegistration",name:"Complete registration"},{key:"Contact",name:"Contact"},{key:"CustomizeProduct",name:"Customize product"},{key:"Donate",name:"Donate"},{key:"FindLocation",name:"Find location"},{key:"InitiateCheckout",name:"Initiate checkout"},{key:"Lead",name:"Lead"},{key:"PageView",name:"Page view"},{key:"Purchase",name:"Purchase"},{key:"Schedule",name:"Schedule"},{key:"Search",name:"Search"},{key:"StartTrial",name:"Start trial"},{key:"SubmitApplication",name:"Submit application"},{key:"Subscribe",name:"Subscribe"},{key:"ViewContent",name:"View content"},{key:"customEvent",name:"Custom event"}],Vs=["PageView"],Ps=({onClose:e,editingPixel:t})=>{var s,a,r,i,l;const{addPixel:c,modifyPixel:u,isRefreshing:h,isUpdating:f,oneTagDashboardUrl:y}=(0,n.useContext)(d),{settings:v}=(0,n.useContext)(m),{updateOtCustomerPixel:x,isUpdating:b}=(0,n.useContext)(p),{addToast:k}=(0,n.useContext)(As),w=(0,n.useMemo)(()=>Fs.filter(e=>{var t;return(null!==(t=v?.available_events)&&void 0!==t?t:[]).includes(e.key)}),[v]),j=(0,n.useMemo)(()=>!!t,[t]),C=(0,n.useMemo)(()=>gs({id:ms().min(5,(0,g.__)("This field is required and min characters are 5.","adsmurai-one-tag")),name:ms(),type:ps(),access_token:ms(),events:fs(hs()).refine(e=>0===e.length||e.some(e=>!0===e),{message:(0,g.__)("At least one event type must be selected.","adsmurai-one-tag")})}),[]),{control:S,handleSubmit:N,setValue:A,getValues:T,trigger:O,formState:{errors:F,isSubmitting:V}}=Ee({defaultValues:{id:null!==(s=t?.id)&&void 0!==s?s:"",type:null!==(a=t?.type)&&void 0!==a?a:Os[0].key,name:null!==(r=t?.name)&&void 0!==r?r:"",access_token:null!==(i=t?.access_token)&&void 0!==i?i:"",events:w.map(e=>t?t.events.includes(e.key):w.includes(e.key))},mode:"onSubmit",resolver:ws(C)}),P=T(),E=Object.keys(F).length>0,I=(0,n.useCallback)(async s=>{const a=s.events.map((e,t)=>e?w[t]?.key:null).filter(e=>!!e),n={...s,events:a};if(j)await u(t.id,n);else{const e=await x({pixelId:s.id,accessToken:s.access_token,name:s.name,type:s.type});if(e)return void k(e,"error");await c(n)}e()},[e,c,u,t,j,x,w,k]),Z=(0,n.useCallback)(async e=>{A("events",w.map(()=>e)),await O("events")},[A,O,w]),D=(0,n.useMemo)(()=>P.events.filter(e=>e).length===w.length,[P,w]);return(0,o.jsx)(_.Modal,{title:(0,g.__)(j?"Modify Pixel":"Add New Pixel","adsmurai-one-tag"),onRequestClose:e,size:"large",isDismissible:!0,shouldCloseOnClickOutside:!0,children:(0,o.jsxs)("div",{children:[j&&(0,o.jsx)("a",{href:y,target:"_blank",children:(0,o.jsxs)("div",{className:"p-2 bg-blue-light mb-2 flex-row items-center gap-x-1",children:[(0,o.jsx)(_.Icon,{size:24,icon:Ze}),(0,g.__)("Pixel details can be edited on One Tag dashboard.","adsmurai-one-tag")]})}),(0,o.jsxs)("form",{className:"flex-col gap-y-2",onSubmit:N(I),noValidate:!0,children:[(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsxs)("div",{children:[(0,o.jsx)(_.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Pixel ID","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:V||j}),!!F.id?.message&&(0,o.jsx)("div",{className:"pt-1 text-red",children:F.id.message})]}),name:"id",control:S}),(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Pixel Name","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:V||j}),name:"name",control:S}),(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.CustomSelectControl,{name:e.name,label:(0,g.__)("Pixel Type","adsmurai-one-tag"),value:Os.find(t=>t.key===e.value),onChange:t=>e.onChange(t.selectedItem.key),options:Os,disabled:V||j}),name:"type",control:S}),(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.__experimentalInputControl,{name:e.name,type:"text",label:(0,g.__)("Access Token","adsmurai-one-tag"),value:e.value,onChange:e.onChange,disabled:V||j}),name:"access_token",control:S}),w.length>0?(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-row gap-x-2",children:[(0,o.jsx)("div",{className:"input-label mb-1",children:(0,g.__)("Run on the following events","adsmurai-one-tag")}),(0,o.jsx)(_.ToggleControl,{label:(0,g.__)("Check all","adsmurai-one-tag"),checked:D,onChange:e=>{Z(e)},disabled:V})]}),(0,o.jsx)("div",{className:"flex-row flex-wrap gap-x-1 gap-y-1",children:w.map(({key:e,name:t},s)=>(0,o.jsx)("div",{className:"w-5.5 shrink-0",children:(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.ToggleControl,{label:t,checked:e.value,onChange:t=>{e.onChange(t),O("events")},disabled:V}),name:`events.${s}`,control:S})},`event-type-${e}`))}),!!F.events&&(0,o.jsx)("div",{className:"pt-1 text-red",children:null!==(l=F.events.message)&&void 0!==l?l:F.events.root?.message})]}):(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"input-label mb-1",children:(0,g.__)("Run on the following events","adsmurai-one-tag")}),(0,o.jsxs)("div",{children:[(0,o.jsx)(_.Icon,{icon:"warning",size:20})," ",(0,o.jsx)("span",{children:(0,g.__)("No event types available","adsmurai-one-tag")})]})]}),(0,o.jsxs)("div",{className:"flex-row-reverse items-center",children:[(0,o.jsx)(_.Button,{type:"submit",variant:"primary",disabled:V||E||h,children:(0,g.__)(j?"Modify Pixel":"Add Pixel","adsmurai-one-tag")}),(f||b)&&(0,o.jsx)(_.Spinner,{className:"size-2"})]})]})]})})},Es=({show:e,title:t,message:s,options:a,onClose:n})=>e?(0,o.jsxs)(_.Modal,{title:t,onRequestClose:n,size:"small",isDismissible:!0,shouldCloseOnClickOutside:!0,children:[(0,o.jsx)("div",{children:s}),(null!=a?a:[]).length>0?(0,o.jsx)("div",{className:"mt-3 flex-row-reverse gap-x-1",children:a.reverse().map((e,t)=>(0,o.jsxs)(_.Button,{...e.props,children:[e.isLoading&&(0,o.jsx)(_.Spinner,{}),e.label]},`dialog-option-${t}}`))}):null]}):null,Is=()=>{const{oneTagSettings:e,deletePixel:t,isRefreshing:s,isUpdating:a,postSettings:r}=(0,n.useContext)(d),{refresh:i}=(0,n.useContext)(p),{settings:l}=(0,n.useContext)(m),[c,u]=(0,n.useState)(!1),[h,f]=(0,n.useState)(null),[v,x]=(0,n.useState)(null),[b,k]=(0,n.useState)(!1),w=(0,n.useMemo)(()=>{var t;return(null!==(t=e?.pixels)&&void 0!==t?t:[]).length>0},[e]),j=(0,n.useCallback)(async()=>{k(!0);const t=await i(!1);if(t){var s;const i=[];for(const s of e.pixels){var a;const e=(null!==(a=t.pixels)&&void 0!==a?a:[]).find(e=>e.id===s.id);e?i.push({...s,access_token:e.access_token,type:e.type,name:e.name}):i.push(s)}const o=null!==(s=l?.available_events)&&void 0!==s?s:Vs,d=[];for(const e of null!==(n=t?.pixels)&&void 0!==n?n:[]){var n;i.every(t=>t.id!==e.id)&&d.push({id:e.id,access_token:e.access_token,type:e.type,name:e.name,events:o})}await r({...e,pixels:[...i,...d]})}k(!1)},[i,e,l,r,k]);return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-row justify-between items-center",children:[(0,o.jsx)("h1",{className:"text-lg font-bold w-full",children:(0,g.__)("Your Pixels","adsmurai-one-tag")}),w&&(0,o.jsxs)("div",{className:"flex-row-reverse pb-2 gap-x-1",children:[(0,o.jsx)(_.Button,{variant:"secondary",onClick:()=>u(!0),children:(0,g.__)("Add New Pixel","adsmurai-one-tag")}),(0,o.jsxs)(_.Button,{variant:"secondary",onClick:()=>j(),disabled:b,children:[b&&(0,o.jsx)(_.Spinner,{}),(0,g.__)("Import from One Tag","adsmurai-one-tag")]})]})]}),(0,o.jsx)(_.Card,{className:"p-2",children:s?(0,o.jsx)(_.Spinner,{className:"size-4"}):w?(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("table",{className:"w-full text-md",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"text-left uppercase",children:[(0,o.jsx)("th",{}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("ID","adsmurai-one-tag")})}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("Name","adsmurai-one-tag")})}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"px-1",children:(0,g.__)("Trigger On","adsmurai-one-tag")})}),(0,o.jsx)("th",{})]})}),(0,o.jsx)("tbody",{children:e.pixels.map(e=>{var t;return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"py-1 pe-1",children:(0,o.jsx)("img",{className:"size-3",src:y[e.type],alt:e.name})})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"px-1",children:e.id})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"px-1",children:null!==(t=e.name)&&void 0!==t?t:"-"})}),(0,o.jsx)("td",{className:"italic",children:(0,o.jsx)("div",{className:"px-1",children:e.events.join(", ")})}),(0,o.jsx)("td",{className:"text-right",children:(0,o.jsxs)("div",{className:"ps-1",style:{minWidth:"5rem"},children:[(0,o.jsx)(_.Button,{icon:"trash",onClick:()=>{x(e)}}),(0,o.jsx)(_.Button,{icon:"edit",onClick:()=>{f(e),u(!0)}})]})})]},`added-pixel-${e.id}`)})})]})}):(0,o.jsxs)(_.Card,{variant:"secondary",className:"py-2 px-2",children:[(0,o.jsxs)("p",{className:"text-lg text-center",children:[(0,o.jsx)(_.Icon,{icon:"warning",size:"20"})," ",(0,g.__)("You don't have any pixels added","adsmurai-one-tag")]}),(0,o.jsx)("div",{className:"mt-3 flex-row justify-center",children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)("div",{children:(0,o.jsx)(_.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>u(!0),children:(0,g.__)("Add Pixels","adsmurai-one-tag")})}),(0,o.jsx)("div",{children:(0,o.jsx)(_.Button,{className:"w-full block",style:{textAlign:"center"},variant:"link",onClick:()=>j(),disabled:b,children:(0,g.__)("Import from One Tag","adsmurai-one-tag")})})]})})]})}),c&&(0,o.jsx)(Ps,{onClose:()=>{u(!1),f(null)},editingPixel:h}),(0,o.jsx)(Es,{show:!!v,title:(0,g.__)("Delete Pixel","adsmurai-one-tag"),message:(0,g.__)("Are you sure to delete this pixel?","adsmurai-one-tag"),onClose:()=>x(null),options:[{props:{onClick:()=>x(null),variant:"secondary"},label:(0,g.__)("Cancel","adsmurai-one-tag")},{props:{onClick:async()=>{await t(v.id),x(null)},variant:"primary",disabled:s||a},isLoading:a,label:(0,g.__)("Delete","adsmurai-one-tag")}]})]})},Zs=(0,n.createContext)(null),Ds=({children:e})=>{const[t,s]=(0,n.useState)([]),[a,r]=(0,n.useState)(!1),i=(0,n.useCallback)(async()=>{try{r(!0);const e=await fetch("/index.php?rest_route=/one-tag/forms",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),t=(await e.json()).map(e=>({...e,id:e.id.toString()}));s(null!=t?t:[])}catch{}finally{r(!1)}},[]);(0,n.useEffect)(()=>{i()},[]);const d={forms:t,isLoading:a};return(0,o.jsx)(Zs.Provider,{value:d,children:e})},Ms=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z"})}),Rs=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z"})}),$s=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})}),Ls=(0,o.jsx)(Ie.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)(Ie.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})}),zs=({className:e,items:t,defaultExpanded:s})=>{const[a,r]=(0,n.useState)(null!=s?s:null);return(0,o.jsx)("div",{className:e,children:t.map((e,t)=>{const s=e.name===a;return(0,o.jsxs)(_.Card,{className:"p-2",children:[(0,o.jsxs)("div",{onClick:()=>r(s?null:e.name),className:"cursor-pointer flex-row items-center justify-between gap-x-1",children:[e.title,s?(0,o.jsx)(_.Icon,{icon:$s,size:28}):(0,o.jsx)(_.Icon,{icon:Ls,size:28})]}),s&&(0,o.jsx)("div",{className:"mt-2",children:e.children})]},`${e.name}_${t}`)})})},Bs=()=>{const{oneTagSettings:e,saveApiToken:t,isRefreshing:s,isUpdating:a}=(0,n.useContext)(d),[r,i]=(0,n.useState)(""),[l,c]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{s||e?.apiToken===r||i(e?.apiToken)},[s]),(0,o.jsx)("div",{className:"mt-4",children:(0,o.jsx)(zs,{defaultExpanded:e.token?null:"token",items:[{name:"token",title:(0,o.jsxs)("div",{className:"flex-row items-center gap-x-2",children:[(0,o.jsx)("span",{className:"text-xl",children:(0,g.__)("One Tag Token","adsmurai-one-tag")}),!!e.apiToken&&(0,o.jsx)(_.Icon,{className:"fill-green",icon:js,size:40})]}),children:(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)(_.__experimentalInputControl,{type:l?"text":"password",label:(0,g.__)("Token","adsmurai-one-tag"),value:r,onChange:i,disabled:a||s,suffix:(0,o.jsx)(_.Button,{onClick:()=>c(!l),icon:l?Ms:Rs})}),(0,o.jsxs)("div",{className:"flex-row-reverse items-center",children:[(0,o.jsx)(_.Button,{variant:"primary",disabled:a||r===e?.token,onClick:()=>t(r),children:(0,g.__)("Set Token","adsmurai-one-tag")}),a&&(0,o.jsx)(_.Spinner,{className:"size-2"})]})]}),(0,o.jsx)(_.Card,{variant:"secondary",className:"mt-2 px-2 py-0.5",children:(0,o.jsxs)("p",{children:[(0,o.jsx)(_.Icon,{icon:"info",size:"20"})," ",(0,g.__)("OneTag token lets this plugin access your configured pixels. Get your token by visiting","adsmurai-one-tag")," ",(0,o.jsx)("a",{href:"https://st.adsmurai.com",target:"_blank",children:(0,g.__)("OneTag dashboard","adsmurai-one-tag")}),"."]})})]})}]})})},Us=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"})}),Ws=[{field:"ph",name:(0,g.__)("Phone Number","adsmurai-one-tag")},{field:"em",name:(0,g.__)("Email","adsmurai-one-tag")},{field:"fn",name:(0,g.__)("First Name","adsmurai-one-tag")},{field:"ln",name:(0,g.__)("Last Name","adsmurai-one-tag")},{field:"db",name:(0,g.__)("Date of Birth","adsmurai-one-tag")},{field:"ge",name:(0,g.__)("Gender","adsmurai-one-tag")},{field:"ct",name:(0,g.__)("City","adsmurai-one-tag")},{field:"st",name:(0,g.__)("State","adsmurai-one-tag")},{field:"zp",name:(0,g.__)("Zip Code","adsmurai-one-tag")},{field:"country",name:(0,g.__)("Country","adsmurai-one-tag")},{field:"tz",name:(0,g.__)("Time Zone","adsmurai-one-tag")},{field:"item_id",name:(0,g.__)("Item ID","adsmurai-one-tag")},{field:"id",name:(0,g.__)("Event ID","adsmurai-one-tag")},{field:"quantity",name:(0,g.__)("Item Number","adsmurai-one-tag")},{field:"item_price",name:(0,g.__)("Price of the Item","adsmurai-one-tag")},{field:"delivery_category",name:(0,g.__)("Type of Delivery","adsmurai-one-tag")},{field:"content_type",name:(0,g.__)("Content Type","adsmurai-one-tag")},{field:"content_id",name:(0,g.__)("Content / Product ID","adsmurai-one-tag")}],Gs=()=>{const{addToast:e}=(0,n.useContext)(As),{forms:t,isLoading:s}=(0,n.useContext)(Zs),{oneTagSettings:a,modifyFieldsMatch:r}=(0,n.useContext)(d),[i,l]=(0,n.useState)([]),[c,u]=(0,n.useState)(null),m=(0,n.useMemo)(()=>{var e;return null!==(e=a?.forms?.find(e=>e.formId===c?.id&&e.plugin===c?.plugin))&&void 0!==e?e:null},[a,c]),h=(0,n.useMemo)(()=>t.map(e=>({key:`${e.id}-${e.plugin}`,name:`[${e.plugin}] ${e.title}`})),[t]),p=(0,n.useMemo)(()=>[{name:(0,g.__)("- Unmapped -","adsmurai-one-tag"),key:null},...i.map(({formField:e,formFieldLabel:t})=>({key:e,name:t===e?t:`${t} (${e})`}))],[i]),f=(0,n.useCallback)((t,s)=>{var a;const n=(null!==(a=m?.matches)&&void 0!==a?a:[]).filter(e=>e.otField!==t&&e.formField!==s),i=Ws.find(e=>e.field===t)?.name;s?(r(c?.id,c?.plugin,[...n,{formField:s,otField:t}]),e((0,g.__)(i+" is assigned to "+s,"adsmurai-one-tag"),"success")):(r(c?.id,c?.plugin,n),e((0,g.__)(i+" is unassigned","adsmurai-one-tag"),"success"))},[r,m,c,e]);return(0,n.useEffect)(()=>{!c&&(null!=t?t:[]).length>0&&u({id:t[0].id,plugin:t[0].plugin});const e=t.find(e=>e.id===c?.id&&e.plugin===c?.plugin);e&&l(e.fields.map(e=>({formField:e.name,formFieldLabel:e.label})))},[c,t,l]),(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Field Matcher","adsmurai-one-tag")}),(0,o.jsx)(_.Card,{className:"p-2",children:s?(0,o.jsx)(_.Spinner,{className:"size-4"}):t.length>0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"mb-3 flex-row-reverse",children:(0,o.jsx)("div",{className:"w-6",children:(0,o.jsx)(_.CustomSelectControl,{label:(0,g.__)("Select Your Form","adsmurai-one-tag"),value:t.find(e=>e.id===c?.id&&e.plugin===c?.plugin),onChange:e=>{const[t,s]=e.selectedItem.key.split("-");u({id:t,plugin:s})},options:h})})}),(0,o.jsxs)("table",{className:"w-full",children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:"text-left",children:[(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"pe-1",children:(0,g.__)("Event Details","adsmurai-one-tag")})}),(0,o.jsx)("th",{}),(0,o.jsx)("th",{children:(0,o.jsx)("div",{className:"ps-1",children:(0,g.__)("Form Field Assignment","adsmurai-one-tag")})})]})}),(0,o.jsx)("tbody",{children:Ws.map(({field:e,name:t},s)=>{var a;const n=m?.matches?.find(t=>t.otField===e),r=null!==(a=p.find(e=>e.key===n?.formField))&&void 0!==a?a:p[0];return(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{className:"border-b border-gray-light",children:(0,o.jsxs)("div",{className:"pe-1 pt-2",children:[t," ",(0,o.jsxs)("span",{className:"font-courier",children:["(",e,")"]})]})}),(0,o.jsx)("td",{className:"w-3",children:(0,o.jsx)("div",{className:"px-1 pt-2",children:(0,o.jsx)(_.Icon,{className:Ns()({"fill-gray-light":!n,"fill-green":n}),icon:Us,size:40})})}),(0,o.jsx)("td",{children:(0,o.jsx)("div",{className:"ps-1 pb-1",children:(0,o.jsx)(_.CustomSelectControl,{options:p,value:r,onChange:t=>f(e,t.selectedItem.key)})})})]},`ot-field-${e}-${t}-${s}`)})})]},`form-fields_${c?.id}_${c?.plugin}`)]}):(0,o.jsx)("div",{children:(0,g.__)("No Forms Detected!","one.tag")})})]})},Hs=()=>{const{isProd:e}=(0,n.useContext)(m),{otCustomer:t,isLoading:s}=(0,n.useContext)(p),a=(0,n.useMemo)(()=>{var e;return(null!==(e=t?.subscriptions)&&void 0!==e?e:[]).length>0},[t]),r=(0,n.useMemo)(()=>t?`${e?i:"https://localhost:3001"}/${t.organization_id}/add_subscription/one-tag`:null,[e]),d=(0,n.useMemo)(()=>t?t.stripe_customer_id?`${e?i:"https://localhost:3001"}/api/stripe/portal?id=${t.stripe_customer_id}&organization_id=${t.organization_id}`:`${e?i:"https://localhost:3001"}/${t.organization_id}/one-tag`:null,[e,t]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Your Subscriptions","adsmurai-one-tag")}),a?(0,o.jsx)("div",{className:"flex flex-row flex-wrap gap-x-2",children:t.subscriptions.map(e=>{const t=["trialing","active"].includes(e.status)&&!1===e.cancelAtPeriodEnd;return(0,o.jsx)(_.Card,{className:"p-2 w-6",children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsxs)("div",{className:"flex-row items-center gap-x-1 mb-2",children:[(0,o.jsx)("strong",{className:"text-lg",children:e.name}),(0,o.jsx)("div",{className:Ns()("px-1 py-0.5",{"text-green bg-green-light":t,"text-red bg-red-light":!t}),children:e.cancelAtPeriodEnd?(0,g.__)("Cancelled","adsmurai-one-tag"):e.status})]}),!!e.description&&(0,o.jsx)("div",{children:e.description}),(0,o.jsxs)("div",{className:"text-gray",children:[(0,o.jsxs)("span",{children:[e.cancelAtPeriodEnd?(0,g.__)("Ends on","adsmurai-one-tag"):(0,g.__)("Renews on","adsmurai-one-tag"),":"]})," ",(0,o.jsx)("span",{children:e.renewsAt})]})]})},e.id)})}):(0,o.jsx)(_.Card,{className:"p-2",children:s?(0,o.jsx)(_.Spinner,{className:"size-4"}):(0,o.jsx)("div",{children:(0,g.__)("No subscriptions found.","adsmurai-one-tag")})}),!s&&(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-end",children:[(0,o.jsx)("a",{href:r,target:"_blank",children:(0,o.jsx)(_.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Add subscription","adsmurai-one-tag")})}),(0,o.jsx)("a",{href:d,target:"_blank",children:(0,o.jsx)(_.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Manage subscriptions","adsmurai-one-tag")})})]})]})},qs=()=>{const{isProd:e,settings:t}=(0,n.useContext)(m),{postSettings:s,isUpdating:a,isRefreshing:r}=(0,n.useContext)(d),[i,l]=(0,n.useState)("main"),c=(0,n.useCallback)(async()=>{const a=await Ys(e);if(a){var n,r,i,o,d;const e=null!==(n=t?.available_events)&&void 0!==n?n:Vs;await s({token:null!==(r=a.token)&&void 0!==r?r:null,apiToken:null!==(i=a.key)&&void 0!==i?i:null,organizationId:null!==(o=a.organization?.id)&&void 0!==o?o:null,pixels:(null!==(d=a.pixels)&&void 0!==d?d:[]).map(t=>({id:t.id,type:t.type,name:t.name,access_token:t.access_token,events:e}))})}},[e,s,t]);return(0,o.jsx)("div",{className:"flex-col justify-center",style:{height:"calc(100vh - 200px)"},children:(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"text-center text-xl",children:(0,g.__)("Time to link your AMP account!","adsmurai-one-tag")}),(0,o.jsx)("div",{className:"text-center text-lg mt-2",children:(0,g.__)("You need an AMP account to use this plugin","adsmurai-one-tag")}),"main"===i&&(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-center",children:[(0,o.jsx)(_.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>l("create_account"),disabled:a||r,children:(0,g.__)("Create Account","adsmurai-one-tag")}),(0,o.jsx)(_.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},onClick:()=>c(),disabled:a||r,children:(0,g.__)("Sign In","adsmurai-one-tag")})]}),"create_account"===i&&(0,o.jsxs)("div",{className:"mt-4 flex-col gap-y-3 justify-center",children:[(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-lg font-bold mb-2",children:(0,g.__)("1. Create an Adsmurai account")}),(0,o.jsx)(_.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},onClick:()=>Ks(),disabled:a||r,children:(0,g.__)("Create Account","adsmurai-one-tag")})]}),(0,o.jsxs)("div",{className:"text-center",children:[(0,o.jsx)("div",{className:"text-lg font-bold mb-2",children:(0,g.__)("2. Once you have an account, click on Sign in")}),(0,o.jsx)(_.Button,{variant:"secondary",style:{padding:"2rem 6rem",fontSize:"1.5rem"},onClick:()=>c(),disabled:a||r,children:(0,g.__)("Sign In","adsmurai-one-tag")})]})]}),(a||r)&&(0,o.jsx)("div",{className:"mt-2 text-center",children:(0,o.jsx)(_.Spinner,{className:"size-4"})})]})})},Ks=()=>{window.open(`${r}/register/organizations?http_referer_code=onetag&utm_source=plugin&utm_medium=wp`)},Ys=async e=>new Promise(t=>{const s=new URLSearchParams({origin:location.href,utm_source:"wp"}),a=function(e,t){const s=t.top.outerHeight/2+t.top.screenY-350,a=t.top.outerWidth/2+t.top.screenX-300;return t.open(e,"_blank",` copyhistory=no, width=600, height=700, top=${s}, left=${a}`)}(`${r}/login?redirectTo=${encodeURIComponent((e?i:"https://localhost:3001")+"/en/connect?"+s.toString())}`,window);window.addEventListener("message",e=>{[r,i,"https://localhost:3001"].includes(e.origin)&&e.source===a?(console.log("MESSAGE",e,JSON.stringify(e?.data,null,2)),e?.data&&(a.close(),t(e.data))):t(null)},!1)}),Js=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM12.75 8V13H11.25V8H12.75ZM12.75 14.5V16H11.25V14.5H12.75Z"})}),Xs=[["WOOCOMMERCE","WooCommerce"],["WPCF7","Contact Form 7"],["WP_FORMS","WPForms Lite"],["NINJA_FORMS","Ninja Forms"],["FORMINATOR","Forminator"],["FLUENT_FORMS","Fluent Forms"]],Qs=()=>{const{settings:e,isLoading:t}=(0,n.useContext)(m),s=(0,n.useMemo)(()=>{var t;return(null!==(t=e?.compatible_plugins)&&void 0!==t?t:[]).length>0},[e]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Detected Compatible Plugins","adsmurai-one-tag")}),(0,o.jsx)(_.Card,{className:"p-2",children:t?(0,o.jsx)(_.Spinner,{className:"size-4"}):(0,o.jsxs)("div",{children:[Xs.map(([t,s],a)=>{const n=e.compatible_plugins.includes(t),r=`cp_${t}_${a}`;return(0,o.jsxs)("div",{className:"flex-row items-center",children:[n?(0,o.jsx)(_.Icon,{icon:js,className:"fill-green",size:24}):(0,o.jsx)(_.Icon,{icon:Cs,className:"fill-red",size:24}),(0,o.jsx)("span",{children:s})," ",Object.entries(e.events_per_plugin).filter(([e,s])=>e===t).map(([e,t],s)=>(0,o.jsxs)("span",{className:"italic",children:["(",t.join(", "),")"]},`${r}_${s}`))]},r)}),!s&&(0,o.jsxs)("div",{className:"mt-2 p-2 bg-orange-light flex-row items-center gap-x-1",children:[(0,o.jsx)(_.Icon,{size:24,icon:Js}),(0,o.jsx)("span",{children:(0,g.__)("No compatible plugins found.","adsmurai-one-tag")})]})]})})]})},ea=(0,o.jsx)(Ie.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,o.jsx)(Ie.Path,{d:"M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z"})}),ta=()=>{const{ampFeedsUrl:e}=(0,n.useContext)(d),[t,s]=(0,n.useState)(!1),[a,r]=(0,n.useState)(null),[i,l]=(0,n.useState)(!1);(0,n.useEffect)(()=>{a||(async()=>{try{var e;s(!0);const t=await fetch("/index.php?rest_route=/one-tag/feed",{method:"GET",headers:{"X-WP-Nonce":window._oneTagWpToken}}),a=await t.json();r(null!==(e=a?.url)&&void 0!==e?e:null)}catch{}finally{s(!1)}})()},[a,r,s]);const c=(0,n.useCallback)(async()=>{await sa(a),l(!0),setTimeout(()=>{l(!1)},2e3)},[a,l]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("Feed","adsmurai-one-tag")}),(0,o.jsx)(_.Card,{className:"p-2",children:t?(0,o.jsx)(_.Spinner,{className:"size-4"}):(0,o.jsxs)("div",{className:"flex-row items-center gap-x-1",children:[(0,o.jsx)(_.Icon,{size:20,icon:ea}),a,(0,o.jsx)(_.Button,{className:"ms-auto",variant:i?"success":"primary",onClick:()=>c(),children:(0,g.__)(i?"Copied!":"Copy","adsmurai-one-tag")})]})}),(0,o.jsx)("div",{className:"mt-2 flex-row justify-center",children:(0,o.jsx)("a",{href:e,target:"_blank",children:(0,o.jsx)(_.Button,{variant:"primary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Open AMP Feeds","adsmurai-one-tag")})})}),(0,o.jsxs)(_.Card,{className:"mt-3 p-2",children:[(0,o.jsx)("span",{className:"text-xl font-bold",children:(0,g.__)("Adsmurai Feed Generator for WooCommerce – FAQ","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Adsmurai Feed Generator for WooCommerce is a plugin that automatically creates a product feed including all your WooCommerce products. This feed is updated once per day to ensure that your product data remains accurate and up-to-date.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How does the plugin work?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Once installed and activated, the plugin automatically generates a comprehensive product feed containing product titles, descriptions, prices, images, stock status, and more. The feed updates daily to reflect any changes in your WooCommerce store.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("What can I use the product feed for?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The product feed can be used to share your WooCommerce product catalog with various marketing channels such as Google Merchant Center, Meta (Facebook and Instagram), Pinterest, and more. This helps you run dynamic product ads and improve the visibility of your products across different platforms.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Can I filter or optimize the product feed?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The Adsmurai Feed Generator plugin creates a basic product feed with all WooCommerce products. To filter, optimize, or customize your feed further, we recommend using Adsmurai Marketing Platform. With this platform, you can apply custom rules, exclude out-of-stock products, map categories, and create thousands of personalized ad creatives from your product catalog.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How often is the product feed updated?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The product feed is automatically updated once per day to ensure your product information remains accurate and consistent across channels.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Is there any configuration needed?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The plugin requires minimal configuration. Once installed, it automatically generates the product feed without any manual input. However, if you need advanced customization or filtering, you should integrate the feed with Adsmurai Marketing Platform.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How do I connect the product feed with Adsmurai Marketing Platform?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Once the feed is generated, you can import it into Adsmurai Marketing Platform by providing the feed URL. From there, you can optimize, filter, and distribute your feed to different advertising platforms.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("What channels are supported by Adsmurai Marketing Platform?","adsmurai-one-tag")}),(0,o.jsx)("p",{children:(0,g.__)("Adsmurai Marketing Platform supports various advertising channels, including:","adsmurai-one-tag")}),(0,o.jsxs)("ul",{className:"mb-3 list-disc",children:[(0,o.jsx)("li",{children:(0,g.__)("Google Merchant Center (Google Shopping Ads)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Meta (Facebook and Instagram Ads)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Pinterest (Product Pins)","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("TikTok Ads","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("Snapchat Ads","adsmurai-one-tag")}),(0,o.jsx)("li",{children:(0,g.__)("And more","adsmurai-one-tag")})]}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Does the plugin support large product catalogs?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("Yes, the plugin is designed to handle both small and large product catalogs efficiently.\n","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("Is there any cost associated with Adsmurai Feed Generator for WooCommerce?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("The Adsmurai Feed Generator plugin itself is free to install and use. However, Adsmurai Marketing Platform is a paid service that offers advanced feed management and advertising features.","one-tag")}),(0,o.jsx)("span",{className:"text-lg font-bold",children:(0,g.__)("How can I get support?","adsmurai-one-tag")}),(0,o.jsx)("p",{className:"mb-3",children:(0,g.__)("For support with the Adsmurai Feed Generator plugin, please visit our support page. For assistance with Adsmurai Marketing Platform, please contact our sales team or visit our website.","one-tag")}),(0,o.jsxs)("div",{className:"mt-4 flex-row gap-x-2 justify-center",children:[(0,o.jsx)("a",{href:"https://www.adsmurai.com/en/product#book-demo?utm_source=plugin&utm_medium=wp",target:"_blank",children:(0,o.jsx)(_.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Contact our sales team","adsmurai-one-tag")})}),(0,o.jsx)("a",{href:"https://www.adsmurai.com/en/product?utm_source=plugin&utm_medium=wp",target:"_blank",children:(0,o.jsx)(_.Button,{variant:"secondary",style:{padding:"1.5rem 4rem"},children:(0,g.__)("Visit our site","adsmurai-one-tag")})})]})]})]})},sa=async e=>{await navigator.clipboard.writeText(e)},aa=[{key:"custom",name:"Custom Cookie",cookie:""},{key:"cookiebot",name:"Cookiebot",cookie:"CookieConsent"},{key:"cookieyes",name:"CookieYes",cookie:"cookieyes-consent"},{key:"cookiefirst",name:"CookieFirst",cookie:"cookieconsent_status"},{key:"cookiehub",name:"CookieHub",cookie:"cookieconsent_status"},{key:"consentmanager",name:"Consentmanager",cookie:"consentmanager"},{key:"complianz",name:"Complianz",cookie:"cmplz_marketing"}],na=()=>{var e,t;const{oneTagSettings:s,saveGDPRCookie:a}=(0,n.useContext)(d),[r,i]=(0,n.useState)(""),l=(0,n.useMemo)(()=>gs({enabled:hs(),cmp:ms(),cookie:ms()}).refine(e=>!e.enabled||e.enabled&&!!e.cookie,{message:(0,g.__)("This field is required.","adsmurai-one-tag"),path:["cookie"]}),[]),{control:c,handleSubmit:u,watch:m,setValue:h,trigger:p,formState:{isSubmitting:f,errors:y,isValid:v,isDirty:x}}=Ee({defaultValues:{enabled:!!s?.gdprCookie,cmp:s?.gdprCookie&&null!==(e=aa.find(e=>e.cookie===s?.gdprCookie)?.key)&&void 0!==e?e:aa[0].key,cookie:null!==(t=s?.gdprCookie)&&void 0!==t?t:""},mode:"onChange",resolver:ws(l)}),b=m("enabled"),k=m("cmp"),w=(0,n.useMemo)(()=>k===aa[0].key,[k]);(0,n.useEffect)(()=>{if(x){if(b&&"custom"!==k){const e=aa.find(e=>e.key===k)?.cookie;h("cookie",e),i(e)}else{var e,t;h("cookie",null!==(e=s.gdprCookie)&&void 0!==e?e:""),i(null!==(t=s.gdprCookie)&&void 0!==t?t:"")}p("cookie")}},[x,s,k,w,b,h,p,i]);const j=(0,n.useCallback)(async e=>{await a(e.cookie)},[a]);return(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-lg font-bold",children:(0,g.__)("GDPR Consent","adsmurai-one-tag")}),(0,o.jsx)(_.Card,{className:"p-2",children:(0,o.jsx)("form",{onSubmit:u(j),noValidate:!0,children:(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.ToggleControl,{label:(0,g.__)("Make One Tag send events only when visitor has consented to.","one-tag"),checked:e.value,onChange:t=>e.onChange(t)}),name:"enabled",control:c}),b&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"flex-row gap-x-2",children:[(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsx)(_.CustomSelectControl,{className:"w-6",name:e.name,label:(0,g.__)("CMP Provider","adsmurai-one-tag"),value:aa.find(t=>t.key===e.value),onChange:t=>e.onChange(t.selectedItem.key),options:aa,disabled:f}),name:"cmp",control:c}),(0,o.jsx)(Y,{render:({field:e})=>(0,o.jsxs)("div",{children:[(0,o.jsx)(_.__experimentalInputControl,{className:"w-6",name:e.name,type:"text",label:(0,g.__)("Cookie","adsmurai-one-tag"),value:e.value,onChange:t=>{i(t),e.onChange(t)},disabled:f}),!!y.cookie?.message&&(0,o.jsx)("div",{className:"pt-1 text-red",children:y.cookie.message})]}),name:"cookie",control:c})]}),(0,o.jsxs)("div",{className:"p-2 bg-orange-light mb-2 flex-row items-center gap-x-1",children:[(0,o.jsx)(_.Icon,{size:24,icon:Js}),(0,g.__)('One Tag will only send events if cookie "'+(r||"?")+'" is set.',"one-tag")]})]}),(0,o.jsx)("div",{className:"flex-row-reverse",children:(0,o.jsx)(_.Button,{type:"submit",variant:"primary",disabled:f||!v,children:(0,g.__)("Save","adsmurai-one-tag")})})]})})})]})},ra=()=>{const{resetSettings:e,isUpdating:t}=(0,n.useContext)(d),[s,a]=(0,n.useState)(!1);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"flex-col gap-y-2",children:[(0,o.jsx)("hr",{className:"w-full"}),(0,o.jsx)("div",{className:"w-full flex-row-reverse",children:(0,o.jsx)(_.Button,{variant:"secondary",onClick:()=>a(!0),children:"Reset Settings"})})]}),(0,o.jsx)(Es,{show:s,title:(0,g.__)("Reset settings","adsmurai-one-tag"),message:(0,g.__)("Are you sure you want to reset your settings? This action cannot be undone.","adsmurai-one-tag"),onClose:()=>a(!1),options:[{props:{onClick:()=>a(!1),variant:"secondary"},label:(0,g.__)("Cancel","adsmurai-one-tag")},{props:{onClick:async()=>{await e(),a(!1)},variant:"primary",disabled:t},isLoading:t,label:(0,g.__)("Reset my settings","adsmurai-one-tag")}]})]})},ia=()=>{var e;const{isLoaded:t,showConnectScreen:s,showSingleTab:a,oneTagSettings:r}=(0,n.useContext)(d),{settings:i}=(0,n.useContext)(m);return t?s?(0,o.jsx)(qs,{}):a?(0,o.jsxs)(o.Fragment,{children:[0===(null!==(l=r?.pixels)&&void 0!==l?l:[]).length&&(0,o.jsx)(Is,{}),!r?.token&&(0,o.jsx)(Bs,{})]}):(0,o.jsx)(_.TabPanel,{onSelect:()=>{},tabs:[{name:"main",title:(0,g.__)("Main","adsmurai-one-tag")},{name:"fieldMatcher",title:(0,g.__)("Forms","adsmurai-one-tag")},...(null!==(e=i?.compatible_plugins)&&void 0!==e?e:[]).includes("WOOCOMMERCE")?[{name:"feed",title:(0,g.__)("Feed","adsmurai-one-tag")}]:[],{name:"subscriptions",title:(0,g.__)("Subscriptions","adsmurai-one-tag")}],children:({name:e})=>(0,o.jsxs)("div",{children:["main"===e&&(0,o.jsxs)("div",{className:"flex-col gap-y-3",children:[(0,o.jsx)(Is,{}),(0,o.jsx)(Qs,{}),(0,o.jsx)(na,{}),(0,o.jsx)(Bs,{}),(0,o.jsx)(ra,{})]}),"fieldMatcher"===e&&(0,o.jsx)(Ds,{children:(0,o.jsx)(Gs,{})}),"feed"===e&&(0,o.jsx)(ta,{}),"subscriptions"===e&&(0,o.jsx)(Hs,{})]})}):(0,o.jsx)("div",{className:"flex-row justify-center",children:(0,o.jsx)(_.Spinner,{className:"size-4"})});var l},oa=()=>(0,o.jsx)(Ts,{children:(0,o.jsx)(l,{children:(0,o.jsx)(h,{children:(0,o.jsx)(f,{children:(0,o.jsx)("div",{className:"py-2",children:(0,o.jsx)(ia,{})})})})})});document.addEventListener("DOMContentLoaded",function(){const t=document.getElementById("one-tag");t&&(0,e.H)(t).render((0,o.jsx)(oa,{}))}),"undefined"!=typeof wpData&&(window._oneTagWpToken=wpData.oneTagWpToken)})()})();
  • adsmurai-one-tag/trunk/one-tag.php

    r3288929 r3336062  
    33 * Plugin Name: Adsmurai One Tag
    44 * Description: OneTag is a no-code WordPress and Woocommerce plugin that automates conversion tracking across ad platforms using Conversion APIs—no coding required.
    5  * Version: 1.0.4
     5 * Version: 1.0.5
    66 * Author: Adsmurai
    77 * Author URI: https://www.adsmurai.com/en/product/serverless-tracking
  • adsmurai-one-tag/trunk/readme.txt

    r3288929 r3336062  
    44Requires at least: 6.4
    55Tested up to: 6.8
    6 Stable tag: 1.0.4
     6Stable tag: 1.0.5
    77Requires PHP: 7.0
    88License: GPLv2 or later
     
    9696- First public release
    9797
     98= 1.0.5 =
     99
     100- Support for "Complianz" wp plugin
     101
    98102== External services ==
    99103In order to avoid losing conversion events, all channels like Facebook or Tiktok recommend sending the events from both: Client and server side.
  • adsmurai-one-tag/trunk/src/sections/RGPDSection.js

    r3284929 r3336062  
    4646        cookie: "consentmanager",
    4747    },
     48    {
     49        key: "complianz",
     50        name: "Complianz",
     51        cookie: "cmplz_marketing",
     52    }
    4853];
    4954
     
    7075        [],
    7176    );
    72 
    7377    const {
    7478        control,
     
    100104            return;
    101105        }
    102         if (enabled && !isCustomCookie) {
     106        if (enabled && cookieFromSelector !== 'custom') {
    103107            const cookie = CMP_OPTIONS.find((o) => o.key === cookieFromSelector)?.cookie;
    104108            setValue("cookie", cookie);
    105109            setCookieName(cookie);
    106110        } else {
    107             setValue("cookie", "");
    108             setCookieName("");
     111            setValue("cookie", oneTagSettings.gdprCookie ?? "");
     112            setCookieName(oneTagSettings.gdprCookie ?? "");
    109113        }
    110114        trigger("cookie");
  • adsmurai-one-tag/trunk/vendor/composer/InstalledVersions.php

    r3284929 r3336062  
    3232     */
    3333    private static $installed;
    34 
    35     /**
    36      * @var bool
    37      */
    38     private static $installedIsLocalDir;
    3934
    4035    /**
     
    315310        self::$installed = $data;
    316311        self::$installedByVendor = array();
    317 
    318         // when using reload, we disable the duplicate protection to ensure that self::$installed data is
    319         // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
    320         // so we have to assume it does not, and that may result in duplicate data being returned when listing
    321         // all installed packages for example
    322         self::$installedIsLocalDir = false;
    323312    }
    324313
     
    334323
    335324        $installed = array();
    336         $copiedLocalDir = false;
    337325
    338326        if (self::$canGetVendors) {
    339             $selfDir = strtr(__DIR__, '\\', '/');
    340327            foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
    341                 $vendorDir = strtr($vendorDir, '\\', '/');
    342328                if (isset(self::$installedByVendor[$vendorDir])) {
    343329                    $installed[] = self::$installedByVendor[$vendorDir];
     
    345331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
    346332                    $required = require $vendorDir.'/composer/installed.php';
    347                     self::$installedByVendor[$vendorDir] = $required;
    348                     $installed[] = $required;
    349                     if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
    350                         self::$installed = $required;
    351                         self::$installedIsLocalDir = true;
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
     334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
     335                        self::$installed = $installed[count($installed) - 1];
    352336                    }
    353                 }
    354                 if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
    355                     $copiedLocalDir = true;
    356337                }
    357338            }
     
    370351        }
    371352
    372         if (self::$installed !== array() && !$copiedLocalDir) {
     353        if (self::$installed !== array()) {
    373354            $installed[] = self::$installed;
    374355        }
  • adsmurai-one-tag/trunk/vendor/composer/installed.php

    r3288929 r3336062  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '3905416936c3efb532dd3c47d643f9fa9f2e2012',
     6        'reference' => '74f8b9a7a4bf4fd86e75486292c90dd9bf0b33a8',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    2323            'pretty_version' => 'dev-main',
    2424            'version' => 'dev-main',
    25             'reference' => '3905416936c3efb532dd3c47d643f9fa9f2e2012',
     25            'reference' => '74f8b9a7a4bf4fd86e75486292c90dd9bf0b33a8',
    2626            'type' => 'library',
    2727            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.