PageSourceSearch

https://beyondtools.io/assets/ToolDetail-BtV2o4Bi.js

js beyondtools.io collected 2026-10-04 03:06:27 UTC 93,821 bytes, 16 lines download raw bytes

vendor: 9,400 bytes, lines 1-16
1import{z as Ye,t as De,v as Ee,a as jt,r as R,j as n,B as C,I as Nt,s as V,A as Tt,u as St,R as Ge,i as H,E as Ct,D as Je,G as Et,J as ue,C as Z,p as O,m as Y,o as G,K as at,L as fe,k as Rt,N as Zt,b as Ze,O as Qe,f as Ot,H as Ue,F as Xe,e as It,d as At}from"./index-Dge1Tx5E.js";import{f as $t,a as Pt,b as Lt}from"./tool-fetchers-DCBeVj4o.js";import{S as Mt}from"./ShareModal-C5HPYqEX.js";import{D as Dt,a as Vt,b as Ut,c as zt,d as Bt,e as qt}from"./dialog-BXi2Brd5.js";import{L as et}from"./label-CjFpbZ-T.js";import{T as nt}from"./textarea-BBnm6jsM.js";import{B as Ft}from"./bookmark-5dVEX5RN.js";import{S as Wt,u as Ht,B as Yt}from"./BreadcrumbNav-UQT96HWM.js";import{s as Gt}from"./security-CGFhXZTJ.js";import{C as Jt}from"./circle-check-big-C6qf7cJU.js";import{C as Kt}from"./circle-x-DuKfiHYJ.js";import{U as Qt,u as Xt}from"./UserLink-BmzrNFfD.js";import{U as es}from"./user-BMgFdDcI.js";import{L as ts}from"./linkedin-DCZ-_sji.js";import{a as it,e as ot,g as ct}from"./youtube-utils-DHL8-Fko.js";import{P as tt}from"./play-DJ1NVWIj.js";import{C as ss}from"./copy-CcqZ2hn6.js";import{f as rs}from"./fetchers-Bd7yKKiJ.js";import{V as as,U as ns}from"./verified-badge-CaI9YExz.js";import{u as is,M as os,a as cs}from"./useModerationActions-DmZCZi-y.js";import{A as ls}from"./arrow-left-ODRx4Cuv.js";import"./user-management-C-8BET4v.js";import"./facebook-Cwx-l6j6.js";import"./check-wzas0hBJ.js";import"./Combination-DxE4YiLw.js";import"./security-utils-BlacMCKL.js";import"./house-D6bVpg2I.js";import"./file-text-Bk4FwafD.js";import"./message-square-C2dX68FB.js";import"./chevron-right-_Yv1OgyK.js";import"./wrench-CCALHtAP.js";import"./lightbulb-B-MS2Rr7.js";import"./crown-B711KqOU.js";import"./dropdown-menu-DgGmISfL.js";import"./index-CfdM2FFY.js";import"./index-BRDogrIv.js";import"./circle-B8B4zPkP.js";import"./eye-off-BP7R3avU.js";import"./trash-2-DPzuZW0N.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ds=Ye("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const us=Ye("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ms=Ye("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);var b;(function(t){t.assertEqual=a=>a;function e(a){}t.assertIs=e;function s(a){throw new Error}t.assertNever=s,t.arrayToEnum=a=>{const i={};for(const o of a)i[o]=o;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(c=>typeof a[a[c]]!="number"),o={};for(const c of i)o[c]=a[c];return t.objectValues(o)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const o in a)Object.prototype.hasOwnProperty.call(a,o)&&i.push(o);return i},t.find=(a,i)=>{for(const o of a)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(b||(b={}));var qe;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(qe||(qe={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),K=t=>{switch(typeof t){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(t)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(t)?h.array:t===null?h.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?h.promise:typeof Map<"u"&&t instanceof Map?h.map:typeof Set<"u"&&t instanceof Set?h.set:typeof Date<"u"&&t instanceof Date?h.date:h.object;default:return h.unknown}},d=b.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"]),hs=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class $ extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const s=e||function(i){return i.message},r={_errors:[]},a=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(a);else if(o.code==="invalid_return_type")a(o.returnTypeError);else if(o.code==="invalid_arguments")a(o.argumentsError);else if(o.path.length===0)r._errors.push(s(o));else{let c=r,u=0;for(;u<o.path.length;){const l=o.path[u];u===o.path.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(s(o))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}};return a(this),r}static assert(e){if(!(e instanceof $))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){const s={},r=[];for(const a of this.issues)a.path.length>0?(s[a.path[0]]=s[a.path[0]]||[],s[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:s}}get formErrors(){return this.flatten()}}$.create=t=>new $(t);const ce=(t,e)=>{let s;switch(t.code){case d.invalid_type:t.received===h.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:s=`Unrecognized key(s) in object: ${b.joinValues(t.keys,", ")}`;break;case d.invalid_union:s="Invalid input";break;case d.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${b.joinValues(t.options)}`;break;case d.invalid_enum_value:s=`Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:s="Invalid function arguments";break;case d.invalid_return_type:s="Invalid function return type";break;case d.invalid_date:s="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:b.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case d.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case d.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case d.custom:s="Invalid input";break;case d.invalid_intersection_types:s="Intersection results could not be merged";break;case d.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:s="Number must be finite";break;default:s=e.defaultError,b.assertNever(t)}return{message:s}};let lt=ce;function fs(t){lt=t}function Oe(){return lt}const Ie=t=>
vendor: 7,001 bytes, line 16
16{const{data:e,path:s,errorMaps:r,issueData:a}=t,i=[...s,...a.path||[]],o={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let c="";const u=r.filter(l=>!!l).slice().reverse();for(const l of u)c=l(o,{data:e,defaultError:c}).message;return{...a,path:i,message:c}},ps=[];function m(t,e){const s=Oe(),r=Ie({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,s,s===ce?void 0:ce].filter(a=>!!a)});t.common.issues.push(r)}class I{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){const r=[];for(const a of s){if(a.status==="aborted")return y;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,s){const r=[];for(const a of s){const i=await a.key,o=await a.value;r.push({key:i,value:o})}return I.mergeObjectSync(e,r)}static mergeObjectSync(e,s){const r={};for(const a of s){const{key:i,value:o}=a;if(i.status==="aborted"||o.status==="aborted")return y;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||a.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const y=Object.freeze({status:"aborted"}),ie=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),Fe=t=>t.status==="aborted",We=t=>t.status==="dirty",pe=t=>t.status==="valid",ge=t=>typeof Promise<"u"&&t instanceof Promise;function Ae(t,e,s,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function dt(t,e,s,r,a){if(typeof e=="function"?t!==e||!a:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,s),s}var p;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var me,he;class z{constructor(e,s,r,a){this._cachedPath=[],this.parent=e,this.data=s,this._path=r,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 st=(t,e)=>{if(pe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const s=new $(t.common.issues);return this._error=s,this._error}}};function v(t){if(!t)return{};const{errorMap:e,invalid_type_error:s,required_error:r,description:a}=t;if(e&&(s||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(o,c)=>{var u,l;const{message:f}=t;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:(u=f??r)!==null&&u!==void 0?u:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(l=f??s)!==null&&l!==void 0?l:c.defaultError}},description:a}}class _{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)}get description(){return this._def.description}_getType(e){return K(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new I,ctx:{common:e.parent.common,data:e.data,parsedType:K(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const s=this._parse(e);if(ge(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){const s=this._parse(e);return Promise.resolve(s)}parse(e,s){const r=this.safeParse(e,s);if(r.success)return r.data;throw r.error}safeParse(e,s){var r;const a={common:{issues:[],async:(r=s==null?void 0:s.async)!==null&&r!==void 0?r:!1,contextualErrorMap:s==null?void 0:s.errorMap},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K(e)},i=this._parseSync({data:e,path:a.path,parent:a});return st(a,i)}async parseAsync(e,s){const r=await this.safeParseAsync(e,s);if(r.success)return r.data;throw r.error}async safeParseAsync(e,s){const r={common:{issues:[],contextualErrorMap:s==null?void 0:s.errorMap,async:!0},path:(s==null?void 0:s.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:K(e)},a=this._parse({data:e,path:r.path,parent:r}),i=await(ge(a)?a:Promise.resolve(a));return st(r,i)}refine(e,s){const r=a=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(a):s;return this._refinement((a,i)=>{const o=e(a),c=()=>i.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,s){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof s=="function"?s(r,a):s),!1))}_refinement(e){return new M({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return U.create(this,this._def)}nullable(){return te.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this,this._def)}promise(){return de.create(this,this._def)}or(e){return _e.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new M({...v(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const s=typeof e=="function"?e:()=>e;return new Te({...v(this._def),innerType:this,defaultValue:s,typeName:x.ZodDefault})}brand(){return new Ke({typeName:x.ZodBranded,type:this,...v(this._def)})}catch(e){const s=typeof e=="function"?e:()=>e;return new Se({...v(this._def),innerType:this,catchValue:s,typeName:x.ZodCatch})}describe(e){const s=this.constructor;return new s({...this._def,description:e})}pipe(e){return Re.create(this,e)}readonly(){return Ce.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gs=/^c[^\s-]{8,}
vendor: 40,842 bytes, line 16
16$/i,xs=/^[0-9a-z]+$/,ys=/^[0-9A-HJKMNP-TV-Z]{26}$/,vs=/^[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,_s=/^[a-z0-9_-]{21}$/i,bs=/^[-+]?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)?)??$/,ws=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ks="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ze;const js=/^(?:(?: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])$/,Ns=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Ts=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ut="((\\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])))",Ss=new RegExp(`^${ut}$`);function mt(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Cs(t){return new RegExp(`^${mt(t)}$`)}function ht(t){let e=`${ut}T${mt(t)}`;const s=[];return s.push(t.local?"Z?":"Z"),t.offset&&s.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${s.join("|")})`,new RegExp(`^${e}$`)}function Es(t,e){return!!((e==="v4"||!e)&&js.test(t)||(e==="v6"||!e)&&Ns.test(t))}class P extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const i=this._getOrReturnCtx(e);return m(i,{code:d.invalid_type,expected:h.string,received:i.parsedType}),y}const r=new I;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,c=e.data.length<i.value;(o||c)&&(a=this._getOrReturnCtx(e,a),o?m(a,{code:d.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&m(a,{code:d.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")ws.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"email",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")ze||(ze=new RegExp(ks,"u")),ze.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"emoji",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")vs.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"uuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")_s.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"nanoid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")gs.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"cuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")xs.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"cuid2",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")ys.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"ulid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),m(a,{validation:"url",code:d.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"regex",code:d.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ht(i).test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Ss.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Cs(i).test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{code:d.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?bs.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"duration",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?Es(e.data,i.version)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"ip",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?Ts.test(e.data)||(a=this._getOrReturnCtx(e,a),m(a,{validation:"base64",code:d.invalid_string,message:i.message}),r.dirty()):b.assertNever(i);return{status:r.value,value:e.data}}_regex(e,s,r){return this.refinement(a=>e.test(a),{validation:s,code:d.invalid_string,...p.errToObj(r)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...p.errToObj(e)})}url(e){return this._addCheck({kind:"url",...p.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...p.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...p.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...p.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...p.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...p.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...p.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...p.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...p.errToObj(e)})}datetime(e){var s,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(s=e==null?void 0:e.offset)!==null&&s!==void 0?s:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...p.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...p.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...p.errToObj(e)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...p.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s==null?void 0:s.position,...p.errToObj(s==null?void 0:s.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...p.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...p.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...p.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...p.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...p.errToObj(s)})}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}P.create=t=>{var e;return new P({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};function Rs(t,e){const s=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=s>r?s:r,i=parseInt(t.toFixed(a).replace(".","")),o=parseInt(e.toFixed(a).replace(".",""));return i%o/Math.pow(10,a)}class Q extends _{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)!==h.number){const i=this._getOrReturnCtx(e);return m(i,{code:d.invalid_type,expected:h.number,received:i.parsedType}),y}let r;const a=new I;for(const i of this._def.checks)i.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:d.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?Rs(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),m(r,{code:d.not_finite,message:i.message}),a.dirty()):b.assertNever(i);return{status:a.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,r,a){return new Q({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:r,message:p.toString(a)}]})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,s=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(s===null||r.value>s)&&(s=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(s)&&Number.isFinite(e)}}Q.create=t=>new Q({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class X extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.bigint){const i=this._getOrReturnCtx(e);return m(i,{code:d.invalid_type,expected:h.bigint,received:i.parsedType}),y}let r;const a=new I;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),m(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):b.assertNever(i);return{status:a.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,p.toString(s))}gt(e,s){return this.setLimit("min",e,!1,p.toString(s))}lte(e,s){return this.setLimit("max",e,!0,p.toString(s))}lt(e,s){return this.setLimit("max",e,!1,p.toString(s))}setLimit(e,s,r,a){return new X({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:r,message:p.toString(a)}]})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(s)})}get minValue(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}}X.create=t=>{var e;return new X({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...v(t)})};class xe extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.boolean,received:r.parsedType}),y}return A(e.data)}}xe.create=t=>new xe({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...v(t)});class re extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const i=this._getOrReturnCtx(e);return m(i,{code:d.invalid_type,expected:h.date,received:i.parsedType}),y}if(isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return m(i,{code:d.invalid_date}),y}const r=new I;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:d.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),m(a,{code:d.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):b.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(s)})}get minDate(){let e=null;for(const s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}}re.create=t=>new re({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...v(t)});class $e extends _{_parse(e){if(this._getType(e)!==h.symbol){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.symbol,received:r.parsedType}),y}return A(e.data)}}$e.create=t=>new $e({typeName:x.ZodSymbol,...v(t)});class ye extends _{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.undefined,received:r.parsedType}),y}return A(e.data)}}ye.create=t=>new ye({typeName:x.ZodUndefined,...v(t)});class ve extends _{_parse(e){if(this._getType(e)!==h.null){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.null,received:r.parsedType}),y}return A(e.data)}}ve.create=t=>new ve({typeName:x.ZodNull,...v(t)});class le extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return A(e.data)}}le.create=t=>new le({typeName:x.ZodAny,...v(t)});class se extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return A(e.data)}}se.create=t=>new se({typeName:x.ZodUnknown,...v(t)});class J extends _{_parse(e){const s=this._getOrReturnCtx(e);return m(s,{code:d.invalid_type,expected:h.never,received:s.parsedType}),y}}J.create=t=>new J({typeName:x.ZodNever,...v(t)});class Pe extends _{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.void,received:r.parsedType}),y}return A(e.data)}}Pe.create=t=>new Pe({typeName:x.ZodVoid,...v(t)});class L extends _{_parse(e){const{ctx:s,status:r}=this._processInputParams(e),a=this._def;if(s.parsedType!==h.array)return m(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),y;if(a.exactLength!==null){const o=s.data.length>a.exactLength.value,c=s.data.length<a.exactLength.value;(o||c)&&(m(s,{code:o?d.too_big:d.too_small,minimum:c?a.exactLength.value:void 0,maximum:o?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&s.data.length<a.minLength.value&&(m(s,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&s.data.length>a.maxLength.value&&(m(s,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),s.common.async)return Promise.all([...s.data].map((o,c)=>a.type._parseAsync(new z(s,o,s.path,c)))).then(o=>I.mergeArray(r,o));const i=[...s.data].map((o,c)=>a.type._parseSync(new z(s,o,s.path,c)));return I.mergeArray(r,i)}get element(){return this._def.type}min(e,s){return new L({...this._def,minLength:{value:e,message:p.toString(s)}})}max(e,s){return new L({...this._def,maxLength:{value:e,message:p.toString(s)}})}length(e,s){return new L({...this._def,exactLength:{value:e,message:p.toString(s)}})}nonempty(e){return this.min(1,e)}}L.create=(t,e)=>new L({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...v(e)});function ne(t){if(t instanceof T){const e={};for(const s in t.shape){const r=t.shape[s];e[s]=U.create(ne(r))}return new T({...t._def,shape:()=>e})}else return t instanceof L?new L({...t._def,type:ne(t.element)}):t instanceof U?U.create(ne(t.unwrap())):t instanceof te?te.create(ne(t.unwrap())):t instanceof B?B.create(t.items.map(e=>ne(e))):t}class T extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),s=b.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==h.object){const l=this._getOrReturnCtx(e);return m(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),y}const{status:r,ctx:a}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof J&&this._def.unknownKeys==="strip"))for(const l in a.data)o.includes(l)||c.push(l);const u=[];for(const l of o){const f=i[l],k=a.data[l];u.push({key:{status:"valid",value:l},value:f._parse(new z(a,k,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof J){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of c)u.push({key:{status:"valid",value:f},value:{status:"valid",value:a.data[f]}});else if(l==="strict")c.length>0&&(m(a,{code:d.unrecognized_keys,keys:c}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of c){const k=a.data[f];u.push({key:{status:"valid",value:f},value:l._parse(new z(a,k,a.path,f)),alwaysSet:f in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of u){const k=await f.key,g=await f.value;l.push({key:k,value:g,alwaysSet:f.alwaysSet})}return l}).then(l=>I.mergeObjectSync(r,l)):I.mergeObjectSync(r,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new T({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,r)=>{var a,i,o,c;const u=(o=(i=(a=this._def).errorMap)===null||i===void 0?void 0:i.call(a,s,r).message)!==null&&o!==void 0?o:r.defaultError;return s.code==="unrecognized_keys"?{message:(c=p.errToObj(e).message)!==null&&c!==void 0?c:u}:{message:u}}}:{}})}strip(){return new T({...this._def,unknownKeys:"strip"})}passthrough(){return new T({...this._def,unknownKeys:"passthrough"})}extend(e){return new T({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new T({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new T({...this._def,catchall:e})}pick(e){const s={};return b.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(s[r]=this.shape[r])}),new T({...this._def,shape:()=>s})}omit(e){const s={};return b.objectKeys(this.shape).forEach(r=>{e[r]||(s[r]=this.shape[r])}),new T({...this._def,shape:()=>s})}deepPartial(){return ne(this)}partial(e){const s={};return b.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];e&&!e[r]?s[r]=a:s[r]=a.optional()}),new T({...this._def,shape:()=>s})}required(e){const s={};return b.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])s[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof U;)i=i._def.innerType;s[r]=i}}),new T({...this._def,shape:()=>s})}keyof(){return ft(b.objectKeys(this.shape))}}T.create=(t,e)=>new T({shape:()=>t,unknownKeys:"strip",catchall:J.create(),typeName:x.ZodObject,...v(e)});T.strictCreate=(t,e)=>new T({shape:()=>t,unknownKeys:"strict",catchall:J.create(),typeName:x.ZodObject,...v(e)});T.lazycreate=(t,e)=>new T({shape:t,unknownKeys:"strip",catchall:J.create(),typeName:x.ZodObject,...v(e)});class _e extends _{_parse(e){const{ctx:s}=this._processInputParams(e),r=this._def.options;function a(i){for(const c of i)if(c.result.status==="valid")return c.result;for(const c of i)if(c.result.status==="dirty")return s.common.issues.push(...c.ctx.common.issues),c.result;const o=i.map(c=>new $(c.ctx.common.issues));return m(s,{code:d.invalid_union,unionErrors:o}),y}if(s.common.async)return Promise.all(r.map(async i=>{const o={...s,common:{...s.common,issues:[]},parent:null};return{result:await i._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(a);{let i;const o=[];for(const u of r){const l={...s,common:{...s.common,issues:[]},parent:null},f=u._parseSync({data:s.data,path:s.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(i)return s.common.issues.push(...i.ctx.common.issues),i.result;const c=o.map(u=>new $(u));return m(s,{code:d.invalid_union,unionErrors:c}),y}}get options(){return this._def.options}}_e.create=(t,e)=>new _e({options:t,typeName:x.ZodUnion,...v(e)});const W=t=>t instanceof ke?W(t.schema):t instanceof M?W(t.innerType()):t instanceof je?[t.value]:t instanceof ee?t.options:t instanceof Ne?b.objectValues(t.enum):t instanceof Te?W(t._def.innerType):t instanceof ye?[void 0]:t instanceof ve?[null]:t instanceof U?[void 0,...W(t.unwrap())]:t instanceof te?[null,...W(t.unwrap())]:t instanceof Ke||t instanceof Ce?W(t.unwrap()):t instanceof Se?W(t._def.innerType):[];class Ve extends _{_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return m(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),y;const r=this.discriminator,a=s.data[r],i=this.optionsMap.get(a);return i?s.common.async?i._parseAsync({data:s.data,path:s.path,parent:s}):i._parseSync({data:s.data,path:s.path,parent:s}):(m(s,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,r){const a=new Map;for(const i of s){const o=W(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of o){if(a.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);a.set(c,i)}}return new Ve({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:a,...v(r)})}}function He(t,e){const s=K(t),r=K(e);if(t===e)return{valid:!0,data:t};if(s===h.object&&r===h.object){const a=b.objectKeys(e),i=b.objectKeys(t).filter(c=>a.indexOf(c)!==-1),o={...t,...e};for(const c of i){const u=He(t[c],e[c]);if(!u.valid)return{valid:!1};o[c]=u.data}return{valid:!0,data:o}}else if(s===h.array&&r===h.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const o=t[i],c=e[i],u=He(o,c);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return s===h.date&&r===h.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class be extends _{_parse(e){const{status:s,ctx:r}=this._processInputParams(e),a=(i,o)=>{if(Fe(i)||Fe(o))return y;const c=He(i.value,o.value);return c.valid?((We(i)||We(o))&&s.dirty(),{status:s.value,value:c.data}):(m(r,{code:d.invalid_intersection_types}),y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>a(i,o)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}be.create=(t,e,s)=>new be({left:t,right:e,typeName:x.ZodIntersection,...v(s)});class B extends _{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.array)return m(r,{code:d.invalid_type,expected:h.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return m(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(m(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());const i=[...r.data].map((o,c)=>{const u=this._def.items[c]||this._def.rest;return u?u._parse(new z(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>I.mergeArray(s,o)):I.mergeArray(s,i)}get items(){return this._def.items}rest(e){return new B({...this._def,rest:e})}}B.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new B({items:t,typeName:x.ZodTuple,rest:null,...v(e)})};class we extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.object)return m(r,{code:d.invalid_type,expected:h.object,received:r.parsedType}),y;const a=[],i=this._def.keyType,o=this._def.valueType;for(const c in r.data)a.push({key:i._parse(new z(r,c,r.path,c)),value:o._parse(new z(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?I.mergeObjectAsync(s,a):I.mergeObjectSync(s,a)}get element(){return this._def.valueType}static create(e,s,r){return s instanceof _?new we({keyType:e,valueType:s,typeName:x.ZodRecord,...v(r)}):new we({keyType:P.create(),valueType:e,typeName:x.ZodRecord,...v(s)})}}class Le extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.map)return m(r,{code:d.invalid_type,expected:h.map,received:r.parsedType}),y;const a=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([c,u],l)=>({key:a._parse(new z(r,c,r.path,[l,"key"])),value:i._parse(new z(r,u,r.path,[l,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const u of o){const l=await u.key,f=await u.value;if(l.status==="aborted"||f.status==="aborted")return y;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),c.set(l.value,f.value)}return{status:s.value,value:c}})}else{const c=new Map;for(const u of o){const l=u.key,f=u.value;if(l.status==="aborted"||f.status==="aborted")return y;(l.status==="dirty"||f.status==="dirty")&&s.dirty(),c.set(l.value,f.value)}return{status:s.value,value:c}}}}Le.create=(t,e,s)=>new Le({valueType:e,keyType:t,typeName:x.ZodMap,...v(s)});class ae extends _{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.set)return m(r,{code:d.invalid_type,expected:h.set,received:r.parsedType}),y;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(m(r,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),s.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(m(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),s.dirty());const i=this._def.valueType;function o(u){const l=new Set;for(const f of u){if(f.status==="aborted")return y;f.status==="dirty"&&s.dirty(),l.add(f.value)}return{status:s.value,value:l}}const c=[...r.data.values()].map((u,l)=>i._parse(new z(r,u,r.path,l)));return r.common.async?Promise.all(c).then(u=>o(u)):o(c)}min(e,s){return new ae({...this._def,minSize:{value:e,message:p.toString(s)}})}max(e,s){return new ae({...this._def,maxSize:{value:e,message:p.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}}ae.create=(t,e)=>new ae({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...v(e)});class oe extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==h.function)return m(s,{code:d.invalid_type,expected:h.function,received:s.parsedType}),y;function r(c,u){return Ie({data:c,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Oe(),ce].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}function a(c,u){return Ie({data:c,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Oe(),ce].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}const i={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof de){const c=this;return A(async function(...u){const l=new $([]),f=await c._def.args.parseAsync(u,i).catch(w=>{throw l.addIssue(r(u,w)),l}),k=await Reflect.apply(o,this,f);return await c._def.returns._def.type.parseAsync(k,i).catch(w=>{throw l.addIssue(a(k,w)),l})})}else{const c=this;return A(function(...u){const l=c._def.args.safeParse(u,i);if(!l.success)throw new $([r(u,l.error)]);const f=Reflect.apply(o,this,l.data),k=c._def.returns.safeParse(f,i);if(!k.success)throw new $([a(f,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new oe({...this._def,args:B.create(e).rest(se.create())})}returns(e){return new oe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,r){return new oe({args:e||B.create([]).rest(se.create()),returns:s||se.create(),typeName:x.ZodFunction,...v(r)})}}class ke extends _{get schema(){return this._def.getter()}_parse(e){const{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}}ke.create=(t,e)=>new ke({getter:t,typeName:x.ZodLazy,...v(e)});class je extends _{_parse(e){if(e.data!==this._def.value){const s=this._getOrReturnCtx(e);return m(s,{received:s.data,code:d.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}je.create=(t,e)=>new je({value:t,typeName:x.ZodLiteral,...v(e)});function ft(t,e){return new ee({values:t,typeName:x.ZodEnum,...v(e)})}class ee extends _{constructor(){super(...arguments),me.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const s=this._getOrReturnCtx(e),r=this._def.values;return m(s,{expected:b.joinValues(r),received:s.parsedType,code:d.invalid_type}),y}if(Ae(this,me)||dt(this,me,new Set(this._def.values)),!Ae(this,me).has(e.data)){const s=this._getOrReturnCtx(e),r=this._def.values;return m(s,{received:s.data,code:d.invalid_enum_value,options:r}),y}return A(e.data)}get options(){return this._def.values}get enum(){const e={};for(const s of this._def.values)e[s]=s;return e}get Values(){const e={};for(const s of this._def.values)e[s]=s;return e}get Enum(){const e={};for(const s of this._def.values)e[s]=s;return e}extract(e,s=this._def){return ee.create(e,{...this._def,...s})}exclude(e,s=this._def){return ee.create(this.options.filter(r=>!e.includes(r)),{...this._def,...s})}}me=new WeakMap;ee.create=ft;class Ne extends _{constructor(){super(...arguments),he.set(this,void 0)}_parse(e){const s=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==h.string&&r.parsedType!==h.number){const a=b.objectValues(s);return m(r,{expected:b.joinValues(a),received:r.parsedType,code:d.invalid_type}),y}if(Ae(this,he)||dt(this,he,new Set(b.getValidEnumValues(this._def.values))),!Ae(this,he).has(e.data)){const a=b.objectValues(s);return m(r,{received:r.data,code:d.invalid_enum_value,options:a}),y}return A(e.data)}get enum(){return this._def.values}}he=new WeakMap;Ne.create=(t,e)=>new Ne({values:t,typeName:x.ZodNativeEnum,...v(e)});class de extends _{unwrap(){return this._def.type}_parse(e){const{ctx:s}=this._processInputParams(e);if(s.parsedType!==h.promise&&s.common.async===!1)return m(s,{code:d.invalid_type,expected:h.promise,received:s.parsedType}),y;const r=s.parsedType===h.promise?s.data:Promise.resolve(s.data);return A(r.then(a=>this._def.type.parseAsync(a,{path:s.path,errorMap:s.common.contextualErrorMap})))}}de.create=(t,e)=>new de({type:t,typeName:x.ZodPromise,...v(e)});class M extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:r}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:o=>{m(r,o),o.fatal?s.abort():s.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const o=a.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async c=>{if(s.value==="aborted")return y;const u=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return u.status==="aborted"?y:u.status==="dirty"||s.value==="dirty"?ie(u.value):u});{if(s.value==="aborted")return y;const c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?y:c.status==="dirty"||s.value==="dirty"?ie(c.value):c}}if(a.type==="refinement"){const o=c=>{const u=a.refinement(c,i);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?y:(c.status==="dirty"&&s.dirty(),o(c.value),{status:s.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?y:(c.status==="dirty"&&s.dirty(),o(c.value).then(()=>({status:s.value,value:c.value}))))}if(a.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!pe(o))return o;const c=a.transform(o.value,i);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>pe(o)?Promise.resolve(a.transform(o.value,i)).then(c=>({status:s.value,value:c})):o);b.assertNever(a)}}M.create=(t,e,s)=>new M({schema:t,typeName:x.ZodEffects,effect:e,...v(s)});M.createWithPreprocess=(t,e,s)=>new M({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...v(s)});class U extends _{_parse(e){return this._getType(e)===h.undefined?A(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}U.create=(t,e)=>new U({innerType:t,typeName:x.ZodOptional,...v(e)});class te extends _{_parse(e){return this._getType(e)===h.null?A(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(t,e)=>new te({innerType:t,typeName:x.ZodNullable,...v(e)});class Te extends _{_parse(e){const{ctx:s}=this._processInputParams(e);let r=s.data;return s.parsedType===h.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:s.path,parent:s})}removeDefault(){return this._def.innerType}}Te.create=(t,e)=>new Te({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});class Se extends _{_parse(e){const{ctx:s}=this._processInputParams(e),r={...s,common:{...s.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ge(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Se.create=(t,e)=>new Se({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});class Me extends _{_parse(e){if(this._getType(e)!==h.nan){const r=this._getOrReturnCtx(e);return m(r,{code:d.invalid_type,expected:h.nan,received:r.parsedType}),y}return{status:"valid",value:e.data}}}Me.create=t=>new Me({typeName:x.ZodNaN,...v(t)});const Zs=Symbol("zod_brand");class Ke extends _{_parse(e){const{ctx:s}=this._processInputParams(e),r=s.data;return this._def.type._parse({data:r,path:s.path,parent:s})}unwrap(){return this._def.type}}class Re extends _{_parse(e){const{status:s,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?y:i.status==="dirty"?(s.dirty(),ie(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?y:a.status==="dirty"?(s.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,s){return new Re({in:e,out:s,typeName:x.ZodPipeline})}}class Ce extends _{_parse(e){const s=this._def.innerType._parse(e),r=a=>(pe(a)&&(a.value=Object.freeze(a.value)),a);return ge(s)?s.then(a=>r(a)):r(s)}unwrap(){return this._def.innerType}}Ce.create=(t,e)=>new Ce({innerType:t,typeName:x.ZodReadonly,...v(e)});function pt(t,e={},s){return t?le.create().superRefine((r,a)=>{var i,o;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(o=(i=c.fatal)!==null&&i!==void 0?i:s)!==null&&o!==void 0?o:!0,l=typeof c=="string"?{message:c}:c;a.addIssue({code:"custom",...l,fatal:u})}}):le.create()}const Os={object:T.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodD
16ate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));const Is=(t,e={message:`Input not instance of ${t.name}`})=>pt(s=>s instanceof t,e),gt=P.create,xt=Q.create,As=Me.create,$s=X.create,yt=xe.create,Ps=re.create,Ls=$e.create,Ms=ye.create,Ds=ve.create,Vs=le.create,Us=se.create,zs=J.create,Bs=Pe.create,qs=L.create,Fs=T.create,Ws=T.strictCreate,Hs=_e.create,Ys=Ve.create,Gs=be.create,Js=B.create,Ks=we.create,Qs=Le.create,Xs=ae.create,er=oe.create,tr=ke.create,sr=je.create,rr=ee.create,ar=Ne.create,nr=de.create,rt=M.create,ir=U.create,or=te.create,cr=M.createWithPreprocess,lr=Re.create,dr=()=>gt().optional(),ur=()=>xt().optional(),mr=()=>yt().optional(),hr={string:t=>P.create({...t,coerce:!0}),number:t=>Q.create({...t,coerce:!0}),boolean:t=>xe.create({...t,coerce:!0}),bigint:t=>X.create({...t,coerce:!0}),date:t=>re.create({...t,coerce:!0})},fr=y;var Be=Object.freeze({__proto__:null,defaultErrorMap:ce,setErrorMap:fs,getErrorMap:Oe,makeIssue:Ie,EMPTY_PATH:ps,addIssueToContext:m,ParseStatus:I,INVALID:y,DIRTY:ie,OK:A,isAborted:Fe,isDirty:We,isValid:pe,isAsync:ge,get util(){return b},get objectUtil(){return qe},ZodParsedType:h,getParsedType:K,ZodType:_,datetimeRegex:ht,ZodString:P,ZodNumber:Q,ZodBigInt:X,ZodBoolean:xe,ZodDate:re,ZodSymbol:$e,ZodUndefined:ye,ZodNull:ve,ZodAny:le,ZodUnknown:se,ZodNever:J,ZodVoid:Pe,ZodArray:L,ZodObject:T,ZodUnion:_e,ZodDiscriminatedUnion:Ve,ZodIntersection:be,ZodTuple:B,ZodRecord:we,ZodMap:Le,ZodSet:ae,ZodFunction:oe,ZodLazy:ke,ZodLiteral:je,ZodEnum:ee,ZodNativeEnum:Ne,ZodPromise:de,ZodEffects:M,ZodTransformer:M,ZodOptional:U,ZodNullable:te,ZodDefault:Te,ZodCatch:Se,ZodNaN:Me,BRAND:Zs,ZodBranded:Ke,ZodPipeline:Re,ZodReadonly:Ce,custom:pt,Schema:_,ZodSchema:_,late:Os,get ZodFirstPartyTypeKind(){return x},coerce:hr,any:Vs,array:qs,bigint:$s,boolean:yt,date:Ps,discriminatedUnion:Ys,effect:rt,enum:rr,function:er,instanceof:Is,intersection:Gs,lazy:tr,literal:sr,map:Qs,nan:As,nativeEnum:ar,never:zs,null:Ds,nullable:or,number:xt,object:Fs,oboolean:mr,onumber:ur,optional:ir,ostring:dr,pipeline:lr,preprocess:cr,promise:nr,record:Ks,set:Xs,strictObject:Ws,string:gt,symbol:Ls,transformer:rt,tuple:Js,undefined:Ms,union:Hs,unknown:Us,void:Bs,NEVER:fr,ZodIssueCode:d,quotelessJson:hs,ZodError:$});function pr(t){if(!t)return null;try{return new URL(t.startsWith("http")?t:`https://${t}`).hostname.replace(/^www\./i,"").toLowerCase()}catch{return null}}function gr(t){const e=t.toLowerCase().split("@");return e.length!==2?null:e[1]}const xr=Be.object({email:Be.string().trim().email("Enter a valid email").max(255),message:Be.string().trim().min(40,"Please write at least 40 characters explaining your ownership").max(1e3)});function yr({isOpen:t,onClose:e,toolId:s,toolName:r,toolUrl:a}){const{user:i}=De(),{toast:o}=Ee(),c=jt(),[u,l]=R.useState(""),[f,k]=R.useState(""),[g,w]=R.useState(!1),N=R.useMemo(()=>pr(a),[a]),S=async()=>{if(!i){c("/auth");return}const j=xr.safeParse({email:u,message:f});if(!j.success){o({title:"Check the form",description:j.error.issues[0].message,variant:"destructive"});return}const D=gr(j.data.email);if(!N||!D||D!==N){o({title:"Email domain must match the tool",description:`Use an official email at @${N??"the tool's domain"} so we can verify ownership.`,variant:"destructive"});return}w(!0);try{const{error:q}=await V.from("tool_claims").insert({tool_id:s,claimant_user_id:i.id,claimant_email:j.data.email,message:j.data.message});if(q)if(q.code==="23505")o({title:"Claim already submitted",description:"You already have a pending claim for this tool."});else throw q;else o({title:"Claim submitted",description:"An admin will review your claim shortly. You'll be notified by email."}),e()}catch(q){o({title:"Could not submit claim",description:q.message||"Try again later.",variant:"destructive"})}finally{w(!1)}};return n.jsx(Dt,{open:t,onOpenChange:j=>!j&&e(),children:n.jsxs(Vt,{className:"sm:max-w-lg",children:[n.jsxs(Ut,{children:[n.jsxs(zt,{children:["Claim ",r]}),n.jsxs(Bt,{children:["If you own or work for this tool, claim it to manage the listing. Use an official email at"," ",n.jsxs("span",{className:"font-semibold",children:["@",N??"your tool's domain"]})," so we can verify ownership."]})]}),i?n.jsxs("div",{className:"space-y-4 py-2",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(et,{htmlFor:"claim-email",children:"Official email"}),n.jsx(Nt,{id:"claim-email",type:"email",placeholder:N?`you@${N}`:"[email protected]",value:u,onChange:j=>l(j.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(et,{htmlFor:"claim-message",children:"Why are you the owner?"}),n.jsx(nt,{id:"claim-message",rows:5,placeholder:"Tell us your role at the company and any context that proves ownership (minimum 40 characters).",value:f,onChange:j=>k(j.target.value)}),n.jsxs("p",{className:"text-xs text-gray-500",children:[f.trim().length,"/40 minimum characters"]})]})]}):n.jsxs("div",{className:"space-y-4 py-2",children:[n.jsx("p",{className:"text-sm text-gray-600",children:"You need to sign in before claiming a tool."}),n.jsx(C,{onClick:()=>c("/auth"),className:"w-full",children:"Sign in to continue"})]}),i&&n.jsxs(qt,{children:[n.jsx(C,{variant:"outline",onClick:e,disabled:g,children:"Cancel"}),n.jsx(C,{onClick:S,disabled:g,children:g?"Submitting…":"Submit claim"})]})]})})}const vr=({tool:t})=>{const{user:e}
16=De(),{toggleFavorite:s,checkIsFavorited:r}=Tt(),{toast:a}=Ee(),[i,o]=St(),[c,u]=R.useState(!1),[l,f]=R.useState(!1),[k,g]=R.useState(!1),[w,N]=R.useState(!1),[S,j]=R.useState(!1);R.useEffect(()=>{if(i.get("claim")==="1"){f(!0);const E=new URLSearchParams(i);E.delete("claim"),o(E,{replace:!0})}},[i,o]),R.useEffect(()=>{if(!e)return;let E=!1;return(async()=>{const{data:F}=await V.from("tool_claims").select("id").eq("tool_id",t.id).eq("claimant_user_id",e.id).limit(1);E||g(!!F&&F.length>0)})(),()=>{E=!0}},[e,t.id]),Ge.useEffect(()=>{if(!e)return;(async()=>{try{const F=await r(t.id);N(F)}catch(F){console.error("Error checking favorite status:",F)}})()},[e,t.id,r]);const D=async()=>{if(!e){a({title:"Authentication required",description:"Please log in to save tools to your favorites",variant:"destructive"});return}j(!0);try{await s(t.id)&&(N(!w),a({title:w?"Removed from favorites":"Added to favorites",description:w?"Tool removed from your favorites":"Tool saved to your favorites"}))}catch(E){console.error("Error toggling favorite:",E),a({title:"Error",description:"Failed to update favorite status",variant:"destructive"})}finally{j(!1)}},q=()=>{t.tool_url&&window.open(t.tool_url,"_blank")},bt=E=>n.jsxs("div",{className:"flex items-center gap-1",children:[[1,2,3,4,5].map(F=>n.jsx(ue,{className:`w-4 h-4 ${F<=E?"text-yellow-400 fill-current":"text-gray-300"}`},F)),n.jsxs("span",{className:"ml-2 text-sm text-gray-600",children:[E>0?E.toFixed(1):"0.0"," (",t.total_reviews," reviews)"]})]}),wt=E=>{switch(E.toLowerCase()){case"free":return"bg-green-100 text-green-800 border-green-200";case"freemium":return"bg-blue-100 text-blue-800 border-blue-200";case"paid":return"bg-orange-100 text-orange-800 border-orange-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},kt=E=>{switch(E.toLowerCase()){case"premium":return n.jsx(H,{className:"bg-purple-100 text-purple-800 border-purple-200",children:"Premium"});case"featured":return n.jsx(H,{className:"bg-yellow-100 text-yellow-800 border-yellow-200",children:"Featured"});case"standard":return n.jsx(H,{className:"bg-blue-100 text-blue-800 border-blue-200",children:"Standard"});default:return null}};return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx("div",{className:"w-24 h-24 rounded-2xl bg-white border-2 border-gray-100 flex items-center justify-center overflow-hidden",children:t.icon_url?n.jsx("img",{src:t.icon_url,alt:t.name,className:"w-16 h-16 object-contain"}):n.jsx("div",{className:"w-16 h-16 bg-gradient-to-br from-yellow-400 to-orange-500 rounded-xl flex items-center justify-center",children:n.jsx("span",{className:"text-white font-bold text-xl",children:t.name.charAt(0).toUpperCase()})})})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex flex-wrap items-start gap-3 mb-4",children:[n.jsx("h1",{className:"text-3xl font-bold text-black leading-tight",children:t.name}),n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.is_verified&&n.jsx(H,{className:"bg-green-100 text-green-800 border-green-200",children:"✓ Verified"}),t.has_golden_verification&&n.jsx(H,{className:"bg-yellow-100 text-yellow-800 border-yellow-200",children:"⭐ Golden"}),kt(t.tier),n.jsx(H,{className:`border ${wt(t.price_type)}`,variant:"outline",children:t.price_type}),(t.main_category||t.category)&&n.jsx(H,{variant:"outline",className:"text-gray-600",children:t.main_category||t.category})]})]}),t.description&&n.jsx("p",{className:"text-gray-700 text-lg leading-relaxed mb-6",children:t.description}),n.jsxs("div",{className:"flex flex-wrap items-center gap-6 mb-6",children:[bt(t.average_rating||0),t.view_count>0&&n.jsxs("div",{className:"flex items-center gap-1 text-gray-600",children:[n.jsx(Ct,{className:"w-4 h-4"}),n.jsxs("span",{className:"text-sm",children:[t.view_count.toLocaleString()," views"]})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.tool_url&&n.jsxs(C,{onClick:q,className:"bg-yellow-400 text-black hover:bg-yellow-500 rounded-xl px-6 py-3 font-semibold",children:[n.jsx(Je,{className:"w-4 h-4 mr-2"}),"Try ",t.name]}),n.jsx(C,{variant:"outline",onClick:D,disabled:S,className:`rounded-xl px-6 py-3 font-semibold border-2 ${w?"bg-red-50 border-red-200 text-red-700 hover:bg-red-100":"border-gray-200 text-gray-700 hover:bg-gray-50"}`,children:w?n.jsxs(n.Fragment,{children:[n.jsx(ds,{className:"w-4 h-4 mr-2"}),"Saved"]}):n.jsxs(n.Fragment,{children:[n.jsx(Ft,{className:"w-4 h-4 mr-2"}),"Save Tool"]})}),n.jsxs(C,{variant:"outline",onClick:()=>u(!0),className:"rounded-xl px-6 py-3 font-semibold border-2 border-gray-200 text-gray-700 hover:bg-gray-50",children:[n.jsx(Wt,{className:"w-4 h-4 mr-2"}),"Share"]}),(!e||e.id!==t.user_id)&&!k&&n.jsxs(C,{variant:"outline",onClick:()=>f(!0),className:"rounded-xl px-6 py-3 font-semibold border-2 border-yellow-300 text-yellow-900 bg-yellow-50 hover:bg-yellow-100",title:"Are you the owner of this tool?",children:[n.jsx(Et,{className:"w-4 h-4 mr-2"}),"Claim this tool"]})]})]})]}),n.jsx(Mt,{isOpen:c,onClose:()=>u(!1),toolName:t.name,toolUrl:t.tool_url||""}),n.jsx(yr,{isOpen:l,onClose:()=>f(!1),toolId:t.id,toolName:t.name,toolUrl:t.tool_url})]})},_r=({tool:t})=>{var s,r;const e=a=>{if(!a)return null;if(/<[^>]*>/.test(a)){const o=Gt(a);return n.jsx("div",{className:"bt-tool-rich-text prose prose-sm max-w-none text-gray-700",dangerouslySetInnerHTML:{__html:o}})}else return n.jsx("p",{className:"text-gray-700 leading-relaxed whitespace-pre-line",children:a})};return n.jsx(Z,{className:"rounded-2xl border-2 border-gray-100",children:n.jsxs(O,{className:"p-6",children:[t.functionality_description&&n.jsxs("div",{className:"mb-6",children:[n.jsx("h4",{className:"text-lg font-semibold text-black mb-3",children:"How it works"}),e(t.functionality_description)]}),t.target_audience&&n.jsxs("div",{className:"mb-6",children:[n.jsx("h4",{className:"text-lg font-semibold text-black mb-3",children:"Perfect for"}),n.jsx("p",{className:"text-gray-700 leading-relaxed",children:t.target_audience})]}),(((s=t.pros)==null?void 0:s.length)||((r=t.cons)==null?void 0:r.length))&&n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[t.pros&&t.pros.length>0&&n.jsxs("div",{children:[n.jsxs("h4",{className:"text-lg font-semibold text-green-700 mb-3 flex items-center gap-2",children:[n.jsx(Jt,{className:"w-5 h-5"}),"Pros"]}),n.jsx("ul",{className:"space-y-2",children:t.pros.map((a,i)=>n.jsxs("li",{className:"text-gray-700 flex items-start gap-2",children:[n.jsx("span",{className:"text-green-500 mt-1",children:"•"}),a]},i))})]}),t.cons&&t.cons.length>0&&n.jsxs("div",{children:[n.jsxs("h4",{className:"text-lg font-semibold text-red-700 mb-3 flex items-center gap-2",children:[n.jsx(Kt,{className:"w-5 h-5"}),"Cons"]}),n.jsx("ul",{className:"space-y-2",children:t.cons.map((a,i)=>n.jsxs("li",{className:"text-gray-700 flex items-start gap-2",children:[n.jsx("span",{className:"text-red-500 mt-1",children:"•"}),a]},i))})]})]})]})})},br=({tool:t,authorTools:e})=>
16{if(!t.is_author||!t.author_name)return null;let s=null;try{t.social_links&&typeof t.social_links=="object"&&(s=t.social_links)}catch(r){console.error("Error parsing social links:",r)}return n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsxs(G,{className:"text-2xl text-black flex items-center gap-3",children:[n.jsx(es,{className:"w-6 h-6"}),"About the Creator"]})}),n.jsxs(O,{children:[n.jsxs("div",{className:"mb-6",children:[n.jsx(Qt,{userId:t.user_id||"",userName:t.author_name,showAvatar:!1,className:"text-lg font-semibold"}),n.jsxs("p",{className:"text-gray-600 mt-2",children:["Creator of ",t.name]}),s&&(s.website||s.twitter||s.linkedin||s.github)&&n.jsxs("div",{className:"flex flex-wrap gap-2 mt-4",children:[s.website&&n.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:n.jsxs("a",{href:s.website,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(at,{className:"w-4 h-4 mr-2"}),"Website"]})}),s.twitter&&n.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:n.jsxs("a",{href:s.twitter,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(ms,{className:"w-4 h-4 mr-2"}),"Twitter"]})}),s.linkedin&&n.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:n.jsxs("a",{href:s.linkedin,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(ts,{className:"w-4 h-4 mr-2"}),"LinkedIn"]})}),s.github&&n.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:n.jsxs("a",{href:s.github,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(us,{className:"w-4 h-4 mr-2"}),"GitHub"]})})]})]}),e.length>0&&n.jsxs("div",{children:[n.jsxs("h4",{className:"text-lg font-semibold text-black mb-4",children:["Other tools by ",t.author_name]}),n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:e.slice(0,4).map(r=>{var i;const a=r.slug||`${(i=r.name)==null?void 0:i.toLowerCase().replace(/\s+/g,"-")}-${r.main_category||r.category||"others"}`.replace(/\s+/g,"-");return n.jsx(fe,{to:`/tool/${a}`,children:n.jsx(Z,{className:"hover:shadow-md transition-shadow",children:n.jsxs(O,{className:"p-4",children:[n.jsx("h5",{className:"font-semibold text-black mb-2",children:r.name}),n.jsx("p",{className:"text-sm text-gray-600 line-clamp-2",children:r.description})]})})},r.id)})}),e.length>4&&n.jsx("div",{className:"mt-4",children:n.jsx(fe,{to:`/user/${t.user_id}`,children:n.jsxs(C,{variant:"outline",className:"rounded-xl",children:["View All Tools by ",t.author_name]})})})]})]})]})},wr=({tool:t})=>{if(!t.video_demo_url||it(t.quick_demo_url,t.video_demo_url))return null;const e=ot(t.video_demo_url);return e?n.jsxs(Z,{className:"bt-youtube-embed rounded-2xl border-2 border-gray-100 overflow-hidden",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-2xl text-black",children:"Demo Video"})}),n.jsx(O,{className:"p-0",children:n.jsx("div",{className:"relative aspect-video w-full overflow-hidden bg-black",children:n.jsx("iframe",{src:ct(e),title:`${t.name} demo video`,className:"absolute inset-0 h-full w-full max-w-full",style:{border:"none",display:"block"},allow:"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0})})})]}):n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-2xl text-black",children:"Demo Video"})}),n.jsx(O,{children:n.jsxs("div",{className:"aspect-video bg-gray-100 rounded-xl flex items-center justify-center relative overflow-hidden",children:[t.image_url?n.jsx("img",{src:t.image_url,alt:t.name,className:"w-full h-full object-cover"}):n.jsxs("div",{className:"text-center",children:[n.jsx(tt,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),n.jsx("p",{className:"text-gray-500",children:"Demo video available"})]}),n.jsx("div",{className:"absolute inset-0 bg-black/40 flex items-center justify-center",children:n.jsx(C,{asChild:!0,size:"lg",className:"bg-white text-black hover:bg-gray-100 rounded-full",children:n.jsxs("a",{href:t.video_demo_url,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(tt,{className:"w-6 h-6 mr-2"}),"Watch Demo",n.jsx(Je,{className:"w-4 h-4 ml-2"})]})})})]})})]})},kr=({url:t,title:e})=>{const s=ot(t);if(!s)return null;const r=ct(s);return n.jsx(Z,{className:"bt-youtube-embed rounded-2xl border-2 border-gray-100 mb-8 overflow-hidden",children:n.jsx(O,{className:"p-0",children:n.jsx("div",{className:"relative aspect-video w-full overflow-hidden bg-black",children:n.jsx("iframe",{src:r,title:`${e} - Quick Demo`,className:"absolute inset-0 h-full w-full max-w-full",style:{border:"none",display:"block"},allow:"accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0})})})})},jr=({prompts:t})=>{const{toast:e}=Ee();if(!t||t.length===0)return null;const s=r=>{navigator.clipboard.writeText(r),e({title:"Copied!",description:"Prompt copied to clipboard"})};return n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-2xl text-black",children:"Example Prompts"})}),n.jsx(O,{className:"space-y-4",children:t.filter(r=>r.trim()!=="").map((r,a)=>n.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-xl",children:[n.jsxs("div",{className:"flex-1",children:[n.jsxs("p",{className:"text-gray-700 font-medium",children:["Prompt ",a+1,":"]}),n.jsx("p",{className:"text-gray-600 mt-1",children:r})]}),n.jsx(C,{variant:"outline",size:"sm",onClick:()=>s(r),className:"ml-4 rounded-xl border-2 border-gray-300 hover:bg-white",children:n.jsx(ss,{className:"w-4 h-4"})})]},a))})]})},Nr=({tool:t})=>{const e=s=>{switch(s){case"Free":return"bg-green-100 text-green-800 border-green-300";case"Freemium":return"bg-blue-100 text-blue-800 border-blue-300";case"Paid":return"bg-orange-100 text-orange-800 border-orange-300";default:return"bg-gray-100 text-gray-800 border-gray-300"}};return n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-xl text-black",children:"Pricing & Details"})}),n.jsx(O,{children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("span",{className:"text-gray-600",children:"Price Type:"}),n.jsx(H,{className:e(t.price_type),children:t.price_type})]}),t.pricing_details&&n.jsxs("div",{children:[n.jsx("span",{className:"text-gray-600 block mb-2",children:"Pricing Details:"}),n.jsx("p",{className:"text-sm text-gray-700",children:t.pricing_details})]}),t.discount_percentage&&t.discount_percentage>0&&n.jsxs("div",{className:"bg-red-50 p-4 rounded-xl border border-red-200",children:[n.jsxs("div",{className:"text-red-700 font-semibold",children:[t.discount_percentage,"% OFF"]}),t.discount_code&&n.jsxs("div",{className:"text-sm text-red-600 mt-1",children:["Code: ",n.jsx("span",{className:"font-mono font-bold",children:t.discount_code})]})]}),t.website_url&&n.jsx(C,{variant:"outline",asChild:!0,className:"w-full",children:n.jsxs("a",{href:t.website_url,target:"_blank",rel:"noopener noreferrer",children:[n.jsx(at,{className:"w-4 h-4 mr-2"}),"Official Website"]})})]})})]})},Tr=({tool:t})=>{if(!t.tool_ranking)return null;const e=s=>n.jsx("div",{className:"flex items-center gap-1",children:[1,2,3,4,5].map(r=>n.jsx(ue,{className:`w-4 h-4 ${r<=s?"text-yellow-400 fill-current":"text-gray-300"}`},r))});return n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-xl text-black",children:"Creator's Rating"})}),n.jsx(O,{children:n.jsxs("div",{className:"text-center",children:[e(t.tool_ranking),n.jsxs("p",{className:"text-sm text-gray-600 mt-2",children:["Rated ",t.tool_ranking,"/5 by the creator"]})]})})]})},Sr=({toolId:t,onReviewSubmitted:e})=>
16{const[s,r]=R.useState(0),[a,i]=R.useState(""),[o,c]=R.useState(!1),{user:u}=De(),{toast:l}=Ee(),{moderateContent:f}=Ht(),k=40,g=a.trim().length>=k,w=s>0&&g&&!o,N=async S=>{if(S.preventDefault(),!u){l({title:"Authentication required",description:"Please log in to submit a review",variant:"destructive"});return}if(s===0){l({title:"Rating required",description:"Please select a rating",variant:"destructive"});return}if(!g){l({title:"Review too short",description:`Please write at least ${k} characters for a helpful review`,variant:"destructive"});return}c(!0);try{const{data:j,error:D}=await V.from("reviews").insert({tool_id:t,user_id:u.id,rating:s,content:a.trim()}).select().single();if(D)throw D;await f(a.trim(),"review"),V.functions.invoke("analyze-content",{body:{contentIds:[j.id],type:"review"}}).catch(q=>console.warn("Auto-analysis failed:",q)),l({title:"Review submitted!",description:"Thank you for your detailed feedback. You earned 2 points!"}),r(0),i(""),e()}catch(j){console.error("Error submitting review:",j),l({title:"Error",description:"Failed to submit review. Please try again.",variant:"destructive"})}finally{c(!1)}};return u?n.jsx(Z,{className:"bg-white border-gray-200",children:n.jsxs(O,{className:"p-6",children:[n.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Write a Review"}),n.jsxs("form",{onSubmit:N,className:"space-y-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Rating *"}),n.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(S=>n.jsx("button",{type:"button",onClick:()=>r(S),className:"focus:outline-none",children:n.jsx(ue,{className:`w-6 h-6 ${S<=s?"text-yellow-400 fill-current":"text-gray-300"}`})},S))})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:["Write a helpful review (min ",k," chars) *"]}),n.jsx(nt,{value:a,onChange:S=>i(S.target.value),placeholder:"Share your detailed experience with this tool. What did you like? How did it help you? What could be improved?",rows:4,className:"w-full"}),n.jsxs("div",{className:"flex justify-between items-center mt-1",children:[n.jsxs("span",{className:`text-sm ${a.trim().length>=k?"text-green-600":"text-red-500"}`,children:[a.trim().length,"/",k," characters"]}),a.trim().length<k&&n.jsxs("span",{className:"text-xs text-gray-500",children:[k-a.trim().length," more needed"]})]})]}),n.jsx(C,{type:"submit",disabled:!w,className:"w-full bg-yellow-400 text-black hover:bg-yellow-500 disabled:bg-gray-300 disabled:text-gray-500",children:o?"Submitting...":w?"Submit Review (+2 points)":"Complete Required Fields"})]})]})}):n.jsx(Z,{className:"bg-white border-gray-200",children:n.jsxs(O,{className:"p-6 text-center",children:[n.jsx("p",{className:"text-gray-600 mb-4",children:"Please log in to submit a review"}),n.jsx(C,{onClick:()=>window.location.href="/auth",children:"Log In"})]})})},Cr=({reviews:t,onReviewsUpdate:e})=>{const{user:s}=De(),{toast:r}=Ee(),{canModerate:a}=is();Xt();const[i,o]=R.useState(new Set),[c,u]=R.useState(new Set);Ge.useEffect(()=>{if(!s||t.length===0)return;(async()=>{try{const{data:w,error:N}=await V.from("review_votes").select("review_id").eq("user_id",s.id).eq("vote_type","like").in("review_id",t.map(j=>j.id));if(N)throw N;const S=new Set(w.map(j=>j.review_id));o(S)}catch(w){console.error("Error checking user likes:",w)}})()},[s,t]);const l=async g=>{if(!s){r({title:"Authentication required",description:"Please log in to like reviews",variant:"destructive"});return}if(!c.has(g)){u(w=>new Set([...w,g]));try{if(i.has(g)){const{error:N}=await V.from("review_votes").delete().eq("user_id",s.id).eq("review_id",g).eq("vote_type","like");if(N)throw N;const{error:S}=await V.rpc("update_review_like_count",{review_id:g,increment:!1});if(S)throw S;o(j=>{const D=new Set(j);return D.delete(g),D}),r({title:"Like removed",description:"You've removed your like from this review"})}else{const{error:N}=await V.from("review_votes").insert({user_id:s.id,review_id:g,vote_type:"like"});if(N)throw N;const{error:S}=await V.rpc("update_review_like_count",{review_id:g,increment:!0});if(S)throw S;o(j=>new Set([...j,g])),r({title:"Review liked!",description:"Thanks for your feedback"})}e()}
16catch(w){console.error("Error handling review like:",w),r({title:"Error",description:"Failed to update like status",variant:"destructive"})}finally{u(w=>{const N=new Set(w);return N.delete(g),N})}}},f=g=>n.jsxs("div",{className:"flex items-center gap-0.5",children:[[1,2,3,4,5].map(w=>n.jsx(ue,{className:`w-3.5 h-3.5 ${w<=g?"text-amber-400 fill-current":"text-muted-foreground/30"}`},w)),n.jsxs("span",{className:"ml-1 text-xs text-muted-foreground font-medium",children:[g,"/5"]})]}),k=g=>new Date(g).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});return t.length===0?n.jsx("div",{className:"text-center py-8",children:n.jsx("p",{className:"text-muted-foreground",children:"No reviews yet. Be the first to review this tool!"})}):n.jsx("div",{className:"space-y-4",children:t.map(g=>n.jsx(Z,{className:"border border-border rounded-xl overflow-hidden hover:shadow-md transition-shadow",children:n.jsx(O,{className:"p-4 sm:p-5",children:n.jsxs("div",{className:"flex flex-col gap-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:"flex-shrink-0",children:n.jsx(as,{src:g.user_profile_pic||void 0,fallback:g.user_name?g.user_name[0].toUpperCase():"U",userId:g.user_id,className:"w-10 h-10",badgeSize:"sm",showStatusOverlay:!0})}),n.jsxs("div",{className:"flex-1 min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("h4",{className:"font-semibold text-foreground text-sm sm:text-base",children:g.user_name||"Anonymous User"}),n.jsx(os,{isHidden:g.is_hidden||!1})]}),n.jsxs("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[n.jsx(ns,{totalPoints:g.user_total_points||0,isAdmin:g.user_email==="[email protected]",size:"sm",showText:!0}),n.jsx("span",{className:"text-muted-foreground text-xs",children:"•"}),n.jsx("span",{className:"text-muted-foreground text-xs whitespace-nowrap",children:k(g.created_at)})]})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f(g.rating),a&&n.jsx(cs,{contentType:"review",contentId:g.id,isHidden:g.is_hidden||!1,onModerationAction:e})]})]}),g.content&&n.jsx("div",{className:`${g.is_hidden?"opacity-60":""}`,children:n.jsx("p",{className:"text-foreground/80 leading-relaxed text-sm sm:text-base break-words",children:g.content})}),n.jsx("div",{className:"flex items-center pt-1",children:n.jsxs(C,{variant:"ghost",size:"sm",className:`flex items-center gap-1.5 h-8 px-2.5 text-xs sm:text-sm ${i.has(g.id)?"text-primary bg-primary/10 hover:bg-primary/20":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,onClick:()=>l(g.id),disabled:c.has(g.id),children:[n.jsx(Rt,{className:`w-3.5 h-3.5 ${i.has(g.id)?"fill-current":""}`}),n.jsx("span",{className:"font-medium",children:g.like_count}),n.jsx("span",{className:"hidden sm:inline",children:i.has(g.id)?"Liked":"Like"})]})})]})})},g.id))})},Er=({toolId:t,toolName:e})=>{const[s,r]=R.useState(!1),a=Zt();Ge.useEffect(()=>{(async()=>{const{data:{user:f}}=await V.auth.getUser();r(!!f)})()},[]);const{data:i=[],isLoading:o}=Ze({queryKey:["reviews",t],queryFn:()=>rs(t)}),c=()=>{a.invalidateQueries({queryKey:["reviews",t]})},u=i.length>0?i.reduce((l,f)=>l+f.rating,0)/i.length:0;return o?n.jsx(Z,{className:"rounded-2xl border-2 border-gray-100",children:n.jsx(O,{className:"p-8",children:n.jsxs("div",{className:"animate-pulse space-y-4",children:[n.jsx("div",{className:"h-6 bg-gray-200 rounded w-1/3"}),n.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),n.jsx("div",{className:"space-y-3",children:[1,2,3].map(l=>n.jsx("div",{className:"h-20 bg-gray-200 rounded"},l))})]})})}):n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{className:"pb-4 sm:pb-6",children:n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[n.jsx(G,{className:"text-lg sm:text-xl lg:text-2xl text-black",children:"Reviews & Ratings"}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsx(ue,{className:"w-4 h-4 sm:w-5 sm:h-5 text-yellow-400 fill-current"}),n.jsx("span",{className:"text-base sm:text-lg font-semibold",children:u.toFixed(1)}),n.jsxs("span",{className:"text-sm sm:text-base text-gray-600",children:["(",i.length," reviews)"]})]})]})}
16),n.jsxs(O,{className:"space-y-4 sm:space-y-6",children:[n.jsx(Sr,{toolId:t,onReviewSubmitted:c}),n.jsx(Cr,{reviews:i,onReviewsUpdate:c})]})]})},Rr=({relatedTools:t})=>{const e=t.filter(a=>a.is_verified===!0);if(e.length===0)return null;const s=a=>{switch(a){case"Free":return"bg-green-100 text-green-800 border-green-300";case"Freemium":return"bg-blue-100 text-blue-800 border-blue-300";case"Paid":return"bg-orange-100 text-orange-800 border-orange-300";default:return"bg-gray-100 text-gray-800 border-gray-300"}},r=a=>a.slug?`/tool/${a.slug}`:`/tool/${a.name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim()}-${a.id}`;return n.jsxs("div",{className:"mt-16",children:[n.jsx("h3",{className:"text-3xl font-bold text-black mb-8",children:"Related Tools"}),n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:e.map(a=>n.jsx(fe,{to:r(a),children:n.jsxs(Z,{className:"hover:shadow-xl transition-all duration-300 rounded-2xl border-2 border-gray-100 hover:border-yellow-400",children:[n.jsx(Y,{children:n.jsx(G,{className:"text-lg",children:a.name})}),n.jsxs(O,{children:[n.jsx("p",{className:"text-gray-600 text-sm line-clamp-3 mb-4",children:a.description}),n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx(H,{className:s(a.price_type),children:a.price_type}),a.average_rating&&a.average_rating>0&&n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ue,{className:"w-4 h-4 text-yellow-400 fill-current"}),n.jsx("span",{className:"text-sm",children:a.average_rating.toFixed(1)})]})]})]})]})},a.id))})]})},Zr=({alternatives:t})=>!t||t.length===0?null:n.jsxs(Z,{className:"rounded-2xl border-2 border-gray-100",children:[n.jsx(Y,{children:n.jsxs(G,{className:"text-2xl text-black flex items-center gap-3",children:[n.jsx(Je,{className:"w-6 h-6"}),"Alternative Tools"]})}),n.jsx(O,{children:n.jsx("ul",{className:"space-y-3",children:t.map((e,s)=>n.jsxs("li",{className:"text-gray-700 flex items-start gap-2",children:[n.jsx("span",{className:"text-primary mt-1",children:"•"}),n.jsx("span",{children:e})]},s))})})]}),vt=(t,e=160)=>{if(t.length<=e)return t;const s=t.substring(0,e),r=s.lastIndexOf(" ");return r>0?s.substring(0,r)+"...":s+"..."},_t=(t,e)=>`${t} - ${e} - Reviews, Prices, Info and Tutorials | BeyondTools AI Directory`,Or=(t,e)=>({"@context":"https://schema.org","@type":"WebPage",name:_t(t.name,t.category||t.main_category||""),url:e,description:vt(t.description||"",160),inLanguage:"en",breadcrumb:{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Home",item:`${Qe.baseUrl}/`},{"@type":"ListItem",position:2,name:"Tools",item:`${Qe.baseUrl}/tools`},{"@type":"ListItem",position:3,name:`${t.name} ${t.category||t.main_category||""}`}]},mainEntity:{"@type":"SoftwareApplication",name:t.name,description:t.description,applicationCategory:t.category||t.main_category,operatingSystem:"Web",url:t.tool_url,offers:t.price_type&&t.price_type!=="Free"?{"@type":"Offer",priceRange:t.price_type==="Freemium"?"Free - Paid":"Paid",priceCurrency:"USD"}:{"@type":"Offer",price:"0",priceCurrency:"USD"},aggregateRating:t.average_rating&&t.total_reviews?{"@type":"AggregateRating",ratingValue:t.average_rating,reviewCount:t.total_reviews,bestRating:"5",worstRating:"1"}:void 0}}),ya=()=>{const{slug:t}=Ot(),{data:e,isLoading:s,error:r}=Ze({queryKey:["tool",t],queryFn:()=>{if(!t)throw new Error("No slug provided");return Lt(t)},enabled:!!t}),{data:a=[]}=Ze({queryKey:["authorTools",e==null?void 0:e.user_id],queryFn:()=>$t(e.user_id),enabled:!!(e!=null&&e.user_id&&(e!=null&&e.is_author))}),{data:i=[]}=Ze({queryKey:["relatedTools",e==null?void 0:e.category,e==null?void 0:e.id],queryFn:()=>Pt(e.category||e.main_category,e.id),enabled:!!(e!=null&&e.category||e!=null&&e.main_category)});if(s)return n.jsxs("div",{className:"min-h-screen bg-background",children:[n.jsx(Ue,{}),n.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 sm:py-12",children:n.jsxs("div",{className:"animate-pulse space-y-8",children:[n.jsx("div",{className:"h-8 bg-gray-200 rounded w-1/3"}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-12",children:[n.jsxs("div",{className:"lg:col-span-2 space-y-8",children:[n.jsx("div",{className:"h-12 bg-gray-200 rounded w-2/3"}),n.jsx("div",{className:"h-64 bg-gray-200 rounded-2xl"})]}),n.jsx("div",{className:"space-y-6",children:n.jsx("div",{className:"h-96 bg-gray-200 rounded-2xl"})})]})]})})]});if(r||!e)return n.jsxs("div",{className:"min-h-screen bg-background",children:[n.jsx(Ue,{}),n.jsx("div",{className:"flex items-center justify-center min-h-[60vh] px-4",children:n.jsxs("div",{className:"text-center",children:[n.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground mb-4",children:"Tool Not Found"}),n.jsx("p",{className:"text-muted-foreground mb-8",children:"The tool you're looking for doesn't exist or may have been removed."}),n.jsx(fe,{to:"/tools",children:n.jsx(C,{variant:"brand",className:"rounded-xl",children:"Browse All Tools"})})]})}),n.jsx(Xe,{})]});const o=e.main_category||e.category||"Other / Experimental",c=It(o),u=[{name:"Home",item:"/"},{name:"Tools",item:"/tools"},{name:o,item:`/${c}`},{name:e.name}],l=`https://beyondtools.io/tool/${e.slug}`,f=_t(e.name,o),k=vt(e.description||"",160),g=Or(e,l),w=!!e.quick_demo_url,N=!!(e.image_url&&e.image_url!==e.icon_url&&String(e.image_url).includes("/ai-tool-icons/ai-generated/")),S=!!(e.video_demo_url&&!it(e.quick_demo_url,e.video_demo_url));return n.jsxs("div",{className:"min-h-screen bg-background",children:[n.jsx(At,{title:f,description:k,canonicalUrl:l,breadcrumbs:u,schema:g}),n.jsx(Ue,{}),n.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8 lg:py-12",children:[n.jsx(Yt,{items:[{label:"Home",href:"/"},{label:"Tools",href:"/tools"},{label:o,href:`/${c}`},{label:e.name}]}),n.jsxs(fe,{to:`/${c}`,className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6 sm:mb-8 transition-colors text-sm sm:text-base",children:[n.jsx(ls,{className:"w-4 h-4 mr-2"}),"Back to ",o]}),n.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-6 sm:gap-8 lg:gap-12",children:[n.jsxs("div",{className:"xl:col-span-2 space-y-6 sm:space-y-8",children:[n.jsx(vr,{tool:e}),w?n.jsx(kr,{url:e.quick_demo_url,title:e.name}):N?n.jsx("div",{className:"mb-8 overflow-hidden rounded-2xl border-2 border-gray-100 bg-gray-100",children:n.jsx("img",{src:e.image_url,alt:`${e.name} workflow preview`,className:"aspect-video w-full object-cover",loading:"eager"})}):null,n.jsx(_r,{tool:e}),e.example_prompts&&e.example_prompts.length>0&&n.jsx(jr,{prompts:e.example_prompts}),n.jsx(br,{tool:e,authorTools:a}),e.alternative_tools&&e.alternative_tools.length>0&&n.jsx(Zr,{alternatives:e.alternative_tools}),S&&n.jsx(wr,{tool:e})]}
16),n.jsxs("div",{className:"xl:col-span-1 space-y-4 sm:space-y-6",children:[n.jsx(Nr,{tool:e}),n.jsx(Tr,{tool:e}),n.jsx(Er,{toolId:e.id,toolName:e.name})]})]}),n.jsx(Rr,{relatedTools:i})]}),n.jsx(Xe,{})]})};export{ya as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.