@@ -6022,7 +6022,7 @@ class ZodType {
60226022}
60236023const cuidRegex = /^c[^\s-]{8,}$/i;
60246024const cuid2Regex = /^[a-z][a-z0-9]*$/;
6025- const ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
6025+ const ulidRegex = /^ [0-9A-HJKMNP-TV-Z]{26}$ /;
60266026// const uuidRegex =
60276027// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
60286028const uuidRegex = /^[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;
@@ -6042,7 +6042,8 @@ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-
60426042// const emailRegex =
60436043// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
60446044// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
6045- const emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
6045+ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
6046+ let emojiRegex;
60466047const ipv4Regex = /^(((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}))$/;
60476048const ipv6Regex = /^(([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})))$/;
60486049// Adapted from https://stackoverflow.com/a/3143231
@@ -6082,31 +6083,6 @@ function isValidIP(ip, version) {
60826083 return false;
60836084}
60846085class ZodString extends ZodType {
6085- constructor() {
6086- super(...arguments);
6087- this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
6088- validation,
6089- code: ZodIssueCode.invalid_string,
6090- ...errorUtil.errToObj(message),
6091- });
6092- /**
6093- * @deprecated Use z.string().min(1) instead.
6094- * @see {@link ZodString.min}
6095- */
6096- this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
6097- this.trim = () => new ZodString({
6098- ...this._def,
6099- checks: [...this._def.checks, { kind: "trim" }],
6100- });
6101- this.toLowerCase = () => new ZodString({
6102- ...this._def,
6103- checks: [...this._def.checks, { kind: "toLowerCase" }],
6104- });
6105- this.toUpperCase = () => new ZodString({
6106- ...this._def,
6107- checks: [...this._def.checks, { kind: "toUpperCase" }],
6108- });
6109- }
61106086 _parse(input) {
61116087 if (this._def.coerce) {
61126088 input.data = String(input.data);
@@ -6194,6 +6170,9 @@ class ZodString extends ZodType {
61946170 }
61956171 }
61966172 else if (check.kind === "emoji") {
6173+ if (!emojiRegex) {
6174+ emojiRegex = new RegExp(_emojiRegex, "u");
6175+ }
61976176 if (!emojiRegex.test(input.data)) {
61986177 ctx = this._getOrReturnCtx(input, ctx);
61996178 addIssueToContext(ctx, {
@@ -6346,6 +6325,13 @@ class ZodString extends ZodType {
63466325 }
63476326 return { status: status.value, value: input.data };
63486327 }
6328+ _regex(regex, validation, message) {
6329+ return this.refinement((data) => regex.test(data), {
6330+ validation,
6331+ code: ZodIssueCode.invalid_string,
6332+ ...errorUtil.errToObj(message),
6333+ });
6334+ }
63496335 _addCheck(check) {
63506336 return new ZodString({
63516337 ...this._def,
@@ -6443,6 +6429,31 @@ class ZodString extends ZodType {
64436429 ...errorUtil.errToObj(message),
64446430 });
64456431 }
6432+ /**
6433+ * @deprecated Use z.string().min(1) instead.
6434+ * @see {@link ZodString.min}
6435+ */
6436+ nonempty(message) {
6437+ return this.min(1, errorUtil.errToObj(message));
6438+ }
6439+ trim() {
6440+ return new ZodString({
6441+ ...this._def,
6442+ checks: [...this._def.checks, { kind: "trim" }],
6443+ });
6444+ }
6445+ toLowerCase() {
6446+ return new ZodString({
6447+ ...this._def,
6448+ checks: [...this._def.checks, { kind: "toLowerCase" }],
6449+ });
6450+ }
6451+ toUpperCase() {
6452+ return new ZodString({
6453+ ...this._def,
6454+ checks: [...this._def.checks, { kind: "toUpperCase" }],
6455+ });
6456+ }
64466457 get isDatetime() {
64476458 return !!this._def.checks.find((ch) => ch.kind === "datetime");
64486459 }
@@ -8976,7 +8987,7 @@ ZodReadonly.create = (type, params) => {
89768987 });
89778988};
89788989const custom = (check, params = {},
8979- /*
8990+ /**
89808991 * @deprecated
89818992 *
89828993 * Pass `fatal` into the params object instead:
@@ -27883,7 +27894,7 @@ function get_each_context$6(ctx, list, i) {
2788327894 return child_ctx;
2788427895}
2788527896
27886- // (71 :2) {#if form?.icon && componentStyle !== 'inline'}
27897+ // (70 :2) {#if form?.icon && componentStyle !== 'inline'}
2788727898function create_if_block_4$3(ctx) {
2788827899 let div;
2788927900 let shieldicon;
@@ -27923,7 +27934,7 @@ function create_if_block_4$3(ctx) {
2792327934 };
2792427935}
2792527936
27926- // (87 :2) {#if form?.message}
27937+ // (86 :2) {#if form?.message}
2792727938function create_if_block_3$5(ctx) {
2792827939 let alert;
2792927940 let current;
@@ -27971,7 +27982,7 @@ function create_if_block_3$5(ctx) {
2797127982 };
2797227983}
2797327984
27974- // (88 :4) <Alert id={formFailureMessageId} needsFocus={alertNeedsFocus} type="error">
27985+ // (87 :4) <Alert id={formFailureMessageId} needsFocus={alertNeedsFocus} type="error">
2797527986function create_default_slot_4$1(ctx) {
2797627987 let t_value = interpolate(/*formMessageKey*/ ctx[7], null, /*form*/ ctx[2]?.message) + "";
2797727988 let t;
@@ -27992,7 +28003,7 @@ function create_default_slot_4$1(ctx) {
2799228003 };
2799328004}
2799428005
27995- // (93 :2) {#each step?.callbacks as callback, idx}
28006+ // (92 :2) {#each step?.callbacks as callback, idx}
2799628007function create_each_block$6(ctx) {
2799728008 let callbackmapper;
2799828009 let current;
@@ -28045,7 +28056,7 @@ function create_each_block$6(ctx) {
2804528056 };
2804628057}
2804728058
28048- // (118 :61)
28059+ // (117 :61)
2804928060function create_if_block_2$6(ctx) {
2805028061 let button;
2805128062 let current;
@@ -28094,7 +28105,7 @@ function create_if_block_2$6(ctx) {
2809428105 };
2809528106}
2809628107
28097- // (114 :56)
28108+ // (113 :56)
2809828109function create_if_block_1$7(ctx) {
2809928110 let button;
2810028111 let current;
@@ -28143,7 +28154,7 @@ function create_if_block_1$7(ctx) {
2814328154 };
2814428155}
2814528156
28146- // (110 :2) {#if !metadata?.step?.derived.isStepSelfSubmittable()}
28157+ // (109 :2) {#if !metadata?.step?.derived.isStepSelfSubmittable()}
2814728158function create_if_block$9(ctx) {
2814828159 let button;
2814928160 let current;
@@ -28192,7 +28203,7 @@ function create_if_block$9(ctx) {
2819228203 };
2819328204}
2819428205
28195- // (119 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
28206+ // (118 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
2819628207function create_default_slot_3$2(ctx) {
2819728208 let t;
2819828209 let current;
@@ -28222,7 +28233,7 @@ function create_default_slot_3$2(ctx) {
2822228233 };
2822328234}
2822428235
28225- // (115 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
28236+ // (114 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
2822628237function create_default_slot_2$4(ctx) {
2822728238 let t;
2822828239 let current;
@@ -28252,7 +28263,7 @@ function create_default_slot_2$4(ctx) {
2825228263 };
2825328264}
2825428265
28255- // (111 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
28266+ // (110 :4) <Button busy={journey?.loading} style="primary" type="submit" width="full">
2825628267function create_default_slot_1$8(ctx) {
2825728268 let t;
2825828269 let current;
@@ -28282,7 +28293,7 @@ function create_default_slot_1$8(ctx) {
2828228293 };
2828328294}
2828428295
28285- // (64 :0) <Form bind:formEl ariaDescribedBy={formAriaDescriptor} id={formElementId} needsFocus={formNeedsFocus} onSubmitWhenValid={submitFormWrapper} >
28296+ // (63 :0) <Form bind:formEl ariaDescribedBy={formAriaDescriptor} id={formElementId} needsFocus={formNeedsFocus} onSubmitWhenValid={submitFormWrapper} >
2828628297function create_default_slot$9(ctx) {
2828728298 let t0;
2828828299 let header;
@@ -28708,11 +28719,10 @@ function instance$g($$self, $$props, $$invalidate) {
2870828719 };
2870928720
2871028721 $$self.$$.update = () => {
28711- if ($$self.$$.dirty & /*step, form, metadata */ 52 ) {
28722+ if ($$self.$$.dirty & /*step, form*/ 36 ) {
2871228723 {
2871328724 shouldRedirectFromStep(step) && FRAuth.redirect(step);
2871428725 $$invalidate(7, formMessageKey = convertStringToKey(form?.message));
28715- console.log(metadata?.step.derived.isStepSelfSubmittable());
2871628726 }
2871728727 }
2871828728 };
0 commit comments