@walkeros/web-destination-piwikpro 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es5.js CHANGED
@@ -1 +1 @@
1
- "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _assert_this_initialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function asyncGeneratorStep(e,t,r,n,a,i,o){try{var s=e[i](o),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,a)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function o(e){asyncGeneratorStep(i,n,a,o,s,"next",e)}function s(e){asyncGeneratorStep(i,n,a,o,s,"throw",e)}o(void 0)})}}function _call_super(e,t,r){return t=_get_prototype_of(t),_possible_constructor_return(e,_is_native_reflect_construct()?Reflect.construct(t,r||[],_get_prototype_of(e).constructor):t.apply(e,r))}function _class_call_check(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _construct(e,t,r){return _construct=_is_native_reflect_construct()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var a=new(Function.bind.apply(e,n));return r&&_set_prototype_of(a,r.prototype),a},_construct.apply(null,arguments)}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _create_class(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _get_prototype_of(e){return _get_prototype_of=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},_get_prototype_of(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_set_prototype_of(e,t)}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _is_native_function(e){return-1!==Function.toString.call(e).indexOf("[native code]")}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,i=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw a}}return i}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _object_without_properties(e,t){if(null==e)return{};var r,n,a=_object_without_properties_loose(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function _object_without_properties_loose(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}function _possible_constructor_return(e,t){return!t||"object"!==_type_of(t)&&"function"!=typeof t?_assert_this_initialized(e):t}function _set_prototype_of(e,t){return _set_prototype_of=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_set_prototype_of(e,t)}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _wrap_native_super(e){var t="function"==typeof Map?new Map:void 0;return _wrap_native_super=function(e){if(null===e||!_is_native_function(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return _construct(e,arguments,_get_prototype_of(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),_set_prototype_of(r,e)},_wrap_native_super(e)}function _is_native_reflect_construct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_is_native_reflect_construct=function(){return!!e})()}function _ts_generator(e,t){var r,n,a,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(i=0)),i;)try{if(r=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(6===s[0]&&i.label<a[1]){i.label=a[1],a=s;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(s);break}a[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}var Destination=function(){var e=function(e){se=e},t=function(){return se},r=function(e,r){var n=t(),a=ce({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===oe?void 0:oe].filter(function(e){return!!e})});e.common.issues.push(a)},n=function(e){if(!e)return{};var t=e.errorMap,r=e.invalid_type_error,n=e.required_error,a=e.description;if(t&&(r||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:function(t,a){var i,o,s=e.message;return"invalid_enum_value"===t.code?{message:null!=s?s:a.defaultError}:void 0===a.data?{message:null!==(i=null!=s?s:n)&&void 0!==i?i:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(o=null!=s?s:r)&&void 0!==o?o:a.defaultError}},description:a}},a=function(e){var t="[0-5]\\d";e.precision?t="".concat(t,"\\.\\d{").concat(e.precision,"}"):null==e.precision&&(t="".concat(t,"(\\.\\d+)?"));var r=e.precision?"+":"?";return"([01]\\d|2[0-3]):[0-5]\\d(:".concat(t,")").concat(r)},i=function(e){return new RegExp("^".concat(a(e),"$"))},o=function(e){var t="".concat(Me,"T").concat(a(e)),r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t="".concat(t,"(").concat(r.join("|"),")"),new RegExp("^".concat(t,"$"))},s=function(e,t){return!("v4"!==t&&t||!Te.test(e))||!("v6"!==t&&t||!Ee.test(e))},c=function(e,t){if(!Oe.test(e))return!1;try{var r=_sliced_to_array(e.split("."),1)[0];if(!r)return!1;var n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return"object"===(void 0===a?"undefined":_type_of(a))&&null!==a&&((!("typ"in a)||"JWT"===(null==a?void 0:a.typ))&&(!!a.alg&&(!t||a.alg===t)))}catch(e){return!1}},u=function(e,t){return!("v4"!==t&&t||!Ce.test(e))||!("v6"!==t&&t||!Ne.test(e))},l=function(e,t){var r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return Number.parseInt(e.toFixed(a).replace(".",""))%Number.parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)},d=function(e,t){return new dt(_object_spread({values:e,typeName:wt.ZodEnum},n(t)))},p=function(e,t){var r="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof r?{message:r}:r},f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return e?qe.create().superRefine(function(n,a){var i=e(n);if(_instanceof(i,Promise))return i.then(function(e){if(!e){var i,o,s=p(t,n),c=null===(o=null!==(i=s.fatal)&&void 0!==i?i:r)||void 0===o||o;a.addIssue(_object_spread_props(_object_spread({code:"custom"},s),{fatal:c}))}});if(!i){var o,s,c=p(t,n),u=null===(s=null!==(o=c.fatal)&&void 0!==o?o:r)||void 0===s||s;a.addIssue(_object_spread_props(_object_spread({code:"custom"},c),{fatal:u}))}}):qe.create()},_=function(e,t,r,n){(null==n?void 0:n.errorMessages)&&r&&(e.errorMessage=_object_spread_props(_object_spread({},e.errorMessage),_define_property({},t,r)))},h=function(e,t,r,n,a){e[t]=r,_(e,t,n,a)},m=function(e){if("openAi"!==e.target)return{};var t=_to_consumable_array(e.basePath).concat([e.definitionPath,e.openAiAnyTypeName]);return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?mr(t,e.currentPath):t.join("/")}},y=function(e,t){return Pr(e.type._def,t)},v=function(e,t){var r={type:"string"};if(e.checks){var n=!0,a=!1,i=void 0;try{for(var o,s=e.checks[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;switch(c.kind){case"min":h(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,c.value):c.value,c.message,t);break;case"max":h(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,c.value):c.value,c.message,t);break;case"email":switch(t.emailStrategy){case"format:email":k(r,"email",c.message,t);break;case"format:idn-email":k(r,"idn-email",c.message,t);break;case"pattern:zod":j(r,kr.email,c.message,t)}break;case"url":k(r,"uri",c.message,t);break;case"uuid":k(r,"uuid",c.message,t);break;case"regex":j(r,c.regex,c.message,t);break;case"cuid":j(r,kr.cuid,c.message,t);break;case"cuid2":j(r,kr.cuid2,c.message,t);break;case"startsWith":j(r,RegExp("^".concat(g(c.value,t))),c.message,t);break;case"endsWith":j(r,RegExp("".concat(g(c.value,t),"$")),c.message,t);break;case"datetime":k(r,"date-time",c.message,t);break;case"date":k(r,"date",c.message,t);break;case"time":k(r,"time",c.message,t);break;case"duration":k(r,"duration",c.message,t);break;case"length":h(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,c.value):c.value,c.message,t),h(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,c.value):c.value,c.message,t);break;case"includes":j(r,RegExp(g(c.value,t)),c.message,t);break;case"ip":"v6"!==c.version&&k(r,"ipv4",c.message,t),"v4"!==c.version&&k(r,"ipv6",c.message,t);break;case"base64url":j(r,kr.base64url,c.message,t);break;case"jwt":j(r,kr.jwt,c.message,t);break;case"cidr":"v6"!==c.version&&j(r,kr.ipv4Cidr,c.message,t),"v4"!==c.version&&j(r,kr.ipv6Cidr,c.message,t);break;case"emoji":j(r,kr.emoji(),c.message,t);break;case"ulid":j(r,kr.ulid,c.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":k(r,"binary",c.message,t);break;case"contentEncoding:base64":h(r,"contentEncoding","base64",c.message,t);break;case"pattern:zod":j(r,kr.base64,c.message,t)}break;case"nanoid":j(r,kr.nanoid,c.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:(function(){})()}}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}}return r},g=function(e,t){return"escape"===t.patternStrategy?b(e):e},b=function(e){for(var t="",r=0;r<e.length;r++)jr.has(e[r])||(t+="\\"),t+=e[r];return t},k=function(e,t,r,n){var a;e.format||(null===(a=e.anyOf)||void 0===a?void 0:a.some(function(e){return e.format}))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push(_object_spread({format:e.format},e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}})),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push(_object_spread({format:t},r&&n.errorMessages&&{errorMessage:{format:r}}))):h(e,"format",t,r,n)},j=function(e,t,r,n){var a;e.pattern||(null===(a=e.allOf)||void 0===a?void 0:a.some(function(e){return e.pattern}))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push(_object_spread({pattern:e.pattern},e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}})),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push(_object_spread({pattern:S(t,n)},r&&n.errorMessages&&{errorMessage:{pattern:r}}))):h(e,"pattern",S(t,n),r,n)},S=function(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;for(var r=e.flags.includes("i"),n=e.flags.includes("m"),a=e.flags.includes("s"),i=r?e.source.toLowerCase():e.source,o="",s=!1,c=!1,u=!1,l=0;l<i.length;l++)if(s)o+=i[l],s=!1;else{if(r)if(c){if(i[l].match(/[a-z]/)){var d;u?(o+=i[l],o+="".concat(i[l-2],"-").concat(i[l]).toUpperCase(),u=!1):"-"===i[l+1]&&(null===(d=i[l+2])||void 0===d?void 0:d.match(/[a-z]/))?(o+=i[l],u=!0):o+="".concat(i[l]).concat(i[l].toUpperCase());continue}}else if(i[l].match(/[a-z]/)){o+="[".concat(i[l]).concat(i[l].toUpperCase(),"]");continue}if(n){if("^"===i[l]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[l]){o+="($|(?=[\r\n]))";continue}}a&&"."===i[l]?o+=c?"".concat(i[l],"\r\n"):"[".concat(i[l],"\r\n]"):(o+=i[l],"\\"===i[l]?s=!0:c&&"]"===i[l]?c=!1:c||"["!==i[l]||(c=!0))}try{new RegExp(o)}catch(r){return console.warn("Could not convert regex pattern at ".concat(t.currentPath.join("/")," to a flag-independent form! Falling back to the flag-ignorant source")),e.source}return o},w=function(e,t){var r,n,a,i,o,s,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null===(r=e.keyType)||void 0===r?void 0:r._def.typeName)===wt.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce(function(r,n){var a;return _object_spread_props(_object_spread({},r),_define_property({},n,null!==(a=Pr(e.valueType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["properties",n])})))&&void 0!==a?a:m(t)))},{}),additionalProperties:t.rejectedAdditionalProperties};var u={type:"object",additionalProperties:null!==(c=Pr(e.valueType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["additionalProperties"])})))&&void 0!==c?c:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null===(n=e.keyType)||void 0===n?void 0:n._def.typeName)===wt.ZodString&&(null===(a=e.keyType._def.checks)||void 0===a?void 0:a.length)){var l=v(e.keyType._def,t),d=(l.type,_object_without_properties(l,["type"]));return _object_spread_props(_object_spread({},u),{propertyNames:d})}if((null===(i=e.keyType)||void 0===i?void 0:i._def.typeName)===wt.ZodEnum)return _object_spread_props(_object_spread({},u),{propertyNames:{enum:e.keyType._def.values}});if((null===(o=e.keyType)||void 0===o?void 0:o._def.typeName)===wt.ZodBranded&&e.keyType._def.type._def.typeName===wt.ZodString&&(null===(s=e.keyType._def.type._def.checks)||void 0===s?void 0:s.length)){var p=y(e.keyType._def,t),f=(p.type,_object_without_properties(p,["type"]));return _object_spread_props(_object_spread({},u),{propertyNames:f})}return u},x=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Pr(e.catchall._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["additionalProperties"])}));switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}},P=function(e){try{return e.isOptional()}catch(e){return!0}},O=function(e){return Ar(e,{target:"jsonSchema7",$refStrategy:"none"})},Z=function(e){return Array.isArray(e)},A=function(e){return void 0!==e},T=function(e){return"object"==(void 0===e?"undefined":_type_of(e))&&null!==e&&!Z(e)&&"[object Object]"===Object.prototype.toString.call(e)},C=function(e){return"string"==typeof e},E=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.timestamp||(new Date).setHours(0,13,37,0),r=e.group||"gr0up",n=e.count||1,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r=_object_spread({},Ra,r);var n=Object.entries(t).reduce(function(t,n){var a=_sliced_to_array(n,2),i=a[0],o=a[1],s=e[i];return r.merge&&Array.isArray(s)&&Array.isArray(o)?t[i]=o.reduce(function(e,t){return e.includes(t)?e:_to_consumable_array(e).concat([t])},_to_consumable_array(s)):(r.extend||i in e)&&(t[i]=o),t},{});return r.shallow?_object_spread({},e,n):(Object.assign(e,n),e)}({name:"entity action",data:{string:"foo",number:1,boolean:!0,array:[0,"text",!1],not:void 0},context:{dev:["test",1]},globals:{lang:"elb"},custom:{completely:"random"},user:{id:"us3r",device:"c00k13",session:"s3ss10n"},nested:[{entity:"child",data:{is:"subordinated"},nested:[],context:{element:["child",0]}}],consent:{functional:!0},id:"".concat(t,"-").concat(r,"-").concat(n),trigger:"test",entity:"entity",action:"action",timestamp:t,timing:3.14,group:r,count:n,version:{source:"0.3.0",tagging:1},source:{type:"web",id:"https://localhost:80",previous_id:"http://remotehost:9001"}},e,{merge:!1});if(e.name){var i,o=_sliced_to_array(null!==(i=e.name.split(" "))&&void 0!==i?i:[],2),s=o[0],c=o[1];s&&c&&(a.entity=s,a.action=c)}return a},N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"entity action",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.timestamp||(new Date).setHours(0,13,37,0),n={data:{id:"ers",name:"Everyday Ruck Snack",color:"black",size:"l",price:420}},a={data:{id:"cc",name:"Cool Cap",size:"one size",price:42}};return E(_object_spread_props(_object_spread({},{"cart view":{data:{currency:"EUR",value:2*n.data.price},context:{shopping:["cart",0]},globals:{pagegroup:"shop"},nested:[{entity:"product",data:_object_spread_props(_object_spread({},n.data),{quantity:2}),context:{shopping:["cart",0]},nested:[]}],trigger:"load"},"checkout view":{data:{step:"payment",currency:"EUR",value:n.data.price+a.data.price},context:{shopping:["checkout",0]},globals:{pagegroup:"shop"},nested:[_object_spread_props(_object_spread({entity:"product"},n),{context:{shopping:["checkout",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{context:{shopping:["checkout",0]},nested:[]})],trigger:"load"},"order complete":{data:{id:"0rd3r1d",currency:"EUR",shipping:5.22,taxes:73.76,total:555},context:{shopping:["complete",0]},globals:{pagegroup:"shop"},nested:[_object_spread_props(_object_spread({entity:"product"},n),{context:{shopping:["complete",0]},nested:[]}),_object_spread_props(_object_spread({entity:"product"},a),{context:{shopping:["complete",0]},nested:[]}),{entity:"gift",data:{name:"Surprise"},context:{shopping:["complete",0]},nested:[]}],trigger:"load"},"page view":{data:{domain:"www.example.com",title:"walkerOS documentation",referrer:"https://www.elbwalker.com/",search:"?foo=bar",hash:"#hash",id:"/docs/"},globals:{pagegroup:"docs"},trigger:"load"},"product add":_object_spread_props(_object_spread({},n),{context:{shopping:["intent",0]},globals:{pagegroup:"shop"},nested:[],trigger:"click"}),"product view":_object_spread_props(_object_spread({},n),{context:{shopping:["detail",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"}),"product visible":{data:_object_spread_props(_object_spread({},n.data),{position:3,promo:!0}),context:{shopping:["discover",0]},globals:{pagegroup:"shop"},nested:[],trigger:"load"},"promotion visible":{data:{name:"Setting up tracking easily",position:"hero"},context:{ab_test:["engagement",0]},globals:{pagegroup:"homepage"},trigger:"visible"},"session start":{data:{id:"s3ss10n",start:r,isNew:!0,count:1,runs:1,isStart:!0,storage:!0,referrer:"",device:"c00k13"},user:{id:"us3r",device:"c00k13",session:"s3ss10n",hash:"h4sh",address:"street number",email:"user@example.com",phone:"+49 123 456 789",userAgent:"Mozilla...",browser:"Chrome",browserVersion:"90",deviceType:"desktop",language:"de-DE",country:"DE",region:"HH",city:"Hamburg",zip:"20354",timezone:"Berlin",os:"walkerOS",osVersion:"1.0",screenSize:"1337x420",ip:"127.0.0.0",internal:!0,custom:"value"}}}[e],t),{name:e}))},I=function(e){return Da(e)?e:void 0},R=function(e,t,r){return function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];return _async_to_generator(function(){var n;return _ts_generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(a))];case 1:case 3:return[2,i.sent()];case 2:return n=i.sent(),t?[4,t(n)]:[2];case 4:return[4,null==r?void 0:r()];case 5:return i.sent(),[7];case 6:return[2]}})})()}},M=function(e){return _async_to_generator(function(e){var t,r,n,a,i,o,s,c,u,l,d,p,f,_=arguments;return _ts_generator(this,function(h){switch(h.label){case 0:if(t=_.length>1&&void 0!==_[1]?_[1]:{},r=_.length>2&&void 0!==_[2]?_[2]:{},!A(e))return[2];a=T(e)&&e.consent||r.consent||(null===(n=r.collector)||void 0===n?void 0:n.consent),i=Z(t)?t:[t],o=!0,s=!1,c=void 0,h.label=1;case 1:h.trys.push([1,6,7,8]),u=i[Symbol.iterator](),h.label=2;case 2:return(o=(l=u.next()).done)?[3,5]:(d=l.value,[4,R(za)(e,d,_object_spread_props(_object_spread({},r),{consent:a}))]);case 3:if(p=h.sent(),A(p))return[2,p];h.label=4;case 4:return o=!0,[3,2];case 5:return[3,8];case 6:return f=h.sent(),s=!0,c=f,[3,8];case 7:try{o||null==u.return||u.return()}finally{if(s)throw c}return[7];case 8:return[2]}})}).apply(this,arguments)},D=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},z=function(e){return{sku:e.data.id,name:e.data.name,price:e.data.price,quantity:1,variant:e.data.color,customDimensions:{1:e.data.size}}},L=function(){var e=N("order complete");return[["ecommerceOrder",e.nested.filter(function(e){return"product"===e.entity}).map(z),{orderId:e.data.id,grandTotal:e.data.total,tax:e.data.taxes,shipping:e.data.shipping},{currencyCode:"EUR"}]]},$=function(){var e=N("product add");return[["ecommerceAddToCart",[z(e),,],{currencyCode:"EUR"}]]},F=function(){var e=N("product view");return[["ecommerceProductDetailView",[z(e),,],{currencyCode:"EUR"}]]},U=function(){var e=N("cart view");return[["ecommerceCartUpdate",e.nested.filter(function(e){return"product"===e.entity}).map(z),e.data.value,{currencyCode:"EUR"}]]},V=Object.defineProperty,B=Object.getOwnPropertyDescriptor,J=Object.getOwnPropertyNames,q=Object.prototype.hasOwnProperty,W=function(e,t){for(var r in t)V(e,r,{get:t[r],enumerable:!0})},K={};W(K,{DestinationPiwikPro:function(){return La},default:function(){return ii},destinationPiwikPro:function(){return ai},examples:function(){return $a},schemas:function(){return Ya}});var H,X,G,Y={};W(Y,{BRAND:function(){return bt},DIRTY:function(){return pe},EMPTY_PATH:function(){return ue},INVALID:function(){return de},NEVER:function(){return pr},OK:function(){return fe},ParseStatus:function(){return le},Schema:function(){return ke},ZodAny:function(){return qe},ZodArray:function(){return Xe},ZodBigInt:function(){return $e},ZodBoolean:function(){return Fe},ZodBranded:function(){return kt},ZodCatch:function(){return vt},ZodDate:function(){return Ue},ZodDefault:function(){return yt},ZodDiscriminatedUnion:function(){return tt},ZodEffects:function(){return _t},ZodEnum:function(){return dt},ZodError:function(){return ne},ZodFirstPartyTypeKind:function(){return wt},ZodFunction:function(){return ct},ZodIntersection:function(){return nt},ZodIssueCode:function(){return te},ZodLazy:function(){return ut},ZodLiteral:function(){return lt},ZodMap:function(){return ot},ZodNaN:function(){return gt},ZodNativeEnum:function(){return pt},ZodNever:function(){return Ke},ZodNull:function(){return Je},ZodNullable:function(){return mt},ZodNumber:function(){return Le},ZodObject:function(){return Ye},ZodOptional:function(){return ht},ZodParsedType:function(){return Q},ZodPipeline:function(){return jt},ZodPromise:function(){return ft},ZodReadonly:function(){return St},ZodRecord:function(){return it},ZodSchema:function(){return ke},ZodSet:function(){return st},ZodString:function(){return ze},ZodSymbol:function(){return Ve},ZodTransformer:function(){return _t},ZodTuple:function(){return at},ZodType:function(){return ke},ZodUndefined:function(){return Be},ZodUnion:function(){return Qe},ZodUnknown:function(){return We},ZodVoid:function(){return He},addIssueToContext:function(){return r},any:function(){return Dt},array:function(){return Ft},bigint:function(){return Ct},boolean:function(){return Et},coerce:function(){return dr},custom:function(){return f},date:function(){return Nt},datetimeRegex:function(){return o},defaultErrorMap:function(){return oe},discriminatedUnion:function(){return Jt},effect:function(){return nr},enum:function(){return er},function:function(){return Gt},getErrorMap:function(){return t},getParsedType:function(){return ee},instanceof:function(){return Ot},intersection:function(){return qt},isAborted:function(){return _e},isAsync:function(){return ye},isDirty:function(){return he},isValid:function(){return me},late:function(){return Pt},lazy:function(){return Yt},literal:function(){return Qt},makeIssue:function(){return ce},map:function(){return Ht},nan:function(){return Tt},nativeEnum:function(){return tr},never:function(){return Lt},null:function(){return Mt},nullable:function(){return ir},number:function(){return At},object:function(){return Ut},objectUtil:function(){return G},oboolean:function(){return lr},onumber:function(){return ur},optional:function(){return ar},ostring:function(){return cr},pipeline:function(){return sr},preprocess:function(){return or},promise:function(){return rr},quotelessJson:function(){return re},record:function(){return Kt},set:function(){return Xt},setErrorMap:function(){return e},strictObject:function(){return Vt},string:function(){return Zt},symbol:function(){return It},transformer:function(){return nr},tuple:function(){return Wt},undefined:function(){return Rt},union:function(){return Bt},unknown:function(){return zt},util:function(){return H},void:function(){return $t}}),(X=H||(H={})).assertEqual=function(e){},X.assertIs=function(e){},X.assertNever=function(e){throw new Error},X.arrayToEnum=function(e){var t={},r=!0,n=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var s=i.value;t[s]=s}}catch(e){n=!0,a=e}finally{try{r||null==o.return||o.return()}finally{if(n)throw a}}return t},X.getValidEnumValues=function(e){var t=X.objectKeys(e).filter(function(t){return"number"!=typeof e[e[t]]}),r={},n=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;r[c]=e[c]}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return X.objectValues(r)},X.objectValues=function(e){return X.objectKeys(e).map(function(t){return e[t]})},X.objectKeys="function"==typeof Object.keys?function(e){return Object.keys(e)}:function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},X.find=function(e,t){var r=!0,n=!1,a=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var s=i.value;if(t(s))return s}}catch(e){n=!0,a=e}finally{try{r||null==o.return||o.return()}finally{if(n)throw a}}},X.isInteger="function"==typeof Number.isInteger?function(e){return Number.isInteger(e)}:function(e){return"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e},X.joinValues=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" | ";return e.map(function(e){return"string"==typeof e?"'".concat(e,"'"):e}).join(t)},X.jsonStringifyReplacer=function(e,t){return"bigint"===(void 0===t?"undefined":_type_of(t))?t.toString():t},(G||(G={})).mergeShapes=function(e,t){return _object_spread({},e,t)};var Q=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ee=function(e){switch(void 0===e?"undefined":_type_of(e)){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(e)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(e)?Q.array:null===e?Q.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Q.promise:"undefined"!=typeof Map&&_instanceof(e,Map)?Q.map:"undefined"!=typeof Set&&_instanceof(e,Set)?Q.set:"undefined"!=typeof Date&&_instanceof(e,Date)?Q.date:Q.object;default:return Q.unknown}},te=H.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"]),re=function(e){return JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:")},ne=function(e){function t(e){var r;_class_call_check(this,t),(r=_call_super(this,t)).issues=[],r.addIssue=function(e){r.issues=_to_consumable_array(r.issues).concat([e])},r.addIssues=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];r.issues=_to_consumable_array(r.issues).concat(_to_consumable_array(e))};var n=(_instanceof(this,t)?this.constructor:void 0).prototype;return Object.setPrototypeOf?Object.setPrototypeOf(r,n):r.__proto__=n,r.name="ZodError",r.issues=e,r}return _inherits(t,e),_create_class(t,[{key:"errors",get:function(){return this.issues}},{key:"format",value:function(e){var t=e||function(e){return e.message},r={_errors:[]},n=function(e){var a=!0,i=!1,o=void 0;try{for(var s,c=e.issues[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var u=s.value;if("invalid_union"===u.code)u.unionErrors.map(n);else if("invalid_return_type"===u.code)n(u.returnTypeError);else if("invalid_arguments"===u.code)n(u.argumentsError);else if(0===u.path.length)r._errors.push(t(u));else for(var l=r,d=0;d<u.path.length;){var p=u.path[d];d===u.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(t(u))):l[p]=l[p]||{_errors:[]},l=l[p],d++}}}catch(e){i=!0,o=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw o}}};return n(this),r}},{key:"toString",value:function(){return this.message}},{key:"message",get:function(){return JSON.stringify(this.issues,H.jsonStringifyReplacer,2)}},{key:"isEmpty",get:function(){return 0===this.issues.length}},{key:"flatten",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e.message},t={},r=[],n=!0,a=!1,i=void 0;try{for(var o,s=this.issues[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;if(c.path.length>0){var u=c.path[0];t[u]=t[u]||[],t[u].push(e(c))}else r.push(e(c))}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return{formErrors:r,fieldErrors:t}}},{key:"formErrors",get:function(){return this.flatten()}}],[{key:"assert",value:function(e){if(!_instanceof(e,t))throw new Error("Not a ZodError: ".concat(e))}}]),t}(_wrap_native_super(Error));ne.create=function(e){return new ne(e)};var ae,ie,oe=function(e,t){var r;switch(e.code){case te.invalid_type:r=e.received===Q.undefined?"Required":"Expected ".concat(e.expected,", received ").concat(e.received);break;case te.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(e.expected,H.jsonStringifyReplacer));break;case te.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(H.joinValues(e.keys,", "));break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(H.joinValues(e.options));break;case te.invalid_enum_value:r="Invalid enum value. Expected ".concat(H.joinValues(e.options),", received '").concat(e.received,"'");break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:"object"===_type_of(e.validation)?"includes"in e.validation?(r='Invalid input: must include "'.concat(e.validation.includes,'"'),"number"==typeof e.validation.position&&(r="".concat(r," at one or more positions greater than or equal to ").concat(e.validation.position))):"startsWith"in e.validation?r='Invalid input: must start with "'.concat(e.validation.startsWith,'"'):"endsWith"in e.validation?r='Invalid input: must end with "'.concat(e.validation.endsWith,'"'):H.assertNever(e.validation):r="regex"!==e.validation?"Invalid ".concat(e.validation):"Invalid";break;case te.too_small:r="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"more than"," ").concat(e.minimum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at least":"over"," ").concat(e.minimum," character(s)"):"number"===e.type||"bigint"===e.type?"Number must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(e.minimum):"date"===e.type?"Date must be ".concat(e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(e.minimum))):"Invalid input";break;case te.too_big:r="array"===e.type?"Array must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"less than"," ").concat(e.maximum," element(s)"):"string"===e.type?"String must contain ".concat(e.exact?"exactly":e.inclusive?"at most":"under"," ").concat(e.maximum," character(s)"):"number"===e.type?"Number must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"bigint"===e.type?"BigInt must be ".concat(e.exact?"exactly":e.inclusive?"less than or equal to":"less than"," ").concat(e.maximum):"date"===e.type?"Date must be ".concat(e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(e.maximum))):"Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r="Number must be a multiple of ".concat(e.multipleOf);break;case te.not_finite:r="Number must be finite";break;default:r=t.defaultError,H.assertNever(e)}return{message:r}},se=oe,ce=function(e){var t=e.data,r=e.path,n=e.errorMaps,a=e.issueData,i=_to_consumable_array(r).concat(_to_consumable_array(a.path||[])),o=_object_spread_props(_object_spread({},a),{path:i});if(void 0!==a.message)return _object_spread_props(_object_spread({},a),{path:i,message:a.message});var s="",c=n.filter(function(e){return!!e}).slice().reverse(),u=!0,l=!1,d=void 0;try{for(var p,f=c[Symbol.iterator]();!(u=(p=f.next()).done);u=!0){s=(0,p.value)(o,{data:t,defaultError:s}).message}}catch(e){l=!0,d=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw d}}return _object_spread_props(_object_spread({},a),{path:i,message:s})},ue=[],le=function(){function e(){_class_call_check(this,e),this.value="valid"}return _create_class(e,[{key:"dirty",value:function(){"valid"===this.value&&(this.value="dirty")}},{key:"abort",value:function(){"aborted"!==this.value&&(this.value="aborted")}}],[{key:"mergeArray",value:function(e,t){var r=[],n=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;if("aborted"===c.status)return de;"dirty"===c.status&&e.dirty(),r.push(c.value)}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return{status:e.value,value:r}}},{key:"mergeObjectAsync",value:function(t,r){return _async_to_generator(function(){var n,a,i,o,s,c,u,l,d,p;return _ts_generator(this,function(f){switch(f.label){case 0:n=[],a=!0,i=!1,o=void 0,f.label=1;case 1:f.trys.push([1,7,8,9]),s=r[Symbol.iterator](),f.label=2;case 2:return(a=(c=s.next()).done)?[3,6]:[4,(u=c.value).key];case 3:return l=f.sent(),[4,u.value];case 4:d=f.sent(),n.push({key:l,value:d}),f.label=5;case 5:return a=!0,[3,2];case 6:return[3,9];case 7:return p=f.sent(),i=!0,o=p,[3,9];case 8:try{a||null==s.return||s.return()}finally{if(i)throw o}return[7];case 9:return[2,e.mergeObjectSync(t,n)]}})})()}},{key:"mergeObjectSync",value:function(e,t){var r={},n=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value,u=c.key,l=c.value;if("aborted"===u.status)return de;if("aborted"===l.status)return de;"dirty"===u.status&&e.dirty(),"dirty"===l.status&&e.dirty(),"__proto__"===u.value||void 0===l.value&&!c.alwaysSet||(r[u.value]=l.value)}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return{status:e.value,value:r}}}]),e}(),de=Object.freeze({status:"aborted"}),pe=function(e){return{status:"dirty",value:e}},fe=function(e){return{status:"valid",value:e}},_e=function(e){return"aborted"===e.status},he=function(e){return"dirty"===e.status},me=function(e){return"valid"===e.status},ye=function(e){return"undefined"!=typeof Promise&&_instanceof(e,Promise)};(ie=ae||(ae={})).errToObj=function(e){return"string"==typeof e?{message:e}:e||{}},ie.toString=function(e){return"string"==typeof e?e:null==e?void 0:e.message};var ve,ge=function(){function e(t,r,n,a){_class_call_check(this,e),this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=a}return _create_class(e,[{key:"path",get:function(){var e,t;this._cachedPath.length||(Array.isArray(this._key)?(e=this._cachedPath).push.apply(e,_to_consumable_array(this._path).concat(_to_consumable_array(this._key))):(t=this._cachedPath).push.apply(t,_to_consumable_array(this._path).concat([this._key])));return this._cachedPath}}]),e}(),be=function(e,t){if(me(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;var t=new ne(e.common.issues);return this._error=t,this._error}}},ke=function(){function e(t){var r=this;_class_call_check(this,e),this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:function(e){return r["~validate"](e)}}}return _create_class(e,[{key:"description",get:function(){return this._def.description}},{key:"_getType",value:function(e){return ee(e.data)}},{key:"_getOrReturnCtx",value:function(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}},{key:"_processInputParams",value:function(e){return{status:new le,ctx:{common:e.parent.common,data:e.data,parsedType:ee(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}},{key:"_parseSync",value:function(e){var t=this._parse(e);if(ye(t))throw new Error("Synchronous parse encountered promise.");return t}},{key:"_parseAsync",value:function(e){var t=this._parse(e);return Promise.resolve(t)}},{key:"parse",value:function(e,t){var r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}},{key:"safeParse",value:function(e,t){var r,n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},a=this._parseSync({data:e,path:n.path,parent:n});return be(n,a)}},{key:"~validate",value:function(e){var t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)};if(!this["~standard"].async)try{var r=this._parseSync({data:e,path:[],parent:t});return me(r)?{value:r.value}:{issues:t.common.issues}}catch(e){var n,a;(null==e||null===(a=e.message)||void 0===a||null===(n=a.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(function(e){return me(e)?{value:e.value}:{issues:t.common.issues}})}},{key:"parseAsync",value:function(e,t){return _async_to_generator(function(){var r;return _ts_generator(this,function(n){switch(n.label){case 0:return[4,this.safeParseAsync(e,t)];case 1:if((r=n.sent()).success)return[2,r.data];throw r.error}})}).call(this)}},{key:"safeParseAsync",value:function(e,t){return _async_to_generator(function(){var r,n,a;return _ts_generator(this,function(i){switch(i.label){case 0:return r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ee(e)},n=this._parse({data:e,path:r.path,parent:r}),[4,ye(n)?n:Promise.resolve(n)];case 1:return a=i.sent(),[2,be(r,a)]}})}).call(this)}},{key:"refine",value:function(e,t){return this._refinement(function(r,n){var a=e(r),i=function(){return n.addIssue(_object_spread({code:te.custom},function(e){return"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t}(r)))};return"undefined"!=typeof Promise&&_instanceof(a,Promise)?a.then(function(e){return!!e||(i(),!1)}):!!a||(i(),!1)})}},{key:"refinement",value:function(e,t){return this._refinement(function(r,n){return!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)})}},{key:"_refinement",value:function(e){return new _t({schema:this,typeName:wt.ZodEffects,effect:{type:"refinement",refinement:e}})}},{key:"superRefine",value:function(e){return this._refinement(e)}},{key:"optional",value:function(){return ht.create(this,this._def)}},{key:"nullable",value:function(){return mt.create(this,this._def)}},{key:"nullish",value:function(){return this.nullable().optional()}},{key:"array",value:function(){return Xe.create(this)}},{key:"promise",value:function(){return ft.create(this,this._def)}},{key:"or",value:function(e){return Qe.create([this,e],this._def)}},{key:"and",value:function(e){return nt.create(this,e,this._def)}},{key:"transform",value:function(e){return new _t(_object_spread_props(_object_spread({},n(this._def)),{schema:this,typeName:wt.ZodEffects,effect:{type:"transform",transform:e}}))}},{key:"default",value:function(e){var t="function"==typeof e?e:function(){return e};return new yt(_object_spread_props(_object_spread({},n(this._def)),{innerType:this,defaultValue:t,typeName:wt.ZodDefault}))}},{key:"brand",value:function(){return new kt(_object_spread({typeName:wt.ZodBranded,type:this},n(this._def)))}},{key:"catch",value:function(e){var t="function"==typeof e?e:function(){return e};return new vt(_object_spread_props(_object_spread({},n(this._def)),{innerType:this,catchValue:t,typeName:wt.ZodCatch}))}},{key:"describe",value:function(e){return new(0,this.constructor)(_object_spread_props(_object_spread({},this._def),{description:e}))}},{key:"pipe",value:function(e){return jt.create(this,e)}},{key:"readonly",value:function(){return St.create(this)}},{key:"isOptional",value:function(){return this.safeParse(void 0).success}},{key:"isNullable",value:function(){return this.safeParse(null).success}}]),e}(),je=/^c[^\s-]{8,}$/i,Se=/^[0-9a-z]+$/,we=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xe=/^[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,Pe=/^[a-z0-9_-]{21}$/i,Oe=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ze=/^[-+]?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)?)??$/,Ae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Te=/^(?:(?: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])$/,Ce=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ee=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ne=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ie=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Re=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Me="((\\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])))",De=new RegExp("^".concat(Me,"$")),ze=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.string,received:t.parsedType}),de}var n=new le,a=void 0,l=!0,d=!1,p=void 0;try{for(var f,_=this._def.checks[Symbol.iterator]();!(l=(f=_.next()).done);l=!0){var h=f.value;if("min"===h.kind)e.data.length<h.value&&(a=this._getOrReturnCtx(e,a),r(a,{code:te.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),n.dirty());else if("max"===h.kind)e.data.length>h.value&&(a=this._getOrReturnCtx(e,a),r(a,{code:te.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!1,message:h.message}),n.dirty());else if("length"===h.kind){var m=e.data.length>h.value,y=e.data.length<h.value;(m||y)&&(a=this._getOrReturnCtx(e,a),m?r(a,{code:te.too_big,maximum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}):y&&r(a,{code:te.too_small,minimum:h.value,type:"string",inclusive:!0,exact:!0,message:h.message}),n.dirty())}else if("email"===h.kind)Ae.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"email",code:te.invalid_string,message:h.message}),n.dirty());else if("emoji"===h.kind)ve||(ve=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ve.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"emoji",code:te.invalid_string,message:h.message}),n.dirty());else if("uuid"===h.kind)xe.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"uuid",code:te.invalid_string,message:h.message}),n.dirty());else if("nanoid"===h.kind)Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"nanoid",code:te.invalid_string,message:h.message}),n.dirty());else if("cuid"===h.kind)je.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"cuid",code:te.invalid_string,message:h.message}),n.dirty());else if("cuid2"===h.kind)Se.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"cuid2",code:te.invalid_string,message:h.message}),n.dirty());else if("ulid"===h.kind)we.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"ulid",code:te.invalid_string,message:h.message}),n.dirty());else if("url"===h.kind)try{new URL(e.data)}catch(t){a=this._getOrReturnCtx(e,a),r(a,{validation:"url",code:te.invalid_string,message:h.message}),n.dirty()}else if("regex"===h.kind){h.regex.lastIndex=0,h.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"regex",code:te.invalid_string,message:h.message}),n.dirty())}else if("trim"===h.kind)e.data=e.data.trim();else if("includes"===h.kind)e.data.includes(h.value,h.position)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:{includes:h.value,position:h.position},message:h.message}),n.dirty());else if("toLowerCase"===h.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===h.kind)e.data=e.data.toUpperCase();else if("startsWith"===h.kind)e.data.startsWith(h.value)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:{startsWith:h.value},message:h.message}),n.dirty());else if("endsWith"===h.kind)e.data.endsWith(h.value)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:{endsWith:h.value},message:h.message}),n.dirty());else if("datetime"===h.kind){o(h).test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:"datetime",message:h.message}),n.dirty())}else if("date"===h.kind){De.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:"date",message:h.message}),n.dirty())}else if("time"===h.kind){i(h).test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{code:te.invalid_string,validation:"time",message:h.message}),n.dirty())}else"duration"===h.kind?Ze.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"duration",code:te.invalid_string,message:h.message}),n.dirty()):"ip"===h.kind?s(e.data,h.version)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"ip",code:te.invalid_string,message:h.message}),n.dirty()):"jwt"===h.kind?c(e.data,h.alg)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"jwt",code:te.invalid_string,message:h.message}),n.dirty()):"cidr"===h.kind?u(e.data,h.version)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"cidr",code:te.invalid_string,message:h.message}),n.dirty()):"base64"===h.kind?Ie.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"base64",code:te.invalid_string,message:h.message}),n.dirty()):"base64url"===h.kind?Re.test(e.data)||(a=this._getOrReturnCtx(e,a),r(a,{validation:"base64url",code:te.invalid_string,message:h.message}),n.dirty()):H.assertNever(h)}}catch(e){d=!0,p=e}finally{try{l||null==_.return||_.return()}finally{if(d)throw p}}return{status:n.value,value:e.data}}},{key:"_regex",value:function(e,t,r){return this.refinement(function(t){return e.test(t)},_object_spread({validation:t,code:te.invalid_string},ae.errToObj(r)))}},{key:"_addCheck",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([e])}))}},{key:"email",value:function(e){return this._addCheck(_object_spread({kind:"email"},ae.errToObj(e)))}},{key:"url",value:function(e){return this._addCheck(_object_spread({kind:"url"},ae.errToObj(e)))}},{key:"emoji",value:function(e){return this._addCheck(_object_spread({kind:"emoji"},ae.errToObj(e)))}},{key:"uuid",value:function(e){return this._addCheck(_object_spread({kind:"uuid"},ae.errToObj(e)))}},{key:"nanoid",value:function(e){return this._addCheck(_object_spread({kind:"nanoid"},ae.errToObj(e)))}},{key:"cuid",value:function(e){return this._addCheck(_object_spread({kind:"cuid"},ae.errToObj(e)))}},{key:"cuid2",value:function(e){return this._addCheck(_object_spread({kind:"cuid2"},ae.errToObj(e)))}},{key:"ulid",value:function(e){return this._addCheck(_object_spread({kind:"ulid"},ae.errToObj(e)))}},{key:"base64",value:function(e){return this._addCheck(_object_spread({kind:"base64"},ae.errToObj(e)))}},{key:"base64url",value:function(e){return this._addCheck(_object_spread({kind:"base64url"},ae.errToObj(e)))}},{key:"jwt",value:function(e){return this._addCheck(_object_spread({kind:"jwt"},ae.errToObj(e)))}},{key:"ip",value:function(e){return this._addCheck(_object_spread({kind:"ip"},ae.errToObj(e)))}},{key:"cidr",value:function(e){return this._addCheck(_object_spread({kind:"cidr"},ae.errToObj(e)))}},{key:"datetime",value:function(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(_object_spread({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(r=null==e?void 0:e.local)&&void 0!==r&&r},ae.errToObj(null==e?void 0:e.message)));var t,r}},{key:"date",value:function(e){return this._addCheck({kind:"date",message:e})}},{key:"time",value:function(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(_object_spread({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision},ae.errToObj(null==e?void 0:e.message)))}},{key:"duration",value:function(e){return this._addCheck(_object_spread({kind:"duration"},ae.errToObj(e)))}},{key:"regex",value:function(e,t){return this._addCheck(_object_spread({kind:"regex",regex:e},ae.errToObj(t)))}},{key:"includes",value:function(e,t){return this._addCheck(_object_spread({kind:"includes",value:e,position:null==t?void 0:t.position},ae.errToObj(null==t?void 0:t.message)))}},{key:"startsWith",value:function(e,t){return this._addCheck(_object_spread({kind:"startsWith",value:e},ae.errToObj(t)))}},{key:"endsWith",value:function(e,t){return this._addCheck(_object_spread({kind:"endsWith",value:e},ae.errToObj(t)))}},{key:"min",value:function(e,t){return this._addCheck(_object_spread({kind:"min",value:e},ae.errToObj(t)))}},{key:"max",value:function(e,t){return this._addCheck(_object_spread({kind:"max",value:e},ae.errToObj(t)))}},{key:"length",value:function(e,t){return this._addCheck(_object_spread({kind:"length",value:e},ae.errToObj(t)))}},{key:"nonempty",value:function(e){return this.min(1,ae.errToObj(e))}},{key:"trim",value:function(){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([{kind:"trim"}])}))}},{key:"toLowerCase",value:function(){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([{kind:"toLowerCase"}])}))}},{key:"toUpperCase",value:function(){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([{kind:"toUpperCase"}])}))}},{key:"isDatetime",get:function(){return!!this._def.checks.find(function(e){return"datetime"===e.kind})}},{key:"isDate",get:function(){return!!this._def.checks.find(function(e){return"date"===e.kind})}},{key:"isTime",get:function(){return!!this._def.checks.find(function(e){return"time"===e.kind})}},{key:"isDuration",get:function(){return!!this._def.checks.find(function(e){return"duration"===e.kind})}},{key:"isEmail",get:function(){return!!this._def.checks.find(function(e){return"email"===e.kind})}},{key:"isURL",get:function(){return!!this._def.checks.find(function(e){return"url"===e.kind})}},{key:"isEmoji",get:function(){return!!this._def.checks.find(function(e){return"emoji"===e.kind})}},{key:"isUUID",get:function(){return!!this._def.checks.find(function(e){return"uuid"===e.kind})}},{key:"isNANOID",get:function(){return!!this._def.checks.find(function(e){return"nanoid"===e.kind})}},{key:"isCUID",get:function(){return!!this._def.checks.find(function(e){return"cuid"===e.kind})}},{key:"isCUID2",get:function(){return!!this._def.checks.find(function(e){return"cuid2"===e.kind})}},{key:"isULID",get:function(){return!!this._def.checks.find(function(e){return"ulid"===e.kind})}},{key:"isIP",get:function(){return!!this._def.checks.find(function(e){return"ip"===e.kind})}},{key:"isCIDR",get:function(){return!!this._def.checks.find(function(e){return"cidr"===e.kind})}},{key:"isBase64",get:function(){return!!this._def.checks.find(function(e){return"base64"===e.kind})}},{key:"isBase64url",get:function(){return!!this._def.checks.find(function(e){return"base64url"===e.kind})}},{key:"minLength",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"min"===o.kind&&(null===e||o.value>e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"maxLength",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"max"===o.kind&&(null===e||o.value<e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}}]),t}(ke);ze.create=function(e){var t;return new ze(_object_spread({checks:[],typeName:wt.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},n(e)))};var Le=function(e){function t(){var e;return _class_call_check(this,t),(e=_call_super(this,t,arguments)).min=e.gte,e.max=e.lte,e.step=e.multipleOf,e}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Q.number){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.number,received:t.parsedType}),de}var n=void 0,a=new le,i=!0,o=!1,s=void 0;try{for(var c,u=this._def.checks[Symbol.iterator]();!(i=(c=u.next()).done);i=!0){var d=c.value;if("int"===d.kind)H.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),r(n,{code:te.invalid_type,expected:"integer",received:"float",message:d.message}),a.dirty());else if("min"===d.kind){(d.inclusive?e.data<d.value:e.data<=d.value)&&(n=this._getOrReturnCtx(e,n),r(n,{code:te.too_small,minimum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),a.dirty())}else if("max"===d.kind){(d.inclusive?e.data>d.value:e.data>=d.value)&&(n=this._getOrReturnCtx(e,n),r(n,{code:te.too_big,maximum:d.value,type:"number",inclusive:d.inclusive,exact:!1,message:d.message}),a.dirty())}else"multipleOf"===d.kind?0!==l(e.data,d.value)&&(n=this._getOrReturnCtx(e,n),r(n,{code:te.not_multiple_of,multipleOf:d.value,message:d.message}),a.dirty()):"finite"===d.kind?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),r(n,{code:te.not_finite,message:d.message}),a.dirty()):H.assertNever(d)}}catch(e){o=!0,s=e}finally{try{i||null==u.return||u.return()}finally{if(o)throw s}}return{status:a.value,value:e.data}}},{key:"gte",value:function(e,t){return this.setLimit("min",e,!0,ae.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,ae.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,ae.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,ae.toString(t))}},{key:"setLimit",value:function(e,r,n,a){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([{kind:e,value:r,inclusive:n,message:ae.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([e])}))}},{key:"int",value:function(e){return this._addCheck({kind:"int",message:ae.toString(e)})}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ae.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ae.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ae.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ae.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(t)})}},{key:"finite",value:function(e){return this._addCheck({kind:"finite",message:ae.toString(e)})}},{key:"safe",value:function(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ae.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ae.toString(e)})}},{key:"minValue",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"min"===o.kind&&(null===e||o.value>e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"maxValue",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"max"===o.kind&&(null===e||o.value<e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"isInt",get:function(){return!!this._def.checks.find(function(e){return"int"===e.kind||"multipleOf"===e.kind&&H.isInteger(e.value)})}},{key:"isFinite",get:function(){var e=null,t=null,r=!0,n=!1,a=void 0;try{for(var i,o=this._def.checks[Symbol.iterator]();!(r=(i=o.next()).done);r=!0){var s=i.value;if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}}catch(e){n=!0,a=e}finally{try{r||null==o.return||o.return()}finally{if(n)throw a}}return Number.isFinite(t)&&Number.isFinite(e)}}]),t}(ke);Le.create=function(e){return new Le(_object_spread({checks:[],typeName:wt.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1},n(e)))};var $e=function(e){function t(){var e;return _class_call_check(this,t),(e=_call_super(this,t,arguments)).min=e.gte,e.max=e.lte,e}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==Q.bigint)return this._getInvalidInput(e);var t=void 0,n=new le,a=!0,i=!1,o=void 0;try{for(var s,c=this._def.checks[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var u=s.value;if("min"===u.kind)(u.inclusive?e.data<u.value:e.data<=u.value)&&(t=this._getOrReturnCtx(e,t),r(t,{code:te.too_small,type:"bigint",minimum:u.value,inclusive:u.inclusive,message:u.message}),n.dirty());else if("max"===u.kind){(u.inclusive?e.data>u.value:e.data>=u.value)&&(t=this._getOrReturnCtx(e,t),r(t,{code:te.too_big,type:"bigint",maximum:u.value,inclusive:u.inclusive,message:u.message}),n.dirty())}else"multipleOf"===u.kind?e.data%u.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),r(t,{code:te.not_multiple_of,multipleOf:u.value,message:u.message}),n.dirty()):H.assertNever(u)}}catch(e){i=!0,o=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw o}}return{status:n.value,value:e.data}}},{key:"_getInvalidInput",value:function(e){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.bigint,received:t.parsedType}),de}},{key:"gte",value:function(e,t){return this.setLimit("min",e,!0,ae.toString(t))}},{key:"gt",value:function(e,t){return this.setLimit("min",e,!1,ae.toString(t))}},{key:"lte",value:function(e,t){return this.setLimit("max",e,!0,ae.toString(t))}},{key:"lt",value:function(e,t){return this.setLimit("max",e,!1,ae.toString(t))}},{key:"setLimit",value:function(e,r,n,a){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([{kind:e,value:r,inclusive:n,message:ae.toString(a)}])}))}},{key:"_addCheck",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([e])}))}},{key:"positive",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}},{key:"negative",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ae.toString(e)})}},{key:"nonpositive",value:function(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}},{key:"nonnegative",value:function(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ae.toString(e)})}},{key:"multipleOf",value:function(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ae.toString(t)})}},{key:"minValue",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"min"===o.kind&&(null===e||o.value>e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"maxValue",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"max"===o.kind&&(null===e||o.value<e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}}]),t}(ke);$e.create=function(e){var t;return new $e(_object_spread({checks:[],typeName:wt.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t},n(e)))};var Fe=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==Q.boolean){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.boolean,received:t.parsedType}),de}return fe(e.data)}}]),t}(ke);Fe.create=function(e){return new Fe(_object_spread({typeName:wt.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1},n(e)))};var Ue=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.date,received:t.parsedType}),de}if(Number.isNaN(e.data.getTime())){var n=this._getOrReturnCtx(e);return r(n,{code:te.invalid_date}),de}var a=new le,i=void 0,o=!0,s=!1,c=void 0;try{for(var u,l=this._def.checks[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value;"min"===d.kind?e.data.getTime()<d.value&&(i=this._getOrReturnCtx(e,i),r(i,{code:te.too_small,message:d.message,inclusive:!0,exact:!1,minimum:d.value,type:"date"}),a.dirty()):"max"===d.kind?e.data.getTime()>d.value&&(i=this._getOrReturnCtx(e,i),r(i,{code:te.too_big,message:d.message,inclusive:!0,exact:!1,maximum:d.value,type:"date"}),a.dirty()):H.assertNever(d)}}catch(e){s=!0,c=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw c}}return{status:a.value,value:new Date(e.data.getTime())}}},{key:"_addCheck",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{checks:_to_consumable_array(this._def.checks).concat([e])}))}},{key:"min",value:function(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ae.toString(t)})}},{key:"max",value:function(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ae.toString(t)})}},{key:"minDate",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"min"===o.kind&&(null===e||o.value>e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return null!=e?new Date(e):null}},{key:"maxDate",get:function(){var e=null,t=!0,r=!1,n=void 0;try{for(var a,i=this._def.checks[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;"max"===o.kind&&(null===e||o.value<e)&&(e=o.value)}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return null!=e?new Date(e):null}}]),t}(ke);Ue.create=function(e){return new Ue(_object_spread({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:wt.ZodDate},n(e)))};var Ve=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._getType(e)!==Q.symbol){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.symbol,received:t.parsedType}),de}return fe(e.data)}}]),t}(ke);Ve.create=function(e){return new Ve(_object_spread({typeName:wt.ZodSymbol},n(e)))};var Be=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._getType(e)!==Q.undefined){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.undefined,received:t.parsedType}),de}return fe(e.data)}}]),t}(ke);Be.create=function(e){return new Be(_object_spread({typeName:wt.ZodUndefined},n(e)))};var Je=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._getType(e)!==Q.null){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.null,received:t.parsedType}),de}return fe(e.data)}}]),t}(ke);Je.create=function(e){return new Je(_object_spread({typeName:wt.ZodNull},n(e)))};var qe=function(e){function t(){var e;return _class_call_check(this,t),(e=_call_super(this,t,arguments))._any=!0,e}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){return fe(e.data)}}]),t}(ke);qe.create=function(e){return new qe(_object_spread({typeName:wt.ZodAny},n(e)))};var We=function(e){function t(){var e;return _class_call_check(this,t),(e=_call_super(this,t,arguments))._unknown=!0,e}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){return fe(e.data)}}]),t}(ke);We.create=function(e){return new We(_object_spread({typeName:wt.ZodUnknown},n(e)))};var Ke=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.never,received:t.parsedType}),de}}]),t}(ke);Ke.create=function(e){return new Ke(_object_spread({typeName:wt.ZodNever},n(e)))};var He=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._getType(e)!==Q.undefined){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.void,received:t.parsedType}),de}return fe(e.data)}}]),t}(ke);He.create=function(e){return new He(_object_spread({typeName:wt.ZodVoid},n(e)))};var Xe=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.ctx,a=t.status,i=this._def;if(n.parsedType!==Q.array)return r(n,{code:te.invalid_type,expected:Q.array,received:n.parsedType}),de;if(null!==i.exactLength){var o=n.data.length>i.exactLength.value,s=n.data.length<i.exactLength.value;(o||s)&&(r(n,{code:o?te.too_big:te.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),a.dirty())}if(null!==i.minLength&&n.data.length<i.minLength.value&&(r(n,{code:te.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),a.dirty()),null!==i.maxLength&&n.data.length>i.maxLength.value&&(r(n,{code:te.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),a.dirty()),n.common.async)return Promise.all(_to_consumable_array(n.data).map(function(e,t){return i.type._parseAsync(new ge(n,e,n.path,t))})).then(function(e){return le.mergeArray(a,e)});var c=_to_consumable_array(n.data).map(function(e,t){return i.type._parseSync(new ge(n,e,n.path,t))});return le.mergeArray(a,c)}},{key:"element",get:function(){return this._def.type}},{key:"min",value:function(e,r){return new t(_object_spread_props(_object_spread({},this._def),{minLength:{value:e,message:ae.toString(r)}}))}},{key:"max",value:function(e,r){return new t(_object_spread_props(_object_spread({},this._def),{maxLength:{value:e,message:ae.toString(r)}}))}},{key:"length",value:function(e,r){return new t(_object_spread_props(_object_spread({},this._def),{exactLength:{value:e,message:ae.toString(r)}}))}},{key:"nonempty",value:function(e){return this.min(1,e)}}]),t}(ke);function Ge(e){if(_instanceof(e,Ye)){var t={};for(var r in e.shape){var n=e.shape[r];t[r]=ht.create(Ge(n))}return new Ye(_object_spread_props(_object_spread({},e._def),{shape:function(){return t}}))}return _instanceof(e,Xe)?new Xe(_object_spread_props(_object_spread({},e._def),{type:Ge(e.element)})):_instanceof(e,ht)?ht.create(Ge(e.unwrap())):_instanceof(e,mt)?mt.create(Ge(e.unwrap())):_instanceof(e,at)?at.create(e.items.map(function(e){return Ge(e)})):e}Xe.create=function(e,t){return new Xe(_object_spread({type:e,minLength:null,maxLength:null,exactLength:null,typeName:wt.ZodArray},n(t)))};var Ye=function(e){function t(){var e;return _class_call_check(this,t),(e=_call_super(this,t,arguments))._cached=null,e.nonstrict=e.passthrough,e.augment=e.extend,e}return _inherits(t,e),_create_class(t,[{key:"_getCached",value:function(){if(null!==this._cached)return this._cached;var e=this._def.shape(),t=H.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}},{key:"_parse",value:function(e){if(this._getType(e)!==Q.object){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.object,received:t.parsedType}),de}var n=this._processInputParams(e),a=n.status,i=n.ctx,o=this._getCached(),s=o.shape,c=o.keys,u=[];if(!_instanceof(this._def.catchall,Ke)||"strip"!==this._def.unknownKeys)for(var l in i.data)c.includes(l)||u.push(l);var d=[],p=!0,f=!1,_=void 0;try{for(var h,m=c[Symbol.iterator]();!(p=(h=m.next()).done);p=!0){var y=h.value,v=s[y],g=i.data[y];d.push({key:{status:"valid",value:y},value:v._parse(new ge(i,g,i.path,y)),alwaysSet:y in i.data})}}catch(e){f=!0,_=e}finally{try{p||null==m.return||m.return()}finally{if(f)throw _}}if(_instanceof(this._def.catchall,Ke)){var b=this._def.unknownKeys;if("passthrough"===b){var k=!0,j=!1,S=void 0;try{for(var w,x=u[Symbol.iterator]();!(k=(w=x.next()).done);k=!0){var P=w.value;d.push({key:{status:"valid",value:P},value:{status:"valid",value:i.data[P]}})}}catch(e){j=!0,S=e}finally{try{k||null==x.return||x.return()}finally{if(j)throw S}}}else if("strict"===b)u.length>0&&(r(i,{code:te.unrecognized_keys,keys:u}),a.dirty());else if("strip"!==b)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{var O=this._def.catchall,Z=!0,A=!1,T=void 0;try{for(var C,E=u[Symbol.iterator]();!(Z=(C=E.next()).done);Z=!0){var N=C.value,I=i.data[N];d.push({key:{status:"valid",value:N},value:O._parse(new ge(i,I,i.path,N)),alwaysSet:N in i.data})}}catch(e){A=!0,T=e}finally{try{Z||null==E.return||E.return()}finally{if(A)throw T}}}return i.common.async?Promise.resolve().then(function(){return _async_to_generator(function(){var e,t,r,n,a,i,o,s,c,u;return _ts_generator(this,function(l){switch(l.label){case 0:e=[],t=!0,r=!1,n=void 0,l.label=1;case 1:l.trys.push([1,7,8,9]),a=d[Symbol.iterator](),l.label=2;case 2:return(t=(i=a.next()).done)?[3,6]:[4,(o=i.value).key];case 3:return s=l.sent(),[4,o.value];case 4:c=l.sent(),e.push({key:s,value:c,alwaysSet:o.alwaysSet}),l.label=5;case 5:return t=!0,[3,2];case 6:return[3,9];case 7:return u=l.sent(),r=!0,n=u,[3,9];case 8:try{t||null==a.return||a.return()}finally{if(r)throw n}return[7];case 9:return[2,e]}})})()}).then(function(e){return le.mergeObjectSync(a,e)}):le.mergeObjectSync(a,d)}},{key:"shape",get:function(){return this._def.shape()}},{key:"strict",value:function(e){var r=this;return ae.errToObj,new t(_object_spread(_object_spread_props(_object_spread({},this._def),{unknownKeys:"strict"}),void 0!==e?{errorMap:function(t,n){var a,i,o,s,c=null!==(o=null===(a=(i=r._def).errorMap)||void 0===a?void 0:a.call(i,t,n).message)&&void 0!==o?o:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(s=ae.errToObj(e).message)&&void 0!==s?s:c}:{message:c}}}:{}))}},{key:"strip",value:function(){return new t(_object_spread_props(_object_spread({},this._def),{unknownKeys:"strip"}))}},{key:"passthrough",value:function(){return new t(_object_spread_props(_object_spread({},this._def),{unknownKeys:"passthrough"}))}},{key:"extend",value:function(e){var r=this;return new t(_object_spread_props(_object_spread({},this._def),{shape:function(){return _object_spread({},r._def.shape(),e)}}))}},{key:"merge",value:function(e){var r=this;return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:function(){return _object_spread({},r._def.shape(),e._def.shape())},typeName:wt.ZodObject})}},{key:"setKey",value:function(e,t){return this.augment(_define_property({},e,t))}},{key:"catchall",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{catchall:e}))}},{key:"pick",value:function(e){var r={},n=!0,a=!1,i=void 0;try{for(var o,s=H.objectKeys(e)[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;e[c]&&this.shape[c]&&(r[c]=this.shape[c])}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return new t(_object_spread_props(_object_spread({},this._def),{shape:function(){return r}}))}},{key:"omit",value:function(e){var r={},n=!0,a=!1,i=void 0;try{for(var o,s=H.objectKeys(this.shape)[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;e[c]||(r[c]=this.shape[c])}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return new t(_object_spread_props(_object_spread({},this._def),{shape:function(){return r}}))}},{key:"deepPartial",value:function(){return Ge(this)}},{key:"partial",value:function(e){var r={},n=!0,a=!1,i=void 0;try{for(var o,s=H.objectKeys(this.shape)[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value,u=this.shape[c];e&&!e[c]?r[c]=u:r[c]=u.optional()}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return new t(_object_spread_props(_object_spread({},this._def),{shape:function(){return r}}))}},{key:"required",value:function(e){var r={},n=!0,a=!1,i=void 0;try{for(var o,s=H.objectKeys(this.shape)[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;if(e&&!e[c])r[c]=this.shape[c];else{for(var u=this.shape[c];_instanceof(u,ht);)u=u._def.innerType;r[c]=u}}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return new t(_object_spread_props(_object_spread({},this._def),{shape:function(){return r}}))}},{key:"keyof",value:function(){return d(H.objectKeys(this.shape))}}]),t}(ke);Ye.create=function(e,t){return new Ye(_object_spread({shape:function(){return e},unknownKeys:"strip",catchall:Ke.create(),typeName:wt.ZodObject},n(t)))},Ye.strictCreate=function(e,t){return new Ye(_object_spread({shape:function(){return e},unknownKeys:"strict",catchall:Ke.create(),typeName:wt.ZodObject},n(t)))},Ye.lazycreate=function(e,t){return new Ye(_object_spread({shape:e,unknownKeys:"strip",catchall:Ke.create(),typeName:wt.ZodObject},n(t)))};var Qe=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,n=this._def.options;if(t.common.async)return Promise.all(n.map(function(e){return _async_to_generator(function(){var r,n;return _ts_generator(this,function(a){switch(a.label){case 0:return r=_object_spread_props(_object_spread({},t),{common:_object_spread_props(_object_spread({},t.common),{issues:[]}),parent:null}),n={},[4,e._parseAsync({data:t.data,path:t.path,parent:r})];case 1:return[2,(n.result=a.sent(),n.ctx=r,n)]}})})()})).then(function(e){var n=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;if("valid"===c.result.status)return c.result}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}var u=!0,l=!1,d=void 0;try{for(var p,f=e[Symbol.iterator]();!(u=(p=f.next()).done);u=!0){var _,h=p.value;if("dirty"===h.result.status)return(_=t.common.issues).push.apply(_,_to_consumable_array(h.ctx.common.issues)),h.result}}catch(e){l=!0,d=e}finally{try{u||null==f.return||f.return()}finally{if(l)throw d}}var m=e.map(function(e){return new ne(e.ctx.common.issues)});return r(t,{code:te.invalid_union,unionErrors:m}),de});var a,i=void 0,o=[],s=!0,c=!1,u=void 0;try{for(var l,d=n[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value,f=_object_spread_props(_object_spread({},t),{common:_object_spread_props(_object_spread({},t.common),{issues:[]}),parent:null}),_=p._parseSync({data:t.data,path:t.path,parent:f});if("valid"===_.status)return _;"dirty"!==_.status||i||(i={result:_,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}}catch(e){c=!0,u=e}finally{try{s||null==d.return||d.return()}finally{if(c)throw u}}if(i)return(a=t.common.issues).push.apply(a,_to_consumable_array(i.ctx.common.issues)),i.result;var h=o.map(function(e){return new ne(e)});return r(t,{code:te.invalid_union,unionErrors:h}),de}},{key:"options",get:function(){return this._def.options}}]),t}(ke);Qe.create=function(e,t){return new Qe(_object_spread({options:e,typeName:wt.ZodUnion},n(t)))};var et=function(e){return _instanceof(e,ut)?et(e.schema):_instanceof(e,_t)?et(e.innerType()):_instanceof(e,lt)?[e.value]:_instanceof(e,dt)?e.options:_instanceof(e,pt)?H.objectValues(e.enum):_instanceof(e,yt)?et(e._def.innerType):_instanceof(e,Be)?[void 0]:_instanceof(e,Je)?[null]:_instanceof(e,ht)?[void 0].concat(_to_consumable_array(et(e.unwrap()))):_instanceof(e,mt)?[null].concat(_to_consumable_array(et(e.unwrap()))):_instanceof(e,kt)||_instanceof(e,St)?et(e.unwrap()):_instanceof(e,vt)?et(e._def.innerType):[]},tt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;if(t.parsedType!==Q.object)return r(t,{code:te.invalid_type,expected:Q.object,received:t.parsedType}),de;var n=this.discriminator,a=t.data[n],i=this.optionsMap.get(a);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(r(t,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),de)}},{key:"discriminator",get:function(){return this._def.discriminator}},{key:"options",get:function(){return this._def.options}},{key:"optionsMap",get:function(){return this._def.optionsMap}}],[{key:"create",value:function(e,r,a){var i=new Map,o=!0,s=!1,c=void 0;try{for(var u,l=r[Symbol.iterator]();!(o=(u=l.next()).done);o=!0){var d=u.value,p=et(d.shape[e]);if(!p.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));var f=!0,_=!1,h=void 0;try{for(var m,y=p[Symbol.iterator]();!(f=(m=y.next()).done);f=!0){var v=m.value;if(i.has(v))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(v)));i.set(v,d)}}catch(e){_=!0,h=e}finally{try{f||null==y.return||y.return()}finally{if(_)throw h}}}}catch(e){s=!0,c=e}finally{try{o||null==l.return||l.return()}finally{if(s)throw c}}return new t(_object_spread({typeName:wt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i},n(a)))}}]),t}(ke);function rt(e,t){var r=ee(e),n=ee(t);if(e===t)return{valid:!0,data:e};if(r===Q.object&&n===Q.object){var a=H.objectKeys(t),i=H.objectKeys(e).filter(function(e){return-1!==a.indexOf(e)}),o=_object_spread({},e,t),s=!0,c=!1,u=void 0;try{for(var l,d=i[Symbol.iterator]();!(s=(l=d.next()).done);s=!0){var p=l.value,f=rt(e[p],t[p]);if(!f.valid)return{valid:!1};o[p]=f.data}}catch(e){c=!0,u=e}finally{try{s||null==d.return||d.return()}finally{if(c)throw u}}return{valid:!0,data:o}}if(r===Q.array&&n===Q.array){if(e.length!==t.length)return{valid:!1};for(var _=[],h=0;h<e.length;h++){var m=rt(e[h],t[h]);if(!m.valid)return{valid:!1};_.push(m.data)}return{valid:!0,data:_}}return r===Q.date&&n===Q.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var nt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,a=t.ctx,i=function(e,t){if(_e(e)||_e(t))return de;var i=rt(e.value,t.value);return i.valid?((he(e)||he(t))&&n.dirty(),{status:n.value,value:i.data}):(r(a,{code:te.invalid_intersection_types}),de)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(function(e){var t=_sliced_to_array(e,2),r=t[0],n=t[1];return i(r,n)}):i(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}]),t}(ke);nt.create=function(e,t,r){return new nt(_object_spread({left:e,right:t,typeName:wt.ZodIntersection},n(r)))};var at=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),a=n.status,i=n.ctx;if(i.parsedType!==Q.array)return r(i,{code:te.invalid_type,expected:Q.array,received:i.parsedType}),de;if(i.data.length<this._def.items.length)return r(i,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),de;!this._def.rest&&i.data.length>this._def.items.length&&(r(i,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());var o=_to_consumable_array(i.data).map(function(e,r){var n=t._def.items[r]||t._def.rest;return n?n._parse(new ge(i,e,i.path,r)):null}).filter(function(e){return!!e});return i.common.async?Promise.all(o).then(function(e){return le.mergeArray(a,e)}):le.mergeArray(a,o)}},{key:"items",get:function(){return this._def.items}},{key:"rest",value:function(e){return new t(_object_spread_props(_object_spread({},this._def),{rest:e}))}}]),t}(ke);at.create=function(e,t){if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new at(_object_spread({items:e,typeName:wt.ZodTuple,rest:null},n(t)))};var it=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"keySchema",get:function(){return this._def.keyType}},{key:"valueSchema",get:function(){return this._def.valueType}},{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,a=t.ctx;if(a.parsedType!==Q.object)return r(a,{code:te.invalid_type,expected:Q.object,received:a.parsedType}),de;var i=[],o=this._def.keyType,s=this._def.valueType;for(var c in a.data)i.push({key:o._parse(new ge(a,c,a.path,c)),value:s._parse(new ge(a,a.data[c],a.path,c)),alwaysSet:c in a.data});return a.common.async?le.mergeObjectAsync(n,i):le.mergeObjectSync(n,i)}},{key:"element",get:function(){return this._def.valueType}}],[{key:"create",value:function(e,r,a){return _instanceof(r,ke)?new t(_object_spread({keyType:e,valueType:r,typeName:wt.ZodRecord},n(a))):new t(_object_spread({keyType:ze.create(),valueType:e,typeName:wt.ZodRecord},n(r)))}}]),t}(ke),ot=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"keySchema",get:function(){return this._def.keyType}},{key:"valueSchema",get:function(){return this._def.valueType}},{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,a=t.ctx;if(a.parsedType!==Q.map)return r(a,{code:te.invalid_type,expected:Q.map,received:a.parsedType}),de;var i=this._def.keyType,o=this._def.valueType,s=_to_consumable_array(a.data.entries()).map(function(e,t){var r=_sliced_to_array(e,2),n=r[0],s=r[1];return{key:i._parse(new ge(a,n,a.path,[t,"key"])),value:o._parse(new ge(a,s,a.path,[t,"value"]))}});if(a.common.async){var c=new Map;return Promise.resolve().then(function(){return _async_to_generator(function(){var e,t,r,a,i,o,u,l,d;return _ts_generator(this,function(p){switch(p.label){case 0:e=!0,t=!1,r=void 0,p.label=1;case 1:p.trys.push([1,7,8,9]),a=s[Symbol.iterator](),p.label=2;case 2:return(e=(i=a.next()).done)?[3,6]:[4,(o=i.value).key];case 3:return u=p.sent(),[4,o.value];case 4:if(l=p.sent(),"aborted"===u.status||"aborted"===l.status)return[2,de];"dirty"!==u.status&&"dirty"!==l.status||n.dirty(),c.set(u.value,l.value),p.label=5;case 5:return e=!0,[3,2];case 6:return[3,9];case 7:return d=p.sent(),t=!0,r=d,[3,9];case 8:try{e||null==a.return||a.return()}finally{if(t)throw r}return[7];case 9:return[2,{status:n.value,value:c}]}})})()})}var u=new Map,l=!0,d=!1,p=void 0;try{for(var f,_=s[Symbol.iterator]();!(l=(f=_.next()).done);l=!0){var h=f.value,m=h.key,y=h.value;if("aborted"===m.status||"aborted"===y.status)return de;"dirty"!==m.status&&"dirty"!==y.status||n.dirty(),u.set(m.value,y.value)}}catch(e){d=!0,p=e}finally{try{l||null==_.return||_.return()}finally{if(d)throw p}}return{status:n.value,value:u}}}]),t}(ke);ot.create=function(e,t,r){return new ot(_object_spread({valueType:t,keyType:e,typeName:wt.ZodMap},n(r)))};var st=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e),n=t.status,a=t.ctx;if(a.parsedType!==Q.set)return r(a,{code:te.invalid_type,expected:Q.set,received:a.parsedType}),de;var i=this._def;null!==i.minSize&&a.data.size<i.minSize.value&&(r(a,{code:te.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),n.dirty()),null!==i.maxSize&&a.data.size>i.maxSize.value&&(r(a,{code:te.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());var o=this._def.valueType;function s(e){var t=new Set,r=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var c=o.value;if("aborted"===c.status)return de;"dirty"===c.status&&n.dirty(),t.add(c.value)}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}return{status:n.value,value:t}}var c=_to_consumable_array(a.data.values()).map(function(e,t){return o._parse(new ge(a,e,a.path,t))});return a.common.async?Promise.all(c).then(function(e){return s(e)}):s(c)}},{key:"min",value:function(e,r){return new t(_object_spread_props(_object_spread({},this._def),{minSize:{value:e,message:ae.toString(r)}}))}},{key:"max",value:function(e,r){return new t(_object_spread_props(_object_spread({},this._def),{maxSize:{value:e,message:ae.toString(r)}}))}},{key:"size",value:function(e,t){return this.min(e,t).max(e,t)}},{key:"nonempty",value:function(e){return this.min(1,e)}}]),t}(ke);st.create=function(e,t){return new st(_object_spread({valueType:e,minSize:null,maxSize:null,typeName:wt.ZodSet},n(t)))};var ct=function(e){function a(){var e;return _class_call_check(this,a),(e=_call_super(this,a,arguments)).validate=e.implement,e}return _inherits(a,e),_create_class(a,[{key:"_parse",value:function(e){var n=this._processInputParams(e).ctx;if(n.parsedType!==Q.function)return r(n,{code:te.invalid_type,expected:Q.function,received:n.parsedType}),de;function a(e,r){return ce({data:e,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t(),oe].filter(function(e){return!!e}),issueData:{code:te.invalid_arguments,argumentsError:r}})}function i(e,r){return ce({data:e,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t(),oe].filter(function(e){return!!e}),issueData:{code:te.invalid_return_type,returnTypeError:r}})}var o={errorMap:n.common.contextualErrorMap},s=n.data;if(_instanceof(this._def.returns,ft)){var c=this;return fe(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return _async_to_generator(function(){var e,r,n;return _ts_generator(this,function(u){switch(u.label){case 0:return e=new ne([]),[4,c._def.args.parseAsync(t,o).catch(function(r){throw e.addIssue(a(t,r)),e})];case 1:return r=u.sent(),[4,Reflect.apply(s,this,r)];case 2:return n=u.sent(),[4,c._def.returns._def.type.parseAsync(n,o).catch(function(t){throw e.addIssue(i(n,t)),e})];case 3:return[2,u.sent()]}})}).call(this)})}var u=this;return fe(function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=u._def.args.safeParse(t,o);if(!n.success)throw new ne([a(t,n.error)]);var c=Reflect.apply(s,this,n.data),l=u._def.returns.safeParse(c,o);if(!l.success)throw new ne([i(c,l.error)]);return l.data})}},{key:"parameters",value:function(){return this._def.args}},{key:"returnType",value:function(){return this._def.returns}},{key:"args",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return new a(_object_spread_props(_object_spread({},this._def),{args:at.create(t).rest(We.create())}))}},{key:"returns",value:function(e){return new a(_object_spread_props(_object_spread({},this._def),{returns:e}))}},{key:"implement",value:function(e){return this.parse(e)}},{key:"strictImplement",value:function(e){return this.parse(e)}}],[{key:"create",value:function(e,t,r){return new a(_object_spread({args:e||at.create([]).rest(We.create()),returns:t||We.create(),typeName:wt.ZodFunction},n(r)))}}]),a}(ke),ut=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"schema",get:function(){return this._def.getter()}},{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx;return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}]),t}(ke);ut.create=function(e,t){return new ut(_object_spread({getter:e,typeName:wt.ZodLazy},n(t)))};var lt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(e.data!==this._def.value){var t=this._getOrReturnCtx(e);return r(t,{received:t.data,code:te.invalid_literal,expected:this._def.value}),de}return{status:"valid",value:e.data}}},{key:"value",get:function(){return this._def.value}}]),t}(ke);lt.create=function(e,t){return new lt(_object_spread({value:e,typeName:wt.ZodLiteral},n(t)))};var dt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if("string"!=typeof e.data){var t=this._getOrReturnCtx(e),n=this._def.values;return r(t,{expected:H.joinValues(n),received:t.parsedType,code:te.invalid_type}),de}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){var a=this._getOrReturnCtx(e),i=this._def.values;return r(a,{received:a.data,code:te.invalid_enum_value,options:i}),de}return fe(e.data)}},{key:"options",get:function(){return this._def.values}},{key:"enum",get:function(){var e={},t=!0,r=!1,n=void 0;try{for(var a,i=this._def.values[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;e[o]=o}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"Values",get:function(){var e={},t=!0,r=!1,n=void 0;try{for(var a,i=this._def.values[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;e[o]=o}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"Enum",get:function(){var e={},t=!0,r=!1,n=void 0;try{for(var a,i=this._def.values[Symbol.iterator]();!(t=(a=i.next()).done);t=!0){var o=a.value;e[o]=o}}catch(e){r=!0,n=e}finally{try{t||null==i.return||i.return()}finally{if(r)throw n}}return e}},{key:"extract",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return t.create(e,_object_spread({},this._def,r))}},{key:"exclude",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._def;return t.create(this.options.filter(function(t){return!e.includes(t)}),_object_spread({},this._def,r))}}]),t}(ke);dt.create=d;var pt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Q.string&&n.parsedType!==Q.number){var a=H.objectValues(t);return r(n,{expected:H.joinValues(a),received:n.parsedType,code:te.invalid_type}),de}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){var i=H.objectValues(t);return r(n,{received:n.data,code:te.invalid_enum_value,options:i}),de}return fe(e.data)}},{key:"enum",get:function(){return this._def.values}}]),t}(ke);pt.create=function(e,t){return new pt(_object_spread({values:e,typeName:wt.ZodNativeEnum},n(t)))};var ft=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"unwrap",value:function(){return this._def.type}},{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e).ctx;if(n.parsedType!==Q.promise&&!1===n.common.async)return r(n,{code:te.invalid_type,expected:Q.promise,received:n.parsedType}),de;var a=n.parsedType===Q.promise?n.data:Promise.resolve(n.data);return fe(a.then(function(e){return t._def.type.parseAsync(e,{path:n.path,errorMap:n.common.contextualErrorMap})}))}}]),t}(ke);ft.create=function(e,t){return new ft(_object_spread({type:e,typeName:wt.ZodPromise},n(t)))};var _t=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"innerType",value:function(){return this._def.schema}},{key:"sourceType",value:function(){return this._def.schema._def.typeName===wt.ZodEffects?this._def.schema.sourceType():this._def.schema}},{key:"_parse",value:function(e){var t=this,n=this._processInputParams(e),a=n.status,i=n.ctx,o=this._def.effect||null,s={addIssue:function(e){r(i,e),e.fatal?a.abort():a.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===o.type){var c=o.transform(i.data,s);if(i.common.async)return Promise.resolve(c).then(function(e){return _async_to_generator(function(){var t;return _ts_generator(this,function(r){switch(r.label){case 0:return"aborted"===a.value?[2,de]:[4,this._def.schema._parseAsync({data:e,path:i.path,parent:i})];case 1:return"aborted"===(t=r.sent()).status?[2,de]:"dirty"===t.status||"dirty"===a.value?[2,pe(t.value)]:[2,t]}})}).call(t)});if("aborted"===a.value)return de;var u=this._def.schema._parseSync({data:c,path:i.path,parent:i});return"aborted"===u.status?de:"dirty"===u.status||"dirty"===a.value?pe(u.value):u}if("refinement"===o.type){var l=function(e){var t=o.refinement(e,s);if(i.common.async)return Promise.resolve(t);if(_instanceof(t,Promise))throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){var d=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===d.status?de:("dirty"===d.status&&a.dirty(),l(d.value),{status:a.value,value:d.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(function(e){return"aborted"===e.status?de:("dirty"===e.status&&a.dirty(),l(e.value).then(function(){return{status:a.value,value:e.value}}))})}if("transform"===o.type){if(!1===i.common.async){var p=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!me(p))return de;var f=o.transform(p.value,s);if(_instanceof(f,Promise))throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:f}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(function(e){return me(e)?Promise.resolve(o.transform(e.value,s)).then(function(e){return{status:a.value,value:e}}):de})}H.assertNever(o)}}]),t}(ke);_t.create=function(e,t,r){return new _t(_object_spread({schema:e,typeName:wt.ZodEffects,effect:t},n(r)))},_t.createWithPreprocess=function(e,t,r){return new _t(_object_spread({schema:t,effect:{type:"preprocess",transform:e},typeName:wt.ZodEffects},n(r)))};var ht=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){return this._getType(e)===Q.undefined?fe(void 0):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),t}(ke);ht.create=function(e,t){return new ht(_object_spread({innerType:e,typeName:wt.ZodOptional},n(t)))};var mt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){return this._getType(e)===Q.null?fe(null):this._def.innerType._parse(e)}},{key:"unwrap",value:function(){return this._def.innerType}}]),t}(ke);mt.create=function(e,t){return new mt(_object_spread({innerType:e,typeName:wt.ZodNullable},n(t)))};var yt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,r=t.data;return t.parsedType===Q.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}},{key:"removeDefault",value:function(){return this._def.innerType}}]),t}(ke);yt.create=function(e,t){return new yt(_object_spread({innerType:e,typeName:wt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:function(){return t.default}},n(t)))};var vt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this,r=this._processInputParams(e).ctx,n=_object_spread_props(_object_spread({},r),{common:_object_spread_props(_object_spread({},r.common),{issues:[]})}),a=this._def.innerType._parse({data:n.data,path:n.path,parent:_object_spread({},n)});return ye(a)?a.then(function(e){return{status:"valid",value:"valid"===e.status?e.value:t._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})}}):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new ne(n.common.issues)},input:n.data})}}},{key:"removeCatch",value:function(){return this._def.innerType}}]),t}(ke);vt.create=function(e,t){return new vt(_object_spread({innerType:e,typeName:wt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:function(){return t.catch}},n(t)))};var gt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){if(this._getType(e)!==Q.nan){var t=this._getOrReturnCtx(e);return r(t,{code:te.invalid_type,expected:Q.nan,received:t.parsedType}),de}return{status:"valid",value:e.data}}}]),t}(ke);gt.create=function(e){return new gt(_object_spread({typeName:wt.ZodNaN},n(e)))};var bt=Symbol("zod_brand"),kt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._processInputParams(e).ctx,r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}},{key:"unwrap",value:function(){return this._def.type}}]),t}(ke),jt=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this,r=this._processInputParams(e),n=r.status,a=r.ctx;if(a.common.async){return _async_to_generator(function(){var e;return _ts_generator(this,function(t){switch(t.label){case 0:return[4,this._def.in._parseAsync({data:a.data,path:a.path,parent:a})];case 1:return"aborted"===(e=t.sent()).status?[2,de]:"dirty"===e.status?(n.dirty(),[2,pe(e.value)]):[2,this._def.out._parseAsync({data:e.value,path:a.path,parent:a})]}})}).call(t)}var i=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===i.status?de:"dirty"===i.status?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:a.path,parent:a})}}],[{key:"create",value:function(e,r){return new t({in:e,out:r,typeName:wt.ZodPipeline})}}]),t}(ke),St=function(e){function t(){return _class_call_check(this,t),_call_super(this,t,arguments)}return _inherits(t,e),_create_class(t,[{key:"_parse",value:function(e){var t=this._def.innerType._parse(e),r=function(e){return me(e)&&(e.value=Object.freeze(e.value)),e};return ye(t)?t.then(function(e){return r(e)}):r(t)}},{key:"unwrap",value:function(){return this._def.innerType}}]),t}(ke);St.create=function(e,t){return new St(_object_spread({innerType:e,typeName:wt.ZodReadonly},n(t)))};var wt,xt,Pt={object:Ye.lazycreate};(xt=wt||(wt={})).ZodString="ZodString",xt.ZodNumber="ZodNumber",xt.ZodNaN="ZodNaN",xt.ZodBigInt="ZodBigInt",xt.ZodBoolean="ZodBoolean",xt.ZodDate="ZodDate",xt.ZodSymbol="ZodSymbol",xt.ZodUndefined="ZodUndefined",xt.ZodNull="ZodNull",xt.ZodAny="ZodAny",xt.ZodUnknown="ZodUnknown",xt.ZodNever="ZodNever",xt.ZodVoid="ZodVoid",xt.ZodArray="ZodArray",xt.ZodObject="ZodObject",xt.ZodUnion="ZodUnion",xt.ZodDiscriminatedUnion="ZodDiscriminatedUnion",xt.ZodIntersection="ZodIntersection",xt.ZodTuple="ZodTuple",xt.ZodRecord="ZodRecord",xt.ZodMap="ZodMap",xt.ZodSet="ZodSet",xt.ZodFunction="ZodFunction",xt.ZodLazy="ZodLazy",xt.ZodLiteral="ZodLiteral",xt.ZodEnum="ZodEnum",xt.ZodEffects="ZodEffects",xt.ZodNativeEnum="ZodNativeEnum",xt.ZodOptional="ZodOptional",xt.ZodNullable="ZodNullable",xt.ZodDefault="ZodDefault",xt.ZodCatch="ZodCatch",xt.ZodPromise="ZodPromise",xt.ZodBranded="ZodBranded",xt.ZodPipeline="ZodPipeline",xt.ZodReadonly="ZodReadonly";var Ot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{message:"Input not instance of ".concat(e.name)};return f(function(t){return _instanceof(t,e)},t)},Zt=ze.create,At=Le.create,Tt=gt.create,Ct=$e.create,Et=Fe.create,Nt=Ue.create,It=Ve.create,Rt=Be.create,Mt=Je.create,Dt=qe.create,zt=We.create,Lt=Ke.create,$t=He.create,Ft=Xe.create,Ut=Ye.create,Vt=Ye.strictCreate,Bt=Qe.create,Jt=tt.create,qt=nt.create,Wt=at.create,Kt=it.create,Ht=ot.create,Xt=st.create,Gt=ct.create,Yt=ut.create,Qt=lt.create,er=dt.create,tr=pt.create,rr=ft.create,nr=_t.create,ar=ht.create,ir=mt.create,or=_t.createWithPreprocess,sr=jt.create,cr=function(){return Zt().optional()},ur=function(){return At().optional()},lr=function(){return Et().optional()},dr={string:function(e){return ze.create(_object_spread_props(_object_spread({},e),{coerce:!0}))},number:function(e){return Le.create(_object_spread_props(_object_spread({},e),{coerce:!0}))},boolean:function(e){return Fe.create(_object_spread_props(_object_spread({},e),{coerce:!0}))},bigint:function(e){return $e.create(_object_spread_props(_object_spread({},e),{coerce:!0}))},date:function(e){return Ue.create(_object_spread_props(_object_spread({},e),{coerce:!0}))}},pr=de,fr=Symbol("Let zodToJsonSchema decide on which parser to use"),_r={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},hr=function(e){var t=function(e){return"string"==typeof e?_object_spread_props(_object_spread({},_r),{name:e}):_object_spread({},_r,e)}(e),r=void 0!==t.name?_to_consumable_array(t.basePath).concat([t.definitionPath,t.name]):t.basePath;return _object_spread_props(_object_spread({},t),{flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(function(e){var r=_sliced_to_array(e,2),n=r[0],a=r[1];return[a._def,{def:a._def,path:_to_consumable_array(t.basePath).concat([t.definitionPath,n]),jsonSchema:void 0}]}))})},mr=function(e,t){for(var r=0;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString()].concat(_to_consumable_array(t.slice(r))).join("/")};function yr(e,t,r){var n=null!=r?r:t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map(function(r,n){return yr(e,t,r)})};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return vr(e,t)}}var vr=function(e,t){var r={type:"integer",format:"unix-time"};if("openApi3"===t.target)return r;var n=!0,a=!1,i=void 0;try{for(var o,s=e.checks[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;switch(c.kind){case"min":h(r,"minimum",c.value,c.message,t);break;case"max":h(r,"maximum",c.value,c.message,t)}}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return r},gr=function(e){return(!("type"in e)||"string"!==e.type)&&"allOf"in e},br=void 0,kr={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:function(){return void 0===br&&(br=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),br},uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([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})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/},jr=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"),Sr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},wr=function(e,t){var r=(_instanceof(e.options,Map)?Array.from(e.options.values()):e.options).map(function(e,r){return Pr(e._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["anyOf","".concat(r)])}))}).filter(function(e){return!!e&&(!t.strictUnions||"object"===(void 0===e?"undefined":_type_of(e))&&Object.keys(e).length>0)});return r.length?{anyOf:r}:void 0},xr=function(e,t,r){switch(t){case wt.ZodString:return v(e,r);case wt.ZodNumber:return function(e,t){var r={type:"number"};if(!e.checks)return r;var n=!0,a=!1,i=void 0;try{for(var o,s=e.checks[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;switch(c.kind){case"int":r.type="integer",_(r,"type",c.message,t);break;case"min":"jsonSchema7"===t.target?c.inclusive?h(r,"minimum",c.value,c.message,t):h(r,"exclusiveMinimum",c.value,c.message,t):(c.inclusive||(r.exclusiveMinimum=!0),h(r,"minimum",c.value,c.message,t));break;case"max":"jsonSchema7"===t.target?c.inclusive?h(r,"maximum",c.value,c.message,t):h(r,"exclusiveMaximum",c.value,c.message,t):(c.inclusive||(r.exclusiveMaximum=!0),h(r,"maximum",c.value,c.message,t));break;case"multipleOf":h(r,"multipleOf",c.value,c.message,t)}}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return r}(e,r);case wt.ZodObject:return function(e,t){var r="openAi"===t.target,n={type:"object",properties:{}},a=[],i=e.shape();for(var o in i){var s=i[o];if(void 0!==s&&void 0!==s._def){var c=P(s);c&&r&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),c=!1);var u=Pr(s._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["properties",o]),propertyPath:_to_consumable_array(t.currentPath).concat(["properties",o])}));void 0!==u&&(n.properties[o]=u,c||a.push(o))}}a.length&&(n.required=a);var l=x(e,t);return void 0!==l&&(n.additionalProperties=l),n}(e,r);case wt.ZodBigInt:return function(e,t){var r={type:"integer",format:"int64"};if(!e.checks)return r;var n=!0,a=!1,i=void 0;try{for(var o,s=e.checks[Symbol.iterator]();!(n=(o=s.next()).done);n=!0){var c=o.value;switch(c.kind){case"min":"jsonSchema7"===t.target?c.inclusive?h(r,"minimum",c.value,c.message,t):h(r,"exclusiveMinimum",c.value,c.message,t):(c.inclusive||(r.exclusiveMinimum=!0),h(r,"minimum",c.value,c.message,t));break;case"max":"jsonSchema7"===t.target?c.inclusive?h(r,"maximum",c.value,c.message,t):h(r,"exclusiveMaximum",c.value,c.message,t):(c.inclusive||(r.exclusiveMaximum=!0),h(r,"maximum",c.value,c.message,t));break;case"multipleOf":h(r,"multipleOf",c.value,c.message,t)}}}catch(e){a=!0,i=e}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return r}(e,r);case wt.ZodBoolean:return{type:"boolean"};case wt.ZodDate:return yr(e,r);case wt.ZodUndefined:return function(e){return{not:m(e)}}(r);case wt.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(r);case wt.ZodArray:return function(e,t){var r,n,a,i={type:"array"};return(null===(r=e.type)||void 0===r?void 0:r._def)&&(null===(a=e.type)||void 0===a||null===(n=a._def)||void 0===n?void 0:n.typeName)!==wt.ZodAny&&(i.items=Pr(e.type._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items"])}))),e.minLength&&h(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&h(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(h(i,"minItems",e.exactLength.value,e.exactLength.message,t),h(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,r);case wt.ZodUnion:case wt.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return wr(e,t);var r=_instanceof(e.options,Map)?Array.from(e.options.values()):e.options;if(r.every(function(e){return e._def.typeName in Sr&&(!e._def.checks||!e._def.checks.length)})){var n=r.reduce(function(e,t){var r=Sr[t._def.typeName];return r&&!e.includes(r)?_to_consumable_array(e).concat([r]):e},[]);return{type:n.length>1?n:n[0]}}if(r.every(function(e){return"ZodLiteral"===e._def.typeName&&!e.description})){var a=r.reduce(function(e,t){var r=_type_of(t._def.value);switch(r){case"string":case"number":case"boolean":return _to_consumable_array(e).concat([r]);case"bigint":return _to_consumable_array(e).concat(["integer"]);case"object":if(null===t._def.value)return _to_consumable_array(e).concat(["null"]);default:return e}},[]);if(a.length===r.length){var i=a.filter(function(e,t,r){return r.indexOf(e)===t});return{type:i.length>1?i:i[0],enum:r.reduce(function(e,t){return e.includes(t._def.value)?e:_to_consumable_array(e).concat([t._def.value])},[])}}}else if(r.every(function(e){return"ZodEnum"===e._def.typeName}))return{type:"string",enum:r.reduce(function(e,t){return _to_consumable_array(e).concat(_to_consumable_array(t._def.values.filter(function(t){return!e.includes(t)})))},[])};return wr(e,t)}(e,r);case wt.ZodIntersection:return function(e,t){var r=[Pr(e.left._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["allOf","0"])})),Pr(e.right._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["allOf","1"])}))].filter(function(e){return!!e}),n="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0,a=[];return r.forEach(function(e){if(gr(e)){var t;(t=a).push.apply(t,_to_consumable_array(e.allOf)),void 0===e.unevaluatedProperties&&(n=void 0)}else{var r=e;"additionalProperties"in e&&!1===e.additionalProperties?(e.additionalProperties,r=_object_without_properties(e,["additionalProperties"])):n=void 0,a.push(r)}}),a.length?_object_spread({allOf:a},n):void 0}(e,r);case wt.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map(function(e,r){return Pr(e._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items","".concat(r)])}))}).reduce(function(e,t){return void 0===t?e:_to_consumable_array(e).concat([t])},[]),additionalItems:Pr(e.rest._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["additionalItems"])}))}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map(function(e,r){return Pr(e._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items","".concat(r)])}))}).reduce(function(e,t){return void 0===t?e:_to_consumable_array(e).concat([t])},[])}}(e,r);case wt.ZodRecord:return w(e,r);case wt.ZodLiteral:return function(e,t){var r=_type_of(e.value);return"bigint"!==r&&"number"!==r&&"boolean"!==r&&"string"!==r?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===r?"integer":r,enum:[e.value]}:{type:"bigint"===r?"integer":r,const:e.value}}(e,r);case wt.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case wt.ZodNativeEnum:return function(e){var t=e.values,r=Object.keys(e.values).filter(function(e){return"number"!=typeof t[t[e]]}).map(function(e){return t[e]}),n=Array.from(new Set(r.map(function(e){return void 0===e?"undefined":_type_of(e)})));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:r}}(e);case wt.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:Sr[e.innerType._def.typeName],nullable:!0}:{type:[Sr[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){var r=Pr(e.innerType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath)}));return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&_object_spread_props(_object_spread({},r),{nullable:!0})}var n=Pr(e.innerType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["anyOf","0"])}));return n&&{anyOf:[n,{type:"null"}]}}(e,r);case wt.ZodOptional:return function(e,t){var r;if(t.currentPath.toString()===(null===(r=t.propertyPath)||void 0===r?void 0:r.toString()))return Pr(e.innerType._def,t);var n=Pr(e.innerType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["anyOf","1"])}));return n?{anyOf:[{not:m(t)},n]}:m(t)}(e,r);case wt.ZodMap:return function(e,t){return"record"===t.mapStrategy?w(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Pr(e.keyType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items","items","0"])}))||m(t),Pr(e.valueType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items","items","1"])}))||m(t)],minItems:2,maxItems:2}}}(e,r);case wt.ZodSet:return function(e,t){var r={type:"array",uniqueItems:!0,items:Pr(e.valueType._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["items"])}))};return e.minSize&&h(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&h(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}(e,r);case wt.ZodLazy:return function(){return e.getter()._def};case wt.ZodPromise:return function(e,t){return Pr(e.type._def,t)}(e,r);case wt.ZodNaN:case wt.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:m(_object_spread_props(_object_spread({},e),{currentPath:_to_consumable_array(e.currentPath).concat(["not"])}))}}(r);case wt.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Pr(e.schema._def,t):m(t)}(e,r);case wt.ZodAny:return m(r);case wt.ZodUnknown:return function(e){return m(e)}(r);case wt.ZodDefault:return function(e,t){return _object_spread_props(_object_spread({},Pr(e.innerType._def,t)),{default:e.defaultValue()})}(e,r);case wt.ZodBranded:return y(e,r);case wt.ZodReadonly:case wt.ZodCatch:return function(e,t){return Pr(e.innerType._def,t)}(e,r);case wt.ZodPipeline:return function(e,t){if("input"===t.pipeStrategy)return Pr(e.in._def,t);if("output"===t.pipeStrategy)return Pr(e.out._def,t);var r=Pr(e.in._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["allOf","0"])}));return{allOf:[r,Pr(e.out._def,_object_spread_props(_object_spread({},t),{currentPath:_to_consumable_array(t.currentPath).concat(["allOf",r?"1":"0"])}))].filter(function(e){return void 0!==e})}}(e,r);case wt.ZodFunction:case wt.ZodVoid:case wt.ZodSymbol:default:return}};function Pr(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=t.seen.get(e);if(t.override){var a,i=null===(a=t.override)||void 0===a?void 0:a.call(t,e,t,n,r);if(i!==fr)return i}if(n&&!r){var o=Or(n,t);if(void 0!==o)return o}var s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);var c=xr(e,e.typeName,t),u="function"==typeof c?Pr(c(),t):c;if(u&&Zr(e,t,u),t.postProcess){var l=t.postProcess(u,e,t);return s.jsonSchema=u,l}return s.jsonSchema=u,u}var Or=function(e,t){switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:mr(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(function(e,r){return t.currentPath[r]===e})?(console.warn("Recursive reference detected at ".concat(t.currentPath.join("/"),"! Defaulting to any")),m(t)):"seen"===t.$refStrategy?m(t):void 0}},Zr=function(e,t,r){return e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r},Ar=function(e,t){var r,n=hr(t),a="object"===(void 0===t?"undefined":_type_of(t))&&t.definitions?Object.entries(t.definitions).reduce(function(e,t){var r,a=_sliced_to_array(t,2),i=a[0],o=a[1];return _object_spread_props(_object_spread({},e),_define_property({},i,null!==(r=Pr(o._def,_object_spread_props(_object_spread({},n),{currentPath:_to_consumable_array(n.basePath).concat([n.definitionPath,i])}),!0))&&void 0!==r?r:m(n)))},{}):void 0,i="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,o=null!==(r=Pr(e._def,void 0===i?n:_object_spread_props(_object_spread({},n),{currentPath:_to_consumable_array(n.basePath).concat([n.definitionPath,i])}),!1))&&void 0!==r?r:m(n),s="object"===(void 0===t?"undefined":_type_of(t))&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==s&&(o.title=s),n.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[n.openAiAnyTypeName]||(a[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":_to_consumable_array(n.basePath).concat([n.definitionPath,n.openAiAnyTypeName]).join("/")}}));var c=void 0===i?a?_object_spread_props(_object_spread({},o),_define_property({},n.definitionPath,a)):o:_define_property({$ref:_to_consumable_array("relative"===n.$refStrategy?[]:n.basePath).concat([n.definitionPath,i]).join("/")},n.definitionPath,_object_spread_props(_object_spread({},a),_define_property({},i,o)));return"jsonSchema7"===n.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==n.target&&"openAi"!==n.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},Tr=Object.defineProperty,Cr=function(e,t){for(var r in t)Tr(e,r,{get:t[r],enumerable:!0})},Er=Y.string(),Nr=Y.number(),Ir=(Y.boolean(),Y.string().min(1)),Rr=Y.number().int().positive(),Mr=Y.number().int().nonnegative(),Dr=Y.number().describe("Tagging version number");Y.union([Y.string(),Y.number(),Y.boolean()]).optional();Cr({},{ErrorHandlerSchema:function(){return $r},HandlerSchema:function(){return Ur},LogHandlerSchema:function(){return Fr},StorageSchema:function(){return Lr},StorageTypeSchema:function(){return zr},errorHandlerJsonSchema:function(){return Jr},handlerJsonSchema:function(){return Wr},logHandlerJsonSchema:function(){return qr},storageJsonSchema:function(){return Br},storageTypeJsonSchema:function(){return Vr}});var zr=Y.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),Lr=Y.object({Local:Y.literal("local"),Session:Y.literal("session"),Cookie:Y.literal("cookie")}).describe("Storage type constants for type-safe references"),$r=Y.any().describe("Error handler function: (error, state?) => void"),Fr=Y.any().describe("Log handler function: (message, verbose?) => void"),Ur=Y.object({Error:$r.describe("Error handler function"),Log:Fr.describe("Log handler function")}).describe("Handler interface with error and log functions"),Vr=Ar(zr,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),Br=Ar(Lr,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Jr=Ar($r,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),qr=Ar(Fr,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Wr=Ar(Ur,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});Y.object({onError:$r.optional().describe("Error handler function: (error, state?) => void"),onLog:Fr.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),Y.object({verbose:Y.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),Y.object({queue:Y.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),Y.object({}).partial(),Y.object({init:Y.boolean().describe("Whether to initialize immediately").optional(),loadScript:Y.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),Y.object({disabled:Y.boolean().describe("Set to true to disable").optional()}).partial(),Y.object({primary:Y.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),Y.object({settings:Y.any().optional().describe("Implementation-specific configuration")}).partial(),Y.object({env:Y.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),Y.object({type:Y.string().optional().describe("Instance type identifier"),config:Y.any().describe("Instance configuration")}).partial(),Y.object({collector:Y.any().describe("Collector instance (runtime object)"),config:Y.any().describe("Configuration"),env:Y.any().describe("Environment dependencies")}).partial(),Y.object({batch:Y.number().optional().describe("Batch size: bundle N events for batch processing"),batched:Y.any().optional().describe("Batch of events to be processed")}).partial(),Y.object({ignore:Y.boolean().describe("Set to true to skip processing").optional(),condition:Y.string().optional().describe("Condition function: return true to process")}).partial(),Y.object({sources:Y.record(Y.string(),Y.any()).describe("Map of source instances")}).partial(),Y.object({destinations:Y.record(Y.string(),Y.any()).describe("Map of destination instances")}).partial();Cr({},{ConsentSchema:function(){return Qr},DeepPartialEventSchema:function(){return cn},EntitiesSchema:function(){return an},EntitySchema:function(){return nn},EventSchema:function(){return on},OrderedPropertiesSchema:function(){return Gr},PartialEventSchema:function(){return sn},PropertiesSchema:function(){return Xr},PropertySchema:function(){return Hr},PropertyTypeSchema:function(){return Kr},SourceSchema:function(){return rn},SourceTypeSchema:function(){return Yr},UserSchema:function(){return en},VersionSchema:function(){return tn},consentJsonSchema:function(){return mn},entityJsonSchema:function(){return _n},eventJsonSchema:function(){return un},orderedPropertiesJsonSchema:function(){return fn},partialEventJsonSchema:function(){return ln},propertiesJsonSchema:function(){return pn},sourceTypeJsonSchema:function(){return hn},userJsonSchema:function(){return dn}});var Kr=Y.lazy(function(){return Y.union([Y.boolean(),Y.string(),Y.number(),Y.record(Y.string(),Hr)])}),Hr=Y.lazy(function(){return Y.union([Kr,Y.array(Kr)])}),Xr=Y.record(Y.string(),Hr.optional()).describe("Flexible property collection with optional values"),Gr=Y.record(Y.string(),Y.tuple([Hr,Y.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),Yr=Y.union([Y.enum(["web","server","app","other"]),Y.string()]).describe("Source type: web, server, app, other, or custom"),Qr=Y.record(Y.string(),Y.boolean()).describe("Consent requirement mapping (group name → state)"),en=Xr.and(Y.object({id:Y.string().optional().describe("User identifier"),device:Y.string().optional().describe("Device identifier"),session:Y.string().optional().describe("Session identifier"),hash:Y.string().optional().describe("Hashed identifier"),address:Y.string().optional().describe("User address"),email:Y.string().email().optional().describe("User email address"),phone:Y.string().optional().describe("User phone number"),userAgent:Y.string().optional().describe("Browser user agent string"),browser:Y.string().optional().describe("Browser name"),browserVersion:Y.string().optional().describe("Browser version"),deviceType:Y.string().optional().describe("Device type (mobile, desktop, tablet)"),os:Y.string().optional().describe("Operating system"),osVersion:Y.string().optional().describe("Operating system version"),screenSize:Y.string().optional().describe("Screen dimensions"),language:Y.string().optional().describe("User language"),country:Y.string().optional().describe("User country"),region:Y.string().optional().describe("User region/state"),city:Y.string().optional().describe("User city"),zip:Y.string().optional().describe("User postal code"),timezone:Y.string().optional().describe("User timezone"),ip:Y.string().optional().describe("User IP address"),internal:Y.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),tn=Xr.and(Y.object({source:Er.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Dr})).describe("Walker version information"),rn=Xr.and(Y.object({type:Yr.describe("Source type identifier"),id:Er.describe("Source identifier (typically URL on web)"),previous_id:Er.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),nn=Y.lazy(function(){return Y.object({entity:Y.string().describe("Entity name"),data:Xr.describe("Entity-specific properties"),nested:Y.array(nn).describe("Nested child entities"),context:Gr.describe("Entity context data")})}).describe("Nested entity structure with recursive nesting support"),an=Y.array(nn).describe("Array of nested entities"),on=Y.object({name:Y.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Xr.describe("Event-specific properties"),context:Gr.describe("Ordered context properties with priorities"),globals:Xr.describe("Global properties shared across events"),custom:Xr.describe("Custom implementation-specific properties"),user:en.describe("User identification and attributes"),nested:an.describe("Related nested entities"),consent:Qr.describe("Consent states at event time"),id:Ir.describe("Unique event identifier (timestamp-based)"),trigger:Er.describe("Event trigger identifier"),entity:Er.describe("Parsed entity from event name"),action:Er.describe("Parsed action from event name"),timestamp:Rr.describe("Unix timestamp in milliseconds since epoch"),timing:Nr.describe("Event processing timing information"),group:Er.describe("Event grouping identifier"),count:Mr.describe("Event count in session"),version:tn.describe("Walker version information"),source:rn.describe("Event source information")}).describe("Complete walkerOS event structure"),sn=on.partial().describe("Partial event structure with all fields optional"),cn=Y.lazy(function(){return on.deepPartial()}).describe("Deep partial event structure with all nested fields optional"),un=Ar(on,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),ln=Ar(sn,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),dn=Ar(en,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),pn=Ar(Xr,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),fn=Ar(Gr,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),_n=Ar(nn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),hn=Ar(Yr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),mn=Ar(Qr,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});Cr({},{ConfigSchema:function(){return Pn},LoopSchema:function(){return gn},MapSchema:function(){return kn},PolicySchema:function(){return Sn},ResultSchema:function(){return On},RuleSchema:function(){return wn},RulesSchema:function(){return xn},SetSchema:function(){return bn},ValueConfigSchema:function(){return jn},ValueSchema:function(){return yn},ValuesSchema:function(){return vn},configJsonSchema:function(){return Mn},loopJsonSchema:function(){return Tn},mapJsonSchema:function(){return En},policyJsonSchema:function(){return Nn},ruleJsonSchema:function(){return In},rulesJsonSchema:function(){return Rn},setJsonSchema:function(){return Cn},valueConfigJsonSchema:function(){return An},valueJsonSchema:function(){return Zn}});var yn=Y.lazy(function(){return Y.union([Y.string().describe('String value or property path (e.g., "data.id")'),Y.number().describe("Numeric value"),Y.boolean().describe("Boolean value"),jn,Y.array(yn).describe("Array of values")])}),vn=Y.array(yn).describe("Array of transformation values"),gn=Y.tuple([yn,yn]).describe("Loop transformation: [source, transform] tuple for array processing"),bn=Y.array(yn).describe("Set: Array of values for selection or combination"),kn=Y.record(Y.string(),yn).describe("Map: Object mapping keys to transformation values"),jn=Y.object({key:Y.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:Y.union([Y.string(),Y.number(),Y.boolean()]).optional().describe("Static primitive value"),fn:Y.string().optional().describe("Custom transformation function as string (serialized)"),map:kn.optional().describe("Object mapping: transform event data to structured output"),loop:gn.optional().describe("Loop transformation: [source, transform] for array processing"),set:bn.optional().describe("Set of values: combine or select from multiple values"),consent:Qr.optional().describe("Required consent states to include this value"),condition:Y.string().optional().describe("Condition function as string: return true to include value"),validate:Y.string().optional().describe("Validation function as string: return true if value is valid")}).refine(function(e){return Object.keys(e).length>0},{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),Sn=Y.record(Y.string(),yn).describe("Policy rules for event pre-processing (key → value mapping)"),wn=Y.object({batch:Y.number().optional().describe("Batch size: bundle N events for batch processing"),condition:Y.string().optional().describe("Condition function as string: return true to process event"),consent:Qr.optional().describe("Required consent states to process this event"),settings:Y.any().optional().describe("Destination-specific settings for this event mapping"),data:Y.union([yn,vn]).optional().describe("Data transformation rules for event"),ignore:Y.boolean().optional().describe("Set to true to skip processing this event"),name:Y.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:Sn.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),xn=Y.record(Y.string(),Y.record(Y.string(),Y.union([wn,Y.array(wn)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),Pn=Y.object({consent:Qr.optional().describe("Required consent states to process any events"),data:Y.union([yn,vn]).optional().describe("Global data transformation applied to all events"),mapping:xn.optional().describe("Entity-action specific mapping rules"),policy:Sn.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),On=Y.object({eventMapping:wn.optional().describe("Resolved mapping rule for event"),mappingKey:Y.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),Zn=Ar(yn,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),An=Ar(jn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Tn=Ar(gn,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Cn=Ar(bn,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),En=Ar(kn,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Nn=Ar(Sn,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),In=Ar(wn,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),Rn=Ar(xn,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Mn=Ar(Pn,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});Cr({},{BatchSchema:function(){return Jn},ConfigSchema:function(){return Dn},ContextSchema:function(){return $n},DLQSchema:function(){return ea},DataSchema:function(){return qn},DestinationPolicySchema:function(){return Ln},DestinationsSchema:function(){return Xn},InitDestinationsSchema:function(){return Hn},InitSchema:function(){return Kn},InstanceSchema:function(){return Wn},PartialConfigSchema:function(){return zn},PushBatchContextSchema:function(){return Un},PushContextSchema:function(){return Fn},PushEventSchema:function(){return Vn},PushEventsSchema:function(){return Bn},PushResultSchema:function(){return Yn},RefSchema:function(){return Gn},ResultSchema:function(){return Qn},batchJsonSchema:function(){return ia},configJsonSchema:function(){return ta},contextJsonSchema:function(){return na},instanceJsonSchema:function(){return oa},partialConfigJsonSchema:function(){return ra},pushContextJsonSchema:function(){return aa},resultJsonSchema:function(){return sa}});var Dn=Y.object({consent:Qr.optional().describe("Required consent states to send events to this destination"),settings:Y.any().describe("Implementation-specific configuration").optional(),data:Y.union([yn,vn]).optional().describe("Global data transformation applied to all events for this destination"),env:Y.any().describe("Environment dependencies (platform-specific)").optional(),id:Ir.describe("Destination instance identifier (defaults to destination key)").optional(),init:Y.boolean().describe("Whether to initialize immediately").optional(),loadScript:Y.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:xn.optional().describe("Entity-action specific mapping rules for this destination"),policy:Sn.optional().describe("Pre-processing policy rules applied before event mapping"),queue:Y.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:Y.boolean().describe("Enable verbose logging for debugging").optional(),onError:$r.optional(),onLog:Fr.optional()}).describe("Destination configuration"),zn=Dn.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Ln=Sn.describe("Destination policy rules for event pre-processing"),$n=Y.object({collector:Y.any().describe("Collector instance (runtime object)"),config:Dn.describe("Destination configuration"),data:Y.union([Y.any(),Y.undefined(),Y.array(Y.union([Y.any(),Y.undefined()]))]).optional().describe("Transformed event data"),env:Y.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Fn=$n.extend({mapping:wn.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Un=Fn.describe("Batch push context with event-specific mapping"),Vn=Y.object({event:on.describe("The event to process"),mapping:wn.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Bn=Y.array(Vn).describe("Array of events with mappings"),Jn=Y.object({key:Y.string().describe('Batch key (usually mapping key like "product.view")'),events:Y.array(on).describe("Array of events in batch"),data:Y.array(Y.union([Y.any(),Y.undefined(),Y.array(Y.union([Y.any(),Y.undefined()]))])).describe("Transformed data for each event"),mapping:wn.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),qn=Y.union([Y.any(),Y.undefined(),Y.array(Y.union([Y.any(),Y.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Wn=Y.object({config:Dn.describe("Destination configuration"),queue:Y.array(on).optional().describe("Queued events awaiting consent"),dlq:Y.array(Y.tuple([on,Y.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:Y.string().optional().describe("Destination type identifier"),env:Y.any().optional().describe("Environment dependencies"),init:Y.any().optional().describe("Initialization function"),push:Y.any().describe("Push function for single events"),pushBatch:Y.any().optional().describe("Batch push function"),on:Y.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Kn=Y.object({code:Wn.describe("Destination instance with implementation"),config:zn.optional().describe("Partial configuration overrides"),env:Y.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Hn=Y.record(Y.string(),Kn).describe("Map of destination IDs to initialization configurations"),Xn=Y.record(Y.string(),Wn).describe("Map of destination IDs to runtime instances"),Gn=Y.object({id:Y.string().describe("Destination ID"),destination:Wn.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Yn=Y.object({queue:Y.array(on).optional().describe("Events queued (awaiting consent)"),error:Y.any().optional().describe("Error if push failed")}).describe("Push operation result"),Qn=Y.object({successful:Y.array(Gn).describe("Destinations that processed successfully"),queued:Y.array(Gn).describe("Destinations that queued events"),failed:Y.array(Gn).describe("Destinations that failed to process")}).describe("Overall destination processing result"),ea=Y.array(Y.tuple([on,Y.any()])).describe("Dead letter queue: [(event, error), ...]"),ta=Ar(Dn,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),ra=Ar(zn,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),na=Ar($n,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),aa=Ar(Fn,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),ia=Ar(Jn,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),oa=Ar(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),sa=Ar(Qn,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});Cr({},{CommandTypeSchema:function(){return ca},ConfigSchema:function(){return ua},DestinationsSchema:function(){return _a},InitConfigSchema:function(){return da},InstanceSchema:function(){return ha},PushContextSchema:function(){return pa},SessionDataSchema:function(){return la},SourcesSchema:function(){return fa},commandTypeJsonSchema:function(){return ma},configJsonSchema:function(){return ya},initConfigJsonSchema:function(){return ga},instanceJsonSchema:function(){return ka},pushContextJsonSchema:function(){return ba},sessionDataJsonSchema:function(){return va}});var ca=Y.union([Y.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),Y.string()]).describe("Collector command type: standard commands or custom string for extensions"),ua=Y.object({run:Y.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Dr,globalsStatic:Xr.describe("Static global properties that persist across collector runs"),sessionStatic:Y.record(Y.any()).describe("Static session data that persists across collector runs"),verbose:Y.boolean().describe("Enable verbose logging for debugging"),onError:$r.optional(),onLog:Fr.optional()}).describe("Core collector configuration"),la=Xr.and(Y.object({isStart:Y.boolean().describe("Whether this is a new session start"),storage:Y.boolean().describe("Whether storage is available"),id:Ir.describe("Session identifier").optional(),start:Rr.describe("Session start timestamp").optional(),marketing:Y.literal(!0).optional().describe("Marketing attribution flag"),updated:Rr.describe("Last update timestamp").optional(),isNew:Y.boolean().describe("Whether this is a new session").optional(),device:Ir.describe("Device identifier").optional(),count:Mr.describe("Event count in session").optional(),runs:Mr.describe("Number of runs").optional()})).describe("Session state and tracking data"),da=ua.partial().extend({consent:Qr.optional().describe("Initial consent state"),user:en.optional().describe("Initial user data"),globals:Xr.optional().describe("Initial global properties"),sources:Y.any().optional().describe("Source configurations"),destinations:Y.any().optional().describe("Destination configurations"),custom:Xr.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),pa=Y.object({mapping:Pn.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),fa=Y.record(Y.string(),Y.any()).describe("Map of source IDs to source instances"),_a=Y.record(Y.string(),Y.any()).describe("Map of destination IDs to destination instances"),ha=Y.object({push:Y.any().describe("Push function for processing events"),command:Y.any().describe("Command function for walker commands"),allowed:Y.boolean().describe("Whether event processing is allowed"),config:ua.describe("Current collector configuration"),consent:Qr.describe("Current consent state"),count:Y.number().describe("Event count (increments with each event)"),custom:Xr.describe("Custom implementation-specific properties"),sources:fa.describe("Registered source instances"),destinations:_a.describe("Registered destination instances"),globals:Xr.describe("Current global properties"),group:Y.string().describe("Event grouping identifier"),hooks:Y.any().describe("Lifecycle hook functions"),on:Y.any().describe("Event lifecycle configuration"),queue:Y.array(on).describe("Queued events awaiting processing"),round:Y.number().describe("Collector run count (increments with each run)"),session:Y.union([Y.undefined(),la]).describe("Current session state"),timing:Y.number().describe("Event processing timing information"),user:en.describe("Current user data"),version:Y.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),ma=Ar(ca,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),ya=Ar(ua,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),va=Ar(la,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),ga=Ar(da,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),ba=Ar(pa,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),ka=Ar(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});Cr({},{BaseEnvSchema:function(){return ja},ConfigSchema:function(){return Sa},InitSchema:function(){return Pa},InitSourceSchema:function(){return Oa},InitSourcesSchema:function(){return Za},InstanceSchema:function(){return xa},PartialConfigSchema:function(){return wa},baseEnvJsonSchema:function(){return Aa},configJsonSchema:function(){return Ta},initSourceJsonSchema:function(){return Na},initSourcesJsonSchema:function(){return Ia},instanceJsonSchema:function(){return Ea},partialConfigJsonSchema:function(){return Ca}});var ja=Y.object({push:Y.any().describe("Collector push function"),command:Y.any().describe("Collector command function"),sources:Y.any().optional().describe("Map of registered source instances"),elb:Y.any().describe("Public API function (alias for collector.push)")}).catchall(Y.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),Sa=Pn.extend({settings:Y.any().describe("Implementation-specific configuration").optional(),env:ja.optional().describe("Environment dependencies (platform-specific)"),id:Ir.describe("Source identifier (defaults to source key)").optional(),onError:$r.optional(),disabled:Y.boolean().describe("Set to true to disable").optional(),primary:Y.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),wa=Sa.deepPartial().describe("Partial source configuration with all fields deeply optional"),xa=Y.object({type:Y.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:Sa.describe("Current source configuration"),push:Y.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:Y.any().optional().describe("Cleanup function called when source is removed"),on:Y.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),Pa=Y.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Oa=Y.object({code:Pa.describe("Source initialization function"),config:wa.optional().describe("Partial configuration overrides"),env:ja.partial().optional().describe("Partial environment overrides"),primary:Y.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),Za=Y.record(Y.string(),Oa).describe("Map of source IDs to initialization configurations"),Aa=Ar(ja,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),Ta=Ar(Sa,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),Ca=Ar(wa,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),Ea=Ar(xa,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),Na=Ar(Oa,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Ia=Ar(Za,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"}),Ra={merge:!0,shallow:!0,extend:!0};function Ma(e){for(var t=arguments.length>2?arguments[2]:void 0,r=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),n=e,a=0;a<r.length;a++){var i=r[a];if("*"===i&&Z(n)){var o=r.slice(a+1).join("."),s=[],c=!0,u=!1,l=void 0;try{for(var d,p=n[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var f=Ma(d.value,o,t);s.push(f)}}catch(e){u=!0,l=e}finally{try{c||null==p.return||p.return()}finally{if(u)throw l}}return s}if(!(n=_instanceof(n,Object)?n[i]:void 0))break}return A(n)?n:t}function Da(e){return function(e){return"boolean"==typeof e}(e)||C(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!A(e)||Z(e)&&e.every(Da)||T(e)&&Object.values(e).every(Da)}function za(e,t){return _async_to_generator(function(e,t){var r,n,a,i=arguments;return _ts_generator(this,function(o){return n=(r=i.length>2&&void 0!==i[2]?i[2]:{}).collector,a=r.consent,[2,(Z(t)?t:[t]).reduce(function(t,i){return _async_to_generator(function(){var o,s,c,u,l,d,p,f,_,h,m,y,v,g,b,k,j,S,w,x,P;return _ts_generator(this,function(O){switch(O.label){case 0:return[4,t];case 1:return(o=O.sent())?[2,o]:(s=C(i)?{key:i}:i,Object.keys(s).length?(c=s.condition,u=s.consent,l=s.fn,d=s.key,p=s.loop,f=s.map,_=s.set,h=s.validate,m=s.value,(y=c)?[4,R(c)(e,i,n)]:[3,3]):[2]);case 2:y=!O.sent(),O.label=3;case 3:return y?[2]:u&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=void 0===e;return Object.keys(t).forEach(function(a){t[a]&&(r[a]=!0,e&&e[a]&&(n=!0))}),!!n&&r}(u,a)?[2,m]:(v=A(m)?m:e,l?[4,R(l)(e,i,r)]:[3,5]);case 4:v=O.sent(),O.label=5;case 5:return d&&(v=Ma(e,d,m)),p?(g=_sliced_to_array(p,2),b=g[0],k=g[1],"this"!==b?[3,6]:(S=[e],[3,8])):[3,11];case 6:return[4,M(e,b,r)];case 7:S=O.sent(),O.label=8;case 8:return Z(j=S)?[4,Promise.all(j.map(function(e){return M(e,k,r)}))]:[3,10];case 9:v=O.sent().filter(A),O.label=10;case 10:return[3,17];case 11:return f?[4,Object.entries(f).reduce(function(t,n){var a=_sliced_to_array(n,2),i=a[0],o=a[1];return _async_to_generator(function(){var n,a;return _ts_generator(this,function(s){switch(s.label){case 0:return[4,t];case 1:return n=s.sent(),[4,M(e,o,r)];case 2:return a=s.sent(),[2,(A(a)&&(n[i]=a),n)]}})})()},Promise.resolve({}))]:[3,13];case 12:return v=O.sent(),[3,16];case 13:return(w=_)?[4,Promise.all(_.map(function(t){return za(e,t,r)}))]:[3,15];case 14:w=v=O.sent(),O.label=15;case 15:O.label=16;case 16:O.label=17;case 17:return(x=h)?[4,R(h)(v)]:[3,19];case 18:x=!O.sent(),O.label=19;case 19:return x&&(v=void 0),P=I(v),[2,A(P)?P:I(m)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}var La={},$a={};W($a,{env:function(){return Fa},events:function(){return Ba},mapping:function(){return Ja}});var Fa={};W(Fa,{init:function(){return Ua},push:function(){return Va}});var Ua={window:{_paq:void 0},document:{createElement:function(){return{type:"",src:"",async:!1,defer:!1}},head:{appendChild:function(){}}}},Va={window:{_paq:[]},document:{createElement:function(){return{type:"",src:"",async:!1,defer:!1}},head:{appendChild:function(){}}}},Ba={};W(Ba,{ecommerceAddToCart:function(){return $},ecommerceCartUpdate:function(){return U},ecommerceOrder:function(){return L},ecommerceProductDetailView:function(){return F}});var Ja={};W(Ja,{config:function(){return Ga},ecommerceAddToCart:function(){return Ka},ecommerceCartUpdate:function(){return Xa},ecommerceOrder:function(){return Wa},ecommerceProductDetailView:function(){return Ha}});var qa={sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1},variant:{key:"data.color"},customDimensions:{map:{1:"data.size"}}},Wa={name:"ecommerceOrder",data:{set:[{loop:["nested",{condition:function(e){return T(e)&&"product"===e.entity},map:qa}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}},{map:{currencyCode:{value:"EUR"}}}]}},Ka={name:"ecommerceAddToCart",data:{set:[{set:[{map:qa}]},{map:{currencyCode:{value:"EUR"}}}]}},Ha={name:"ecommerceProductDetailView",data:{set:[{set:[{map:qa}]},{map:{currencyCode:{value:"EUR"}}}]}},Xa={name:"ecommerceCartUpdate",data:{set:[{loop:["nested",{condition:function(e){return T(e)&&"product"===e.entity},map:qa}]},"data.value",{map:{currencyCode:{value:"EUR"}}}]}},Ga={order:{complete:Wa},product:{add:Ka,view:Ha},cart:{view:Xa}},Ya={};W(Ya,{MappingSchema:function(){return ti},SettingsSchema:function(){return ei},mapping:function(){return ni},settings:function(){return ri}});var Qa,ei=Y.object({appId:Y.string().min(1).describe("ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)"),url:Y.string().url().describe("URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)"),linkTracking:Y.boolean().default(!1).describe("Enables/Disables download and outlink tracking")}),ti=Y.object({goalId:Y.string().describe("ID to count the event as a goal (like 1)"),goalValue:Y.string().describe("Property to be used as the goal value (like data.value)").optional()}),ri=O(ei),ni=O(ti),ai={type:"piwikpro",config:{},init:function(e){var t=e.config,r=e.env,n=D(r).window,a=t.settings,i=t.loadScript,o=a||{},s=o.appId,c=o.url;if(!s||!c)return!1;n._paq=n._paq||[];var u=n._paq.push;i&&(!function(e,t){var r=D(t).document,n=r.createElement("script");n.type="text/javascript",n.src=e+"ppms.js",n.async=!0,n.defer=!0,r.head.appendChild(n)}(c,r),u(["setTrackerUrl",c+"ppms.php"]),u(["setSiteId",s])),!1!==(null==a?void 0:a.linkTracking)&&u(["enableLinkTracking"])},push:function(e,t){return _async_to_generator(function(e,t){var r,n,a,i,o,s,c,u,l,d,p;return _ts_generator(this,function(f){switch(f.label){case 0:return t.config,r=t.mapping,n=void 0===r?{}:r,a=t.data,i=t.env,o=D(i),s=o.window,c=s._paq.push,"page view"!==e.name||n.settings?[3,2]:(u=["trackPageView"],[4,M(e,"data.title")]);case 1:return c.apply(void 0,[u.concat([f.sent()])]),[2];case 2:return l=n.settings||{},d=Z(a)?a:[a],c([e.name].concat(_to_consumable_array(d))),l.goalId&&(p=l.goalValue?M(e,l.goalValue):void 0,c(["trackGoal",l.goalId,p])),[2]}})}).apply(this,arguments)}},ii=ai;return Qa=K,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var a=!0,i=!1,o=void 0;try{for(var s,c=function(){var a=s.value;q.call(e,a)||a===r||V(e,a,{get:function(){return t[a]},enumerable:!(n=B(t,a))||n.enumerable})},u=J(t)[Symbol.iterator]();!(a=(s=u.next()).done);a=!0)c()}catch(e){i=!0,o=e}finally{try{a||null==u.return||u.return()}finally{if(i)throw o}}}return e}(V({},"__esModule",{value:!0}),Qa)}();
1
+ "use strict";function _array_like_to_array(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function asyncGeneratorStep(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function _async_to_generator(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){asyncGeneratorStep(a,n,o,i,u,"next",e)}function u(e){asyncGeneratorStep(a,n,o,i,u,"throw",e)}i(void 0)})}}function _define_property(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _instanceof(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function _iterable_to_array(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){u=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw o}}return a}}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){_define_property(e,t,r[t])})}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _object_spread_props(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function _sliced_to_array(e,t){return _array_with_holes(e)||_iterable_to_array_limit(e,t)||_unsupported_iterable_to_array(e,t)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _type_of(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function _unsupported_iterable_to_array(e,t){if(e){if("string"==typeof e)return _array_like_to_array(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_array_like_to_array(e,t):void 0}}function _ts_generator(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=u(0),i.throw=u(1),i.return=u(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&u[0]?n.return:u[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,u[1])).done)return o;switch(n=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,n=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=t.call(e,a)}catch(e){u=[6,e],n=0}finally{r=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}var Destination=function(){var e=function(e){return Array.isArray(e)},t=function(e){return void 0!==e},r=function(t){return"object"==(void 0===t?"undefined":_type_of(t))&&null!==t&&!e(t)&&"[object Object]"===Object.prototype.toString.call(t)},n=function(e){return"string"==typeof e},o=function(e){return p(e)?e:void 0},a=function(e,t,r){return function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return _async_to_generator(function(){var n;return _ts_generator(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,4,6]),[4,e.apply(void 0,_to_consumable_array(o))];case 1:case 3:return[2,a.sent()];case 2:return n=a.sent(),t?[4,t(n)]:[2];case 4:return[4,null==r?void 0:r()];case 5:return a.sent(),[7];case 6:return[2]}})})()}},i=function(n){return _async_to_generator(function(n){var o,i,u,c,l,s,f,y,_,p,d,v,h,g=arguments;return _ts_generator(this,function(m){switch(m.label){case 0:if(o=g.length>1&&void 0!==g[1]?g[1]:{},i=g.length>2&&void 0!==g[2]?g[2]:{},!t(n))return[2];c=r(n)&&n.consent||i.consent||(null===(u=i.collector)||void 0===u?void 0:u.consent),l=e(o)?o:[o],s=!0,f=!1,y=void 0,m.label=1;case 1:m.trys.push([1,6,7,8]),_=l[Symbol.iterator](),m.label=2;case 2:return(s=(p=_.next()).done)?[3,5]:(d=p.value,[4,a(b)(n,d,_object_spread_props(_object_spread({},i),{consent:c}))]);case 3:if(v=m.sent(),t(v))return[2,v];m.label=4;case 4:return s=!0,[3,2];case 5:return[3,8];case 6:return h=m.sent(),f=!0,y=h,[3,8];case 7:try{s||null==_.return||_.return()}finally{if(f)throw y}return[7];case 8:return[2]}})}).apply(this,arguments)},u=function(e){return _object_spread({window:"undefined"!=typeof window?window:globalThis.window,document:"undefined"!=typeof document?document:globalThis.document},e)},c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,f=Object.prototype.hasOwnProperty,y={};function _(r){for(var n=arguments.length>2?arguments[2]:void 0,o=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),a=r,i=0;i<o.length;i++){var u=o[i];if("*"===u&&e(a)){var c=o.slice(i+1).join("."),l=[],s=!0,f=!1,y=void 0;try{for(var p,b=a[Symbol.iterator]();!(s=(p=b.next()).done);s=!0){var d=_(p.value,c,n);l.push(d)}}catch(e){f=!0,y=e}finally{try{s||null==b.return||b.return()}finally{if(f)throw y}}return l}if(!(a=_instanceof(a,Object)?a[u]:void 0))break}return t(a)?a:n}function p(o){return function(e){return"boolean"==typeof e}(o)||n(o)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(o)||!t(o)||e(o)&&o.every(p)||r(o)&&Object.values(o).every(p)}function b(r,u){return _async_to_generator(function(r,u){var c,l,s,f=arguments;return _ts_generator(this,function(y){return l=(c=f.length>2&&void 0!==f[2]?f[2]:{}).collector,s=c.consent,[2,(e(u)?u:[u]).reduce(function(u,f){return _async_to_generator(function(){var y,p,d,v,h,g,m,w,j,O,S,P,k,I,A,x,D,T,E,G,q;return _ts_generator(this,function(N){switch(N.label){case 0:return[4,u];case 1:return(y=N.sent())?[2,y]:(p=n(f)?{key:f}:f,Object.keys(p).length?(d=p.condition,v=p.consent,h=p.fn,g=p.key,m=p.loop,w=p.map,j=p.set,O=p.validate,S=p.value,(P=d)?[4,a(d)(r,f,l)]:[3,3]):[2]);case 2:P=!N.sent(),N.label=3;case 3:return P?[2]:v&&!function(e){var t=_object_spread({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r={},n=void 0===e;return Object.keys(t).forEach(function(o){t[o]&&(r[o]=!0,e&&e[o]&&(n=!0))}),!!n&&r}(v,s)?[2,S]:(k=t(S)?S:r,h?[4,a(h)(r,f,c)]:[3,5]);case 4:k=N.sent(),N.label=5;case 5:return g&&(k=_(r,g,S)),m?(I=_sliced_to_array(m,2),A=I[0],x=I[1],"this"!==A?[3,6]:(T=[r],[3,8])):[3,11];case 6:return[4,i(r,A,c)];case 7:T=N.sent(),N.label=8;case 8:return e(D=T)?[4,Promise.all(D.map(function(e){return i(e,x,c)}))]:[3,10];case 9:k=N.sent().filter(t),N.label=10;case 10:return[3,17];case 11:return w?[4,Object.entries(w).reduce(function(e,n){var o=_sliced_to_array(n,2),a=o[0],u=o[1];return _async_to_generator(function(){var n,o;return _ts_generator(this,function(l){switch(l.label){case 0:return[4,e];case 1:return n=l.sent(),[4,i(r,u,c)];case 2:return o=l.sent(),[2,(t(o)&&(n[a]=o),n)]}})})()},Promise.resolve({}))]:[3,13];case 12:return k=N.sent(),[3,16];case 13:return(E=j)?[4,Promise.all(j.map(function(e){return b(r,e,c)}))]:[3,15];case 14:E=k=N.sent(),N.label=15;case 15:N.label=16;case 16:N.label=17;case 17:return(G=O)?[4,a(O)(k)]:[3,19];case 18:G=!N.sent(),N.label=19;case 19:return G&&(k=void 0),q=o(k),[2,t(q)?q:o(S)]}})})()},Promise.resolve(void 0))]})}).apply(this,arguments)}!function(e,t){for(var r in t)c(e,r,{get:t[r],enumerable:!0})}(y,{DestinationPiwikPro:function(){return v},default:function(){return g},destinationPiwikPro:function(){return h}});var d,v={},h={type:"piwikpro",config:{},init:function(e){var t=e.config,r=e.env,n=u(r).window,o=t.settings,a=t.loadScript,i=o||{},c=i.appId,l=i.url;if(!c||!l)return!1;n._paq=n._paq||[];var s=n._paq.push;a&&(!function(e,t){var r=u(t).document,n=r.createElement("script");n.type="text/javascript",n.src=e+"ppms.js",n.async=!0,n.defer=!0,r.head.appendChild(n)}(l,r),s(["setTrackerUrl",l+"ppms.php"]),s(["setSiteId",c])),!1!==(null==o?void 0:o.linkTracking)&&s(["enableLinkTracking"])},push:function(t,r){return _async_to_generator(function(t,r){var n,o,a,c,l,s,f,y,_,p,b;return _ts_generator(this,function(d){switch(d.label){case 0:return r.config,n=r.mapping,o=void 0===n?{}:n,a=r.data,c=r.env,l=u(c),s=l.window,f=s._paq.push,"page view"!==t.name||o.settings?[3,2]:(y=["trackPageView"],[4,i(t,"data.title")]);case 1:return f.apply(void 0,[y.concat([d.sent()])]),[2];case 2:return _=o.settings||{},p=e(a)?a:[a],f([t.name].concat(_to_consumable_array(p))),_.goalId&&(b=_.goalValue?i(t,_.goalValue):void 0,f(["trackGoal",_.goalId,b])),[2]}})}).apply(this,arguments)}},g=h;return d=y,function(e,t,r,n){if(t&&"object"===(void 0===t?"undefined":_type_of(t))||"function"==typeof t){var o=!0,a=!1,i=void 0;try{for(var u,y=function(){var o=u.value;f.call(e,o)||o===r||c(e,o,{get:function(){return t[o]},enumerable:!(n=l(t,o))||n.enumerable})},_=s(t)[Symbol.iterator]();!(o=(u=_.next()).done);o=!0)y()}catch(e){a=!0,i=e}finally{try{o||null==_.return||_.return()}finally{if(a)throw i}}}return e}(c({},"__esModule",{value:!0}),d)}();
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},i={};n(i,{DestinationPiwikPro:()=>p,default:()=>S,destinationPiwikPro:()=>x,examples:()=>s,schemas:()=>T}),module.exports=(e=i,((e,n,i,c)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let d of r(n))o.call(e,d)||d===i||t(e,d,{get:()=>n[d],enumerable:!(c=a(n,d))||c.enumerable});return e})(t({},"__esModule",{value:!0}),e));var c=require("@walkeros/core"),d=require("@walkeros/web-core"),p={},s={};n(s,{env:()=>u,events:()=>g,mapping:()=>b});var u={};n(u,{init:()=>l,push:()=>m});var l={window:{_paq:void 0},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},m={window:{_paq:[]},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},g={};n(g,{ecommerceAddToCart:()=>k,ecommerceCartUpdate:()=>h,ecommerceOrder:()=>y,ecommerceProductDetailView:()=>f});var v=require("@walkeros/core");function w(e){return{sku:e.data.id,name:e.data.name,price:e.data.price,quantity:1,variant:e.data.color,customDimensions:{1:e.data.size}}}function y(){const e=(0,v.getEvent)("order complete");return[["ecommerceOrder",e.nested.filter(e=>"product"===e.entity).map(w),{orderId:e.data.id,grandTotal:e.data.total,tax:e.data.taxes,shipping:e.data.shipping},{currencyCode:"EUR"}]]}function k(){return[["ecommerceAddToCart",[w((0,v.getEvent)("product add")),,],{currencyCode:"EUR"}]]}function f(){return[["ecommerceProductDetailView",[w((0,v.getEvent)("product view")),,],{currencyCode:"EUR"}]]}function h(){const e=(0,v.getEvent)("cart view");return[["ecommerceCartUpdate",e.nested.filter(e=>"product"===e.entity).map(w),e.data.value,{currencyCode:"EUR"}]]}var b={};n(b,{config:()=>U,ecommerceAddToCart:()=>q,ecommerceCartUpdate:()=>X,ecommerceOrder:()=>P,ecommerceProductDetailView:()=>O});var C=require("@walkeros/core"),E={sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1},variant:{key:"data.color"},customDimensions:{map:{1:"data.size"}}},P={name:"ecommerceOrder",data:{set:[{loop:["nested",{condition:e=>(0,C.isObject)(e)&&"product"===e.entity,map:E}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}},{map:{currencyCode:{value:"EUR"}}}]}},q={name:"ecommerceAddToCart",data:{set:[{set:[{map:E}]},{map:{currencyCode:{value:"EUR"}}}]}},O={name:"ecommerceProductDetailView",data:{set:[{set:[{map:E}]},{map:{currencyCode:{value:"EUR"}}}]}},X={name:"ecommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>(0,C.isObject)(e)&&"product"===e.entity,map:E}]},"data.value",{map:{currencyCode:{value:"EUR"}}}]}},U={order:{complete:P},product:{add:q,view:O},cart:{view:X}},T={};n(T,{MappingSchema:()=>I,SettingsSchema:()=>D,mapping:()=>_,settings:()=>V});var j=require("@walkeros/core"),z=require("@walkeros/core"),D=z.z.object({appId:z.z.string().min(1).describe("ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)"),url:z.z.string().url().describe("URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)"),linkTracking:z.z.boolean().default(!1).describe("Enables/Disables download and outlink tracking")}),R=require("@walkeros/core"),I=R.z.object({goalId:R.z.string().describe("ID to count the event as a goal (like 1)"),goalValue:R.z.string().describe("Property to be used as the goal value (like data.value)").optional()}),V=(0,j.zodToSchema)(D),_=(0,j.zodToSchema)(I),x={type:"piwikpro",config:{},init({config:e,env:t}){const{window:a}=(0,d.getEnv)(t),r=a,{settings:o,loadScript:n}=e,{appId:i,url:c}=o||{};if(!i||!c)return!1;r._paq=r._paq||[];const p=r._paq.push;n&&(!function(e,t){const{document:a}=(0,d.getEnv)(t),r=a,o=r.createElement("script");o.type="text/javascript",o.src=e+"ppms.js",o.async=!0,o.defer=!0,r.head.appendChild(o)}(c,t),p(["setTrackerUrl",c+"ppms.php"]),p(["setSiteId",i])),!1!==(null==o?void 0:o.linkTracking)&&p(["enableLinkTracking"])},async push(e,{config:t,mapping:a={},data:r,env:o}){const{window:n}=(0,d.getEnv)(o),i=n._paq.push;if("page view"===e.name&&!a.settings)return void i(["trackPageView",await(0,c.getMappingValue)(e,"data.title")]);const p=a.settings||{},s=(0,c.isArray)(r)?r:[r];if(i([e.name,...s]),p.goalId){const t=p.goalValue?(0,c.getMappingValue)(e,p.goalValue):void 0;i(["trackGoal",p.goalId,t])}}};var S=x;//# sourceMappingURL=index.js.map
1
+ "use strict";var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i={};((e,a)=>{for(var n in a)t(e,n,{get:a[n],enumerable:!0})})(i,{DestinationPiwikPro:()=>s,default:()=>l,destinationPiwikPro:()=>c}),module.exports=(e=i,((e,i,o,p)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let s of n(i))r.call(e,s)||s===o||t(e,s,{get:()=>i[s],enumerable:!(p=a(i,s))||p.enumerable});return e})(t({},"__esModule",{value:!0}),e));var o=require("@walkeros/core"),p=require("@walkeros/web-core"),s={},c={type:"piwikpro",config:{},init({config:e,env:t}){const{window:a}=(0,p.getEnv)(t),n=a,{settings:r,loadScript:i}=e,{appId:o,url:s}=r||{};if(!o||!s)return!1;n._paq=n._paq||[];const c=n._paq.push;i&&(!function(e,t){const{document:a}=(0,p.getEnv)(t),n=a,r=n.createElement("script");r.type="text/javascript",r.src=e+"ppms.js",r.async=!0,r.defer=!0,n.head.appendChild(r)}(s,t),c(["setTrackerUrl",s+"ppms.php"]),c(["setSiteId",o])),!1!==(null==r?void 0:r.linkTracking)&&c(["enableLinkTracking"])},async push(e,{config:t,mapping:a={},data:n,env:r}){const{window:i}=(0,p.getEnv)(r),s=i._paq.push;if("page view"===e.name&&!a.settings)return void s(["trackPageView",await(0,o.getMappingValue)(e,"data.title")]);const c=a.settings||{},l=(0,o.isArray)(n)?n:[n];if(s([e.name,...l]),c.goalId){const t=c.goalValue?(0,o.getMappingValue)(e,c.goalValue):void 0;s(["trackGoal",c.goalId,t])}}};var l=c;//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/types/index.ts","../src/examples/index.ts","../src/examples/env.ts","../src/examples/events.ts","../src/examples/mapping.ts","../src/schemas/index.ts","../src/schemas/settings.ts","../src/schemas/mapping.ts"],"sourcesContent":["import type { Settings, Mapping, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getMappingValue, isArray } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiwikPro from './types';\n\n// Examples\nexport * as examples from './examples';\n\n// Schemas\nexport * as schemas from './schemas';\n\nexport const destinationPiwikPro: Destination = {\n type: 'piwikpro',\n\n config: {},\n\n init({ config, env }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const { settings, loadScript } = config;\n const { appId, url } = settings || {};\n\n // Required parameters\n if (!appId || !url) return false;\n\n // Set up the Piwik Pro interface _paq\n w._paq = w._paq || [];\n\n const paq = w._paq.push;\n if (loadScript) {\n // Load the JavaScript Tracking Client\n addScript(url, env);\n\n // Register the tracker url only with script loading\n paq(['setTrackerUrl', url + 'ppms.php']);\n\n // Register app id\n paq(['setSiteId', appId]);\n }\n\n // Enable download and outlink tracking if not disabled\n if (settings?.linkTracking !== false) paq(['enableLinkTracking']);\n },\n\n async push(event, { config, mapping = {}, data, env }) {\n const { window } = getEnv(env);\n const paq = (window as Window)._paq!.push;\n\n // Send pageviews if not disabled\n if (event.name === 'page view' && !mapping.settings) {\n paq(['trackPageView', await getMappingValue(event, 'data.title')]);\n return;\n }\n\n const eventMapping: Mapping = mapping.settings || {};\n\n const parameters = isArray(data) ? data : [data];\n\n paq([event.name, ...parameters]);\n\n if (eventMapping.goalId) {\n const goalValue = eventMapping.goalValue\n ? getMappingValue(event, eventMapping.goalValue)\n : undefined;\n\n paq([\n 'trackGoal',\n eventMapping.goalId,\n goalValue,\n // @TODO dimensions\n ]);\n }\n },\n};\n\nfunction addScript(url: string, env?: DestinationWeb.Env) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.type = 'text/javascript';\n script.src = url + 'ppms.js';\n script.async = true;\n script.defer = true;\n doc.head.appendChild(script);\n}\n\nexport default destinationPiwikPro;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _paq?: Array<unknown>;\n }\n}\n\nexport interface Settings {\n appId: string;\n linkTracking?: boolean;\n url: string;\n}\n\nexport interface Mapping {\n goalId?: string;\n goalValue?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n _paq: Array<unknown>;\n };\n document: {\n createElement: (tagName: string) => {\n type: string;\n src: string;\n async?: boolean;\n defer?: boolean;\n };\n head: {\n appendChild: (node: unknown) => void;\n };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface Dimensions {\n [i: number]: string;\n}\n","export * as env from './env';\nexport * as events from './events';\nexport * as mapping from './mapping';\n","import type { Env } from '../types';\n\n/**\n * Example environment configurations for PiwikPro destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring external dependencies.\n */\n\nexport const init: Env | undefined = {\n window: {\n _paq: undefined as unknown as Env['window']['_paq'],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n\nexport const push: Env = {\n window: {\n _paq: [] as unknown[],\n },\n document: {\n createElement: () => ({\n type: '',\n src: '',\n async: false,\n defer: false,\n }),\n head: { appendChild: () => {} },\n },\n};\n","import type { WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\nfunction getProduct(entity: WalkerOS.Entity | WalkerOS.Event) {\n return {\n sku: entity.data.id,\n name: entity.data.name,\n price: entity.data.price,\n quantity: 1,\n variant: entity.data.color,\n customDimensions: {\n 1: entity.data.size,\n },\n };\n}\n\nexport function ecommerceOrder(): unknown[] {\n const event = getEvent('order complete');\n\n return [\n [\n 'ecommerceOrder',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n {\n orderId: event.data.id,\n grandTotal: event.data.total,\n tax: event.data.taxes,\n shipping: event.data.shipping,\n },\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceAddToCart(): unknown[] {\n const event = getEvent('product add');\n\n return [\n ['ecommerceAddToCart', [getProduct(event), ,], { currencyCode: 'EUR' }],\n ];\n}\n\nexport function ecommerceProductDetailView(): unknown[] {\n const event = getEvent('product view');\n\n return [\n [\n 'ecommerceProductDetailView',\n [getProduct(event), ,],\n { currencyCode: 'EUR' },\n ],\n ];\n}\n\nexport function ecommerceCartUpdate(): unknown[] {\n const event = getEvent('cart view');\n\n return [\n [\n 'ecommerceCartUpdate',\n event.nested.filter((item) => item.entity === 'product').map(getProduct),\n event.data.value,\n { currencyCode: 'EUR' },\n ],\n ];\n}\n","import type { DestinationPiwikPro } from '..';\nimport { isObject } from '@walkeros/core';\n\nconst productMap = {\n sku: 'data.id',\n name: 'data.name',\n price: 'data.price',\n quantity: { value: 1 },\n variant: { key: 'data.color' },\n customDimensions: {\n map: {\n 1: 'data.size',\n },\n },\n};\n\nexport const ecommerceOrder: DestinationPiwikPro.Rule = {\n name: 'ecommerceOrder',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n {\n map: {\n orderId: 'data.id',\n grandTotal: 'data.total',\n tax: 'data.taxes',\n shipping: 'data.shipping',\n },\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceAddToCart: DestinationPiwikPro.Rule = {\n name: 'ecommerceAddToCart',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceProductDetailView: DestinationPiwikPro.Rule = {\n name: 'ecommerceProductDetailView',\n data: {\n set: [\n {\n set: [\n {\n map: productMap,\n },\n ],\n },\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const ecommerceCartUpdate: DestinationPiwikPro.Rule = {\n name: 'ecommerceCartUpdate',\n data: {\n set: [\n {\n loop: [\n 'nested',\n {\n condition: (entity) =>\n isObject(entity) && entity.entity === 'product',\n map: productMap,\n },\n ],\n },\n 'data.value',\n {\n map: {\n currencyCode: { value: 'EUR' },\n },\n },\n ],\n },\n};\n\nexport const config = {\n order: { complete: ecommerceOrder },\n product: { add: ecommerceAddToCart, view: ecommerceProductDetailView },\n cart: { view: ecommerceCartUpdate },\n} satisfies DestinationPiwikPro.Rules;\n","import { zodToSchema } from '@walkeros/core';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core';\n\nexport const SettingsSchema = z.object({\n appId: z\n .string()\n .min(1)\n .describe('ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)'),\n url: z\n .string()\n .url()\n .describe(\n 'URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)',\n ),\n linkTracking: z\n .boolean()\n .default(false)\n .describe('Enables/Disables download and outlink tracking'),\n});\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core';\n\nexport const MappingSchema = z.object({\n goalId: z.string().describe('ID to count the event as a goal (like 1)'),\n goalValue: z\n .string()\n .describe('Property to be used as the goal value (like data.value)')\n .optional(),\n});\n\nexport type Mapping = z.infer<typeof MappingSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,IAAAA,eAAyC;AACzC,sBAAuB;;;ACHvB;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,OAAwB;AAAA,EACnC,QAAQ;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,MAAM;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,MAAM,EAAE,aAAa,MAAM;AAAA,IAAC,EAAE;AAAA,EAChC;AACF;AAEO,IAAM,OAAY;AAAA,EACvB,QAAQ;AAAA,IACN,MAAM,CAAC;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,eAAe,OAAO;AAAA,MACpB,MAAM;AAAA,MACN,KAAK;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA,MAAM,EAAE,aAAa,MAAM;AAAA,IAAC,EAAE;AAAA,EAChC;AACF;;;ACrCA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyB;AAEzB,SAAS,WAAW,QAA0C;AAC5D,SAAO;AAAA,IACL,KAAK,OAAO,KAAK;AAAA,IACjB,MAAM,OAAO,KAAK;AAAA,IAClB,OAAO,OAAO,KAAK;AAAA,IACnB,UAAU;AAAA,IACV,SAAS,OAAO,KAAK;AAAA,IACrB,kBAAkB;AAAA,MAChB,GAAG,OAAO,KAAK;AAAA,IACjB;AAAA,EACF;AACF;AAEO,SAAS,iBAA4B;AAC1C,QAAM,YAAQ,sBAAS,gBAAgB;AAEvC,SAAO;AAAA,IACL;AAAA,MACE;AAAA,MACA,MAAM,OAAO,OAAO,CAAC,SAAS,KAAK,WAAW,SAAS,EAAE,IAAI,UAAU;AAAA,MACvE;AAAA,QACE,SAAS,MAAM,KAAK;AAAA,QACpB,YAAY,MAAM,KAAK;AAAA,QACvB,KAAK,MAAM,KAAK;AAAA,QAChB,UAAU,MAAM,KAAK;AAAA,MACvB;AAAA,MACA,EAAE,cAAc,MAAM;AAAA,IACxB;AAAA,EACF;AACF;AAEO,SAAS,qBAAgC;AAC9C,QAAM,YAAQ,sBAAS,aAAa;AAEpC,SAAO;AAAA,IACL,CAAC,sBAAsB,CAAC,WAAW,KAAK,GAAG,CAAC,GAAG,EAAE,cAAc,MAAM,CAAC;AAAA,EACxE;AACF;AAEO,SAAS,6BAAwC;AACtD,QAAM,YAAQ,sBAAS,cAAc;AAErC,SAAO;AAAA,IACL;AAAA,MACE;AAAA,MACA,CAAC,WAAW,KAAK,GAAG,CAAC;AAAA,MACrB,EAAE,cAAc,MAAM;AAAA,IACxB;AAAA,EACF;AACF;AAEO,SAAS,sBAAiC;AAC/C,QAAM,YAAQ,sBAAS,WAAW;AAElC,SAAO;AAAA,IACL;AAAA,MACE;AAAA,MACA,MAAM,OAAO,OAAO,CAAC,SAAS,KAAK,WAAW,SAAS,EAAE,IAAI,UAAU;AAAA,MACvE,MAAM,KAAK;AAAA,MACX,EAAE,cAAc,MAAM;AAAA,IACxB;AAAA,EACF;AACF;;;ACjEA;AAAA;AAAA;AAAA,4BAAAC;AAAA,EAAA,2BAAAC;AAAA,EAAA,sBAAAC;AAAA,EAAA,kCAAAC;AAAA;AACA,IAAAC,eAAyB;AAEzB,IAAM,aAAa;AAAA,EACjB,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU,EAAE,OAAO,EAAE;AAAA,EACrB,SAAS,EAAE,KAAK,aAAa;AAAA,EAC7B,kBAAkB;AAAA,IAChB,KAAK;AAAA,MACH,GAAG;AAAA,IACL;AAAA,EACF;AACF;AAEO,IAAMF,kBAA2C;AAAA,EACtD,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,YACE,WAAW,CAAC,eACV,uBAAS,MAAM,KAAK,OAAO,WAAW;AAAA,YACxC,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,KAAK;AAAA,UACL,UAAU;AAAA,QACZ;AAAA,MACF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAMF,sBAA+C;AAAA,EAC1D,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,KAAK;AAAA,UACH;AAAA,YACE,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAMG,8BAAuD;AAAA,EAClE,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,KAAK;AAAA,UACH;AAAA,YACE,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAMF,uBAAgD;AAAA,EAC3D,MAAM;AAAA,EACN,MAAM;AAAA,IACJ,KAAK;AAAA,MACH;AAAA,QACE,MAAM;AAAA,UACJ;AAAA,UACA;AAAA,YACE,WAAW,CAAC,eACV,uBAAS,MAAM,KAAK,OAAO,WAAW;AAAA,YACxC,KAAK;AAAA,UACP;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,QACE,KAAK;AAAA,UACH,cAAc,EAAE,OAAO,MAAM;AAAA,QAC/B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEO,IAAM,SAAS;AAAA,EACpB,OAAO,EAAE,UAAUC,gBAAe;AAAA,EAClC,SAAS,EAAE,KAAKF,qBAAoB,MAAMG,4BAA2B;AAAA,EACrE,MAAM,EAAE,MAAMF,qBAAoB;AACpC;;;ACnHA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAI,eAA4B;;;ACA5B,IAAAC,eAAkB;AAEX,IAAM,iBAAiB,eAAE,OAAO;AAAA,EACrC,OAAO,eACJ,OAAO,EACP,IAAI,CAAC,EACL,SAAS,qDAAqD;AAAA,EACjE,KAAK,eACF,OAAO,EACP,IAAI,EACJ;AAAA,IACC;AAAA,EACF;AAAA,EACF,cAAc,eACX,QAAQ,EACR,QAAQ,KAAK,EACb,SAAS,gDAAgD;AAC9D,CAAC;;;ACjBD,IAAAC,eAAkB;AAEX,IAAM,gBAAgB,eAAE,OAAO;AAAA,EACpC,QAAQ,eAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EACtE,WAAW,eACR,OAAO,EACP,SAAS,yDAAyD,EAClE,SAAS;AACd,CAAC;;;AFAM,IAAM,eAAW,0BAAY,cAAc;AAC3C,IAAM,cAAU,0BAAY,aAAa;;;ANKzC,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAAC,SAAQ,IAAI,GAAG;AACpB,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,EAAE,UAAAC,WAAU,WAAW,IAAID;AACjC,UAAM,EAAE,OAAO,IAAI,IAAIC,aAAY,CAAC;AAGpC,QAAI,CAAC,SAAS,CAAC,IAAK,QAAO;AAG3B,MAAE,OAAO,EAAE,QAAQ,CAAC;AAEpB,UAAM,MAAM,EAAE,KAAK;AACnB,QAAI,YAAY;AAEd,gBAAU,KAAK,GAAG;AAGlB,UAAI,CAAC,iBAAiB,MAAM,UAAU,CAAC;AAGvC,UAAI,CAAC,aAAa,KAAK,CAAC;AAAA,IAC1B;AAGA,SAAIA,aAAA,gBAAAA,UAAU,kBAAiB,MAAO,KAAI,CAAC,oBAAoB,CAAC;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAAD,SAAQ,SAAAE,WAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AACrD,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,MAAO,OAAkB,KAAM;AAGrC,QAAI,MAAM,SAAS,eAAe,CAACA,SAAQ,UAAU;AACnD,UAAI,CAAC,iBAAiB,UAAM,8BAAgB,OAAO,YAAY,CAAC,CAAC;AACjE;AAAA,IACF;AAEA,UAAM,eAAwBA,SAAQ,YAAY,CAAC;AAEnD,UAAM,iBAAa,sBAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;AAE/C,QAAI,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAE/B,QAAI,aAAa,QAAQ;AACvB,YAAM,YAAY,aAAa,gBAC3B,8BAAgB,OAAO,aAAa,SAAS,IAC7C;AAEJ,UAAI;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb;AAAA;AAAA,MAEF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,SAAS,UAAU,KAAa,KAA0B;AACxD,QAAM,EAAE,SAAS,QAAI,wBAAO,GAAG;AAC/B,QAAM,MAAM;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,OAAO;AACd,SAAO,MAAM,MAAM;AACnB,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":["import_core","ecommerceAddToCart","ecommerceCartUpdate","ecommerceOrder","ecommerceProductDetailView","import_core","import_core","import_core","import_core","config","settings","mapping"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/types/index.ts"],"sourcesContent":["import type { Settings, Mapping, Destination } from './types';\nimport type { DestinationWeb } from '@walkeros/web-core';\nimport { getMappingValue, isArray } from '@walkeros/core';\nimport { getEnv } from '@walkeros/web-core';\n\n// Types\nexport * as DestinationPiwikPro from './types';\n\nexport const destinationPiwikPro: Destination = {\n type: 'piwikpro',\n\n config: {},\n\n init({ config, env }) {\n const { window } = getEnv(env);\n const w = window as Window;\n const { settings, loadScript } = config;\n const { appId, url } = settings || {};\n\n // Required parameters\n if (!appId || !url) return false;\n\n // Set up the Piwik Pro interface _paq\n w._paq = w._paq || [];\n\n const paq = w._paq.push;\n if (loadScript) {\n // Load the JavaScript Tracking Client\n addScript(url, env);\n\n // Register the tracker url only with script loading\n paq(['setTrackerUrl', url + 'ppms.php']);\n\n // Register app id\n paq(['setSiteId', appId]);\n }\n\n // Enable download and outlink tracking if not disabled\n if (settings?.linkTracking !== false) paq(['enableLinkTracking']);\n },\n\n async push(event, { config, mapping = {}, data, env }) {\n const { window } = getEnv(env);\n const paq = (window as Window)._paq!.push;\n\n // Send pageviews if not disabled\n if (event.name === 'page view' && !mapping.settings) {\n paq(['trackPageView', await getMappingValue(event, 'data.title')]);\n return;\n }\n\n const eventMapping: Mapping = mapping.settings || {};\n\n const parameters = isArray(data) ? data : [data];\n\n paq([event.name, ...parameters]);\n\n if (eventMapping.goalId) {\n const goalValue = eventMapping.goalValue\n ? getMappingValue(event, eventMapping.goalValue)\n : undefined;\n\n paq([\n 'trackGoal',\n eventMapping.goalId,\n goalValue,\n // @TODO dimensions\n ]);\n }\n },\n};\n\nfunction addScript(url: string, env?: DestinationWeb.Env) {\n const { document } = getEnv(env);\n const doc = document as Document;\n const script = doc.createElement('script');\n script.type = 'text/javascript';\n script.src = url + 'ppms.js';\n script.async = true;\n script.defer = true;\n doc.head.appendChild(script);\n}\n\nexport default destinationPiwikPro;\n","import type {\n Mapping as WalkerOSMapping,\n Destination as CoreDestination,\n} from '@walkeros/core';\nimport type { DestinationWeb } from '@walkeros/web-core';\n\ndeclare global {\n interface Window {\n _paq?: Array<unknown>;\n }\n}\n\nexport interface Settings {\n appId: string;\n linkTracking?: boolean;\n url: string;\n}\n\nexport interface Mapping {\n goalId?: string;\n goalValue?: string;\n}\n\nexport interface Env extends DestinationWeb.Env {\n window: {\n _paq: Array<unknown>;\n };\n document: {\n createElement: (tagName: string) => {\n type: string;\n src: string;\n async?: boolean;\n defer?: boolean;\n };\n head: {\n appendChild: (node: unknown) => void;\n };\n };\n}\n\nexport type Types = CoreDestination.Types<Settings, Mapping, Env>;\n\nexport type Destination = DestinationWeb.Destination<Types>;\nexport type Config = DestinationWeb.Config<Types>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface Dimensions {\n [i: number]: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAyC;AACzC,sBAAuB;;;ACHvB;;;ADQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,KAAK,EAAE,QAAQ,IAAI,GAAG;AACpB,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,IAAI;AACV,UAAM,EAAE,UAAU,WAAW,IAAI;AACjC,UAAM,EAAE,OAAO,IAAI,IAAI,YAAY,CAAC;AAGpC,QAAI,CAAC,SAAS,CAAC,IAAK,QAAO;AAG3B,MAAE,OAAO,EAAE,QAAQ,CAAC;AAEpB,UAAM,MAAM,EAAE,KAAK;AACnB,QAAI,YAAY;AAEd,gBAAU,KAAK,GAAG;AAGlB,UAAI,CAAC,iBAAiB,MAAM,UAAU,CAAC;AAGvC,UAAI,CAAC,aAAa,KAAK,CAAC;AAAA,IAC1B;AAGA,SAAI,qCAAU,kBAAiB,MAAO,KAAI,CAAC,oBAAoB,CAAC;AAAA,EAClE;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,UAAU,CAAC,GAAG,MAAM,IAAI,GAAG;AACrD,UAAM,EAAE,OAAO,QAAI,wBAAO,GAAG;AAC7B,UAAM,MAAO,OAAkB,KAAM;AAGrC,QAAI,MAAM,SAAS,eAAe,CAAC,QAAQ,UAAU;AACnD,UAAI,CAAC,iBAAiB,UAAM,6BAAgB,OAAO,YAAY,CAAC,CAAC;AACjE;AAAA,IACF;AAEA,UAAM,eAAwB,QAAQ,YAAY,CAAC;AAEnD,UAAM,iBAAa,qBAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;AAE/C,QAAI,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC;AAE/B,QAAI,aAAa,QAAQ;AACvB,YAAM,YAAY,aAAa,gBAC3B,6BAAgB,OAAO,aAAa,SAAS,IAC7C;AAEJ,UAAI;AAAA,QACF;AAAA,QACA,aAAa;AAAA,QACb;AAAA;AAAA,MAEF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEA,SAAS,UAAU,KAAa,KAA0B;AACxD,QAAM,EAAE,SAAS,QAAI,wBAAO,GAAG;AAC/B,QAAM,MAAM;AACZ,QAAM,SAAS,IAAI,cAAc,QAAQ;AACzC,SAAO,OAAO;AACd,SAAO,MAAM,MAAM;AACnB,SAAO,QAAQ;AACf,SAAO,QAAQ;AACf,MAAI,KAAK,YAAY,MAAM;AAC7B;AAEA,IAAO,gBAAQ;","names":[]}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e=Object.defineProperty,a=(a,t)=>{for(var r in t)e(a,r,{get:t[r],enumerable:!0})};import{getMappingValue as t,isArray as r}from"@walkeros/core";import{getEnv as o}from"@walkeros/web-core";var i={},c={};a(c,{env:()=>n,events:()=>s,mapping:()=>f});var n={};a(n,{init:()=>d,push:()=>p});var d={window:{_paq:void 0},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},p={window:{_paq:[]},document:{createElement:()=>({type:"",src:"",async:!1,defer:!1}),head:{appendChild:()=>{}}}},s={};a(s,{ecommerceAddToCart:()=>g,ecommerceCartUpdate:()=>w,ecommerceOrder:()=>u,ecommerceProductDetailView:()=>v});import{getEvent as m}from"@walkeros/core";function l(e){return{sku:e.data.id,name:e.data.name,price:e.data.price,quantity:1,variant:e.data.color,customDimensions:{1:e.data.size}}}function u(){const e=m("order complete");return[["ecommerceOrder",e.nested.filter(e=>"product"===e.entity).map(l),{orderId:e.data.id,grandTotal:e.data.total,tax:e.data.taxes,shipping:e.data.shipping},{currencyCode:"EUR"}]]}function g(){return[["ecommerceAddToCart",[l(m("product add")),,],{currencyCode:"EUR"}]]}function v(){return[["ecommerceProductDetailView",[l(m("product view")),,],{currencyCode:"EUR"}]]}function w(){const e=m("cart view");return[["ecommerceCartUpdate",e.nested.filter(e=>"product"===e.entity).map(l),e.data.value,{currencyCode:"EUR"}]]}var f={};a(f,{config:()=>U,ecommerceAddToCart:()=>C,ecommerceCartUpdate:()=>X,ecommerceOrder:()=>h,ecommerceProductDetailView:()=>b});import{isObject as k}from"@walkeros/core";var y={sku:"data.id",name:"data.name",price:"data.price",quantity:{value:1},variant:{key:"data.color"},customDimensions:{map:{1:"data.size"}}},h={name:"ecommerceOrder",data:{set:[{loop:["nested",{condition:e=>k(e)&&"product"===e.entity,map:y}]},{map:{orderId:"data.id",grandTotal:"data.total",tax:"data.taxes",shipping:"data.shipping"}},{map:{currencyCode:{value:"EUR"}}}]}},C={name:"ecommerceAddToCart",data:{set:[{set:[{map:y}]},{map:{currencyCode:{value:"EUR"}}}]}},b={name:"ecommerceProductDetailView",data:{set:[{set:[{map:y}]},{map:{currencyCode:{value:"EUR"}}}]}},X={name:"ecommerceCartUpdate",data:{set:[{loop:["nested",{condition:e=>k(e)&&"product"===e.entity,map:y}]},"data.value",{map:{currencyCode:{value:"EUR"}}}]}},U={order:{complete:h},product:{add:C,view:b},cart:{view:X}},P={};a(P,{MappingSchema:()=>T,SettingsSchema:()=>D,mapping:()=>V,settings:()=>q});import{zodToSchema as E}from"@walkeros/core";import{z as R}from"@walkeros/core";var D=R.object({appId:R.string().min(1).describe("ID of the Piwik PRO site (like XXX-XXX-XXX-XXX-XXX)"),url:R.string().url().describe("URL of your Piwik PRO account (like https://your_account_name.piwik.pro/)"),linkTracking:R.boolean().default(!1).describe("Enables/Disables download and outlink tracking")});import{z as I}from"@walkeros/core";var T=I.object({goalId:I.string().describe("ID to count the event as a goal (like 1)"),goalValue:I.string().describe("Property to be used as the goal value (like data.value)").optional()}),q=E(D),V=E(T),_={type:"piwikpro",config:{},init({config:e,env:a}){const{window:t}=o(a),r=t,{settings:i,loadScript:c}=e,{appId:n,url:d}=i||{};if(!n||!d)return!1;r._paq=r._paq||[];const p=r._paq.push;c&&(!function(e,a){const{document:t}=o(a),r=t,i=r.createElement("script");i.type="text/javascript",i.src=e+"ppms.js",i.async=!0,i.defer=!0,r.head.appendChild(i)}(d,a),p(["setTrackerUrl",d+"ppms.php"]),p(["setSiteId",n])),!1!==(null==i?void 0:i.linkTracking)&&p(["enableLinkTracking"])},async push(e,{config:a,mapping:i={},data:c,env:n}){const{window:d}=o(n),p=d._paq.push;if("page view"===e.name&&!i.settings)return void p(["trackPageView",await t(e,"data.title")]);const s=i.settings||{},m=r(c)?c:[c];if(p([e.name,...m]),s.goalId){const a=s.goalValue?t(e,s.goalValue):void 0;p(["trackGoal",s.goalId,a])}}};var x=_;export{i as DestinationPiwikPro,x as default,_ as destinationPiwikPro,c as examples,P as schemas};//# sourceMappingURL=index.mjs.map
1
+ import{getMappingValue as a,isArray as e}from"@walkeros/core";import{getEnv as t}from"@walkeros/web-core";var i={},n={type:"piwikpro",config:{},init({config:a,env:e}){const{window:i}=t(e),n=i,{settings:o,loadScript:r}=a,{appId:p,url:s}=o||{};if(!p||!s)return!1;n._paq=n._paq||[];const c=n._paq.push;r&&(!function(a,e){const{document:i}=t(e),n=i,o=n.createElement("script");o.type="text/javascript",o.src=a+"ppms.js",o.async=!0,o.defer=!0,n.head.appendChild(o)}(s,e),c(["setTrackerUrl",s+"ppms.php"]),c(["setSiteId",p])),!1!==(null==o?void 0:o.linkTracking)&&c(["enableLinkTracking"])},async push(i,{config:n,mapping:o={},data:r,env:p}){const{window:s}=t(p),c=s._paq.push;if("page view"===i.name&&!o.settings)return void c(["trackPageView",await a(i,"data.title")]);const l=o.settings||{},d=e(r)?r:[r];if(c([i.name,...d]),l.goalId){const e=l.goalValue?a(i,l.goalValue):void 0;c(["trackGoal",l.goalId,e])}}};var o=n;export{i as DestinationPiwikPro,o as default,n as destinationPiwikPro};//# sourceMappingURL=index.mjs.map