1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,792335,879319,e=>{"use strict";var t=e.i(683865),i=e.i(315),n=e.i(293062),r=e.i(675313),s=n;class a extends s.PgColumnBuilder{static [t.entityKind]="PgDateColumnBaseBuilder";defaultNow(){return this.default(r.sql`now()`)}}e.s(["PgDateColumnBaseBuilder",0,a],879319);class o extends a{static [t.entityKind]="PgDateBuilder";constructor(e){super(e,"date","PgDate")}build(e){return new l(e,this.config)}}class l extends n.PgColumn{static [t.entityKind]="PgDate";getSQLType(){return"date"}mapFromDriverValue(e){return new Date(e)}mapToDriverValue(e){return e.toISOString()}}class u extends a{static [t.entityKind]="PgDateStringBuilder";constructor(e){super(e,"string","PgDateString")}build(e){return new c(e,this.config)}}class c extends n.PgColumn{static [t.entityKind]="PgDateString";getSQLType(){return"date"}}e.s(["PgDate",0,l,"PgDateString",0,c,"date",0,function(e,t){let{name:n,config:r}=(0,i.getColumnNameAndConfig)(e,t);return r?.mode==="date"?new o(n):new u(n)}],792335)},460012,814410,866933,872459,485989,677601,838485,702876,e=>{"use strict";var t=e.i(683865),i=e.i(293062);class n extends i.PgColumnBuilder{static [t.entityKind]="PgDoublePrecisionBuilder";constructor(e){super(e,"number","PgDoublePrecision")}build(e){return new r(e,this.config)}}class r extends i.PgColumn{static [t.entityKind]="PgDoublePrecision";getSQLType(){return"double precision"}mapFromDriverValue(e){return"string"==typeof e?Number.parseFloat(e):e}}e.s(["doublePrecision",0,function(e){return new n(e??"")}],460012);var s=i;class a extends s.PgColumnBuilder{static [t.entityKind]="PgInetBuilder";constructor(e){super(e,"string","PgInet")}build(e){return new o(e,this.config)}}class o extends s.PgColumn{static [t.entityKind]="PgInet";getSQLType(){return"inet"}}e.s(["inet",0,function(e){return new a(e??"")}],814410);var l=e.i(315),u=i;class c extends u.PgColumnBuilder{static [t.entityKind]="PgIntervalBuilder";constructor(e,t){super(e,"string","PgInterval"),this.config.intervalConfig=t}build(e){return new d(e,this.config)}}class d extends u.PgColumn{static [t.entityKind]="PgInterval";fields=this.config.intervalConfig.fields;precision=this.config.intervalConfig.precision;getSQLType(){let e=this.fields?` ${this.fields}`:"",t=this.precision?`(${this.precision})`:"";return`interval${e}${t}`}}e.s(["interval",0,function(e,t={}){let{name:i,config:n}=(0,l.getColumnNameAndConfig)(e,t);return new c(i,n)}],866933);var m=i;class g extends m.PgColumnBuilder{static [t.entityKind]="PgJsonBuilder";constructor(e){super(e,"json","PgJson")}build(e){return new p(e,this.config)}}class p extends m.PgColumn{static [t.entityKind]="PgJson";constructor(e,t){super(e,t)}getSQLType(){return"json"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}e.s(["PgJson",0,p,"json",0,function(e){return new g(e??"")}],872459);var h=i;class f extends h.PgColumnBuilder{static [t.entityKind]="PgLineBuilder";constructor(e){super(e,"array","PgLine")}build(e){return new y(e,this.config)}}class y extends h.PgColumn{static [t.entityKind]="PgLine";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,n]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i),Number.parseFloat(n)]}mapToDriverValue(e){return`{${e[0]},${e[1]},${e[2]}}`}}class b extends h.PgColumnBuilder{static [t.entityKind]="PgLineABCBuilder";constructor(e){super(e,"json","PgLineABC")}build(e){return new _(e,this.config)}}class _ extends h.PgColumn{static [t.entityKind]="PgLineABC";getSQLType(){return"line"}mapFromDriverValue(e){let[t,i,n]=e.slice(1,-1).split(",");return{a:Number.parseFloat(t),b:Number.parseFloat(i),c:Number.parseFloat(n)}}mapToDriverValue(e){return`{${e.a},${e.b},${e.c}}`}}e.s(["line",0,function(e,t){let{name:i,config:n}=(0,l.getColumnNameAndConfig)(e,t);return n?.mode&&"tuple"!==n.mode?new b(i):new f(i)}],485989);var N=i;class w extends N.PgColumnBuilder{static [t.entityKind]="PgMacaddrBuilder";constructor(e){super(e,"string","PgMacaddr")}build(e){return new S(e,this.config)}}class S extends N.PgColumn{static [t.entityKind]="PgMacaddr";
1getSQLType(){return"macaddr"}}e.s(["macaddr",0,function(e){return new w(e??"")}],677601);var x=i;class z extends x.PgColumnBuilder{static [t.entityKind]="PgMacaddr8Builder";constructor(e){super(e,"string","PgMacaddr8")}build(e){return new v(e,this.config)}}class v extends x.PgColumn{static [t.entityKind]="PgMacaddr8";getSQLType(){return"macaddr8"}}e.s(["macaddr8",0,function(e){return new z(e??"")}],838485);var C=i;class T extends C.PgColumnBuilder{static [t.entityKind]="PgPointTupleBuilder";constructor(e){super(e,"array","PgPointTuple")}build(e){return new P(e,this.config)}}class P extends C.PgColumn{static [t.entityKind]="PgPointTuple";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return[Number.parseFloat(t),Number.parseFloat(i)]}return[e.x,e.y]}mapToDriverValue(e){return`(${e[0]},${e[1]})`}}class q extends C.PgColumnBuilder{static [t.entityKind]="PgPointObjectBuilder";constructor(e){super(e,"json","PgPointObject")}build(e){return new I(e,this.config)}}class I extends C.PgColumn{static [t.entityKind]="PgPointObject";getSQLType(){return"point"}mapFromDriverValue(e){if("string"==typeof e){let[t,i]=e.slice(1,-1).split(",");return{x:Number.parseFloat(t),y:Number.parseFloat(i)}}return e}mapToDriverValue(e){return`(${e.x},${e.y})`}}e.s(["point",0,function(e,t){let{name:i,config:n}=(0,l.getColumnNameAndConfig)(e,t);return n?.mode&&"tuple"!==n.mode?new q(i):new T(i)}],702876)},422308,e=>{"use strict";var t=e.i(683865),i=e.i(315),n=e.i(293062);function r(e,t){let i=new DataView(new ArrayBuffer(8));for(let n=0;n<8;n++)i.setUint8(n,e[t+n]);return i.getFloat64(0,!0)}function s(e){let t=function(e){let t=[];for(let i=0;i<e.length;i+=2)t.push(Number.parseInt(e.slice(i,i+2),16));return new Uint8Array(t)}(e),i=0,n=t[0];i+=1;let s=new DataView(t.buffer),a=s.getUint32(i,1===n);if(i+=4,0x20000000&a&&(s.getUint32(i,1===n),i+=4),(65535&a)==1){let e=r(t,i),n=r(t,i+=8);return i+=8,[e,n]}throw Error("Unsupported geometry type")}class a extends n.PgColumnBuilder{static [t.entityKind]="PgGeometryBuilder";constructor(e){super(e,"array","PgGeometry")}build(e){return new o(e,this.config)}}class o extends n.PgColumn{static [t.entityKind]="PgGeometry";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){return s(e)}mapToDriverValue(e){return`point(${e[0]} ${e[1]})`}}class l extends n.PgColumnBuilder{static [t.entityKind]="PgGeometryObjectBuilder";constructor(e){super(e,"json","PgGeometryObject")}build(e){return new u(e,this.config)}}class u extends n.PgColumn{static [t.entityKind]="PgGeometryObject";getSQLType(){return"geometry(point)"}mapFromDriverValue(e){let t=s(e);return{x:t[0],y:t[1]}}mapToDriverValue(e){return`point(${e.x} ${e.y})`}}e.s(["geometry",0,function(e,t){let{name:n,config:r}=(0,i.getColumnNameAndConfig)(e,t);return r?.mode&&"tuple"!==r.mode?new l(n):new a(n)}],422308)},849304,486376,723007,396695,519442,623303,963307,908931,593365,138855,199548,e=>{"use strict";var t=e.i(675313),i=e.i(683865),n=e.i(293062);class r{constructor(e,t){this.unique=e,this.name=t}static [i.entityKind]="PgIndexBuilderOn";on(...e){return new s(e.map(e=>{if((0,i.is)(e,t.SQL))return e;let r=new n.IndexedColumn(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),r}),this.unique,!1,this.name)}onOnly(...e){return new s(e.map(e=>{if((0,i.is)(e,t.SQL))return e;let r=new n.IndexedColumn(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=e.defaultConfig,r}),this.unique,!0,this.name)}using(e,...r){return new s(r.map(e=>{if((0,i.is)(e,t.SQL))return e;let r=new n.IndexedColumn(e.name,!!e.keyAsName,e.columnType,e.indexConfig);return e.indexConfig=JSON.parse(JSON.stringify(e.defaultConfig)),r}),this.unique,!0,this.name,e)}}class s{static [i.entityKind]="PgIndexBuilder";config;constructor(e,t,i,n,r="btree"){this.config={name:n,columns:e,unique:t,only:i,method:r}}concurrently(){return this.config.concurrently=!0,this}with(e){return this.config.with=e,this}where(e){return this.config.where=e,this}build(e){return new a(this.config,e)}}class a{static [i.entityKind]="PgIndex";config;constructor(e,t){this.config={...e,table:t}}}e.s(["IndexBuilder",0,s,"index",0,function(e){return new r(!1,e)},"uniqueIndex",0,function(e){return new r(!0,e)}],849304);var o=n,l=n;class u extends l.PgColumnBuilder{static [i.entityKind]="PgIntColumnBaseBuilder";generatedAlwaysAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"always",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"always"};return this.config.hasDefault=!0,this.config.notNull=!0,this}generatedByDefaultAsIdentity(e){if(e){let{name:t,...i}=e;this.config.generatedIdentity={type:"byDefault",sequenceName:t,sequenceOptions:i}}else this.config.generatedIdentity={type:"byDefault"};return this.config.hasDefault=!0,this.config.notNull=!0,this}}e.s(["PgIntColumnBaseBuilder",0,u],486376);class c extends u{static [i.entityKind]="PgIntegerBuilder";constructor(e){super(e,"number","PgInteger")}build(e){return new d(e,this.config)}}class d extends o.PgColumn{static [i.entityKind]="PgInteger";getSQLType(){return"integer"}mapFromDriverValue(e){return"string"==typeof e?Number.parseInt(e):e}}e.s(["integer",0,function(e){return new c(e??"")}],723007);var m=n;class g extends m.PgColumnBuilder{static [i.entityKind]="PgJsonbBuilder";constructor(e){super(e,"json","PgJsonb")}build(e){return new p(e,this.config)}}class p extends m.PgColumn{static [i.entityKind]="PgJsonb";constructor(e,t){super(e,t)}getSQLType(){return"jsonb"}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){if("string"==typeof e)try{return JSON.parse(e)}catch{}return e}}e.s(["PgJsonb",0,p,"jsonb",0,function(e){return new g(e??"")}],396695);var h=e.i(315),f=n;class y extends f.PgColumnBuilder{static [i.entityKind]="PgNumericBuilder";constructor(e,t,i){super(e,"string","PgNumeric"),this.config.precision=t,this.config.scale=i}build(e){return new b(e,this.config)}}class b extends f.PgColumn{static [i.entityKind]="PgNumeric";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return"string"==typeof e?e:String(e)}getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}class _ extends f.PgColumnBuilder{static [i.entityKind]="PgNumericNumberBuilder";constructor(e,t,i){super(e,"number","PgNumericNumber"),this.config.precision=t,this.config.scale=i}build(e){return new N(e,this.config)}}class N extends f.PgColumn{static [i.entityKind]="PgNumericNumber";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}mapToDriverValue=String;getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}class w extends f.PgColumnBuilder{static [i.entityKind]="PgNumericBigIntBuilder";constructor(e,t,i){super(e,"bigint","PgNumericBigInt"),this.config.precision=t,this.config.scale=i}build(e){return new S(e,this.config)}}class S extends f.PgColumn{static [i.entityKind]="PgNumericBigInt";precision;scale;constructor(e,t){super(e,t),this.precision=t.precision,this.scale=t.scale}mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return void 0!==this.precision&&void 0!==this.scale?`numeric(${this.precision}, ${this.scale})`:void 0===this.precision?"numeric":`numeric(${this.precision})`}}e.s(["PgNumeric",0,b,"numeric",0,function(e,t){let{name:i,config:n}=(0,h.getColumnNameAndConfig)(e,t),r=n?.mode;return"number"===r?new _(i,n?.precision,n?.scale):"bigint"===r?new w(i,n?.precision,n?.scale):new y(i,n?.precision,n?.scale)}],519442);class x{constructor(e,t,i){this.seqName=e,this.seqOptions=t,this.schema=i}static [i.entityKind]="PgSequence"}e.s(["pgSequenceWithSchema",0,function(e,t,i){return new x(e,t,i)}],623303);var z=n;class v extends u{static [i.entityKind]="PgBigInt53Builder";constructor(e){super(e,"number","PgBigInt53")}build(e){return new C(e,this.config)}}class C extends z.PgColumn{static [i.entityKind]="PgBigInt53";getSQLType(){return"bigint"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class T extends u{static [i.entityKind]="PgBigInt64Builder";constructor(e){super(e,"bigint","PgBigInt64")}build(e){return new P(e,this.config)}}class P extends z.PgColumn{static [i.entityKind]="PgBigInt64";getSQLType(){return"bigint"}mapFromDriverValue(e){return BigInt(e)}}e.s(["bigint",0,function(e,t){let{name:i,config:n}=(0,h.getColumnNameAndConfig)(e,t);return"number"===n.mode?new v(i):new T(i)}],963307);var q=n;class I extends q.PgColumnBuilder{static [i.entityKind]="PgBigSeri
1al53Builder";constructor(e){super(e,"number","PgBigSerial53"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new $(e,this.config)}}class $ extends q.PgColumn{static [i.entityKind]="PgBigSerial53";getSQLType(){return"bigserial"}mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}}class A extends q.PgColumnBuilder{static [i.entityKind]="PgBigSerial64Builder";constructor(e){super(e,"bigint","PgBigSerial64"),this.config.hasDefault=!0}build(e){return new k(e,this.config)}}class k extends q.PgColumn{static [i.entityKind]="PgBigSerial64";getSQLType(){return"bigserial"}mapFromDriverValue(e){return BigInt(e)}}e.s(["bigserial",0,function(e,t){let{name:i,config:n}=(0,h.getColumnNameAndConfig)(e,t);return"number"===n.mode?new I(i):new A(i)}],908931);var B=n;class K extends B.PgColumnBuilder{static [i.entityKind]="PgCharBuilder";constructor(e,t){super(e,"string","PgChar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new D(e,this.config)}}class D extends B.PgColumn{static [i.entityKind]="PgChar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"char":`char(${this.length})`}}e.s(["char",0,function(e,t={}){let{name:i,config:n}=(0,h.getColumnNameAndConfig)(e,t);return new K(i,n)}],593365);var j=n;class L extends j.PgColumnBuilder{static [i.entityKind]="PgCidrBuilder";constructor(e){super(e,"string","PgCidr")}build(e){return new O(e,this.config)}}class O extends j.PgColumn{static [i.entityKind]="PgCidr";getSQLType(){return"cidr"}}e.s(["cidr",0,function(e){return new L(e??"")}],138855);var Q=n;class F extends Q.PgColumnBuilder{static [i.entityKind]="PgCustomColumnBuilder";constructor(e,t,i){super(e,"custom","PgCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=i}build(e){return new V(e,this.config)}}class V extends Q.PgColumn{static [i.entityKind]="PgCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}e.s(["customType",0,function(e){return(t,i)=>{let{name:n,config:r}=(0,h.getColumnNameAndConfig)(t,i);return new F(n,r,e)}}],199548)},152484,866945,69218,402903,320874,876972,e=>{"use strict";var t=e.i(683865),i=e.i(675313),n=e.i(466908),r=e.i(623303),s=e.i(165846),a=e.i(963307),o=e.i(908931),l=e.i(43489),u=e.i(593365),c=e.i(138855),d=e.i(199548),m=e.i(792335),g=e.i(460012),p=e.i(814410),h=e.i(723007),f=e.i(866933),y=e.i(872459),b=e.i(396695),_=e.i(485989),N=e.i(677601),w=e.i(838485),S=e.i(519442),x=e.i(702876),z=e.i(422308),v=e.i(293062);class C extends v.PgColumnBuilder{static [t.entityKind]="PgRealBuilder";constructor(e,t){super(e,"number","PgReal"),this.config.length=t}build(e){return new T(e,this.config)}}class T extends v.PgColumn{static [t.entityKind]="PgReal";constructor(e,t){super(e,t)}getSQLType(){return"real"}mapFromDriverValue=e=>"string"==typeof e?Number.parseFloat(e):e}function P(e){return new C(e??"")}var q=v;class I extends q.PgColumnBuilder{static [t.entityKind]="PgSerialBuilder";constructor(e){super(e,"number","PgSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new $(e,this.config)}}class $ extends q.PgColumn{static [t.entityKind]="PgSerial";getSQLType(){return"serial"}}function A(e){return new I(e??"")}var k=v,B=e.i(486376);class K extends B.PgIntColumnBaseBuilder{static [t.entityKind]="PgSmallIntBuilder";constructor(e){super(e,"number","PgSmallInt")}build(e){return new D(e,this.config)}}class D extends k.PgColumn{static [t.entityKind]="PgSmallInt";getSQLType(){return"smallint"}mapFromDriverValue=e=>"string"==typeof e?Number(e):e}function j(e){return new K(e??"")}var L=v;class O extends L.PgColumnBuilder{static [t.entityKind]="PgSmallSerialBuilder";constructor(e){super(e,"number","PgSmallSerial"),this.config.hasDefault=!0,this.config.notNull=!0}build(e){return new Q(e,this.config)}}class Q extends L.PgColumn{static [t.entityKind]="PgSmallSerial";
1getSQLType(){return"smallserial"}}function F(e){return new O(e??"")}var V=e.i(315),U=v;class R extends U.PgColumnBuilder{static [t.entityKind]="PgTextBuilder";constructor(e,t){super(e,"string","PgText"),this.config.enumValues=t.enum}build(e){return new M(e,this.config)}}class M extends U.PgColumn{static [t.entityKind]="PgText";enumValues=this.config.enumValues;getSQLType(){return"text"}}function E(e,t={}){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new R(i,n)}e.s(["text",0,E],866945);var J=v,G=e.i(879319);class X extends G.PgDateColumnBaseBuilder{constructor(e,t,i){super(e,"string","PgTime"),this.withTimezone=t,this.precision=i,this.config.withTimezone=t,this.config.precision=i}static [t.entityKind]="PgTimeBuilder";build(e){return new W(e,this.config)}}class W extends J.PgColumn{static [t.entityKind]="PgTime";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`time${e}${this.withTimezone?" with time zone":""}`}}function H(e,t={}){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new X(i,n.withTimezone??!1,n.precision)}var Y=v,Z=G;class ee extends Z.PgDateColumnBaseBuilder{static [t.entityKind]="PgTimestampBuilder";constructor(e,t,i){super(e,"date","PgTimestamp"),this.config.withTimezone=t,this.config.precision=i}build(e){return new et(e,this.config)}}class et extends Y.PgColumn{static [t.entityKind]="PgTimestamp";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":` (${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}mapFromDriverValue=e=>new Date(this.withTimezone?e:e+"+0000");mapToDriverValue=e=>e.toISOString()}class ei extends Z.PgDateColumnBaseBuilder{static [t.entityKind]="PgTimestampStringBuilder";constructor(e,t,i){super(e,"string","PgTimestampString"),this.config.withTimezone=t,this.config.precision=i}build(e){return new en(e,this.config)}}class en extends Y.PgColumn{static [t.entityKind]="PgTimestampString";withTimezone;precision;constructor(e,t){super(e,t),this.withTimezone=t.withTimezone,this.precision=t.precision}getSQLType(){let e=void 0===this.precision?"":`(${this.precision})`;return`timestamp${e}${this.withTimezone?" with time zone":""}`}}function er(e,t={}){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return n?.mode==="string"?new ei(i,n.withTimezone??!1,n.precision):new ee(i,n?.withTimezone??!1,n?.precision)}e.s(["PgTimestamp",0,et,"PgTimestampString",0,en,"timestamp",0,er],69218);var es=v;class ea extends es.PgColumnBuilder{static [t.entityKind]="PgUUIDBuilder";constructor(e){super(e,"string","PgUUID")}defaultRandom(){return this.default(i.sql`gen_random_uuid()`)}build(e){return new eo(e,this.config)}}class eo extends es.PgColumn{static [t.entityKind]="PgUUID";getSQLType(){return"uuid"}}function el(e){return new ea(e??"")}e.s(["PgUUID",0,eo,"uuid",0,el],402903);var eu=v;class ec extends eu.PgColumnBuilder{static [t.entityKind]="PgVarcharBuilder";constructor(e,t){super(e,"string","PgVarchar"),this.config.length=t.length,this.config.enumValues=t.enum}build(e){return new ed(e,this.config)}}class ed extends eu.PgColumn{static [t.entityKind]="PgVarchar";length=this.config.length;enumValues=this.config.enumValues;getSQLType(){return void 0===this.length?"varchar":`varchar(${this.length})`}}function em(e,t={}){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new ec(i,n)}var eg=v;class ep extends eg.PgColumnBuilder{static [t.entityKind]="PgBinaryVectorBuilder";constructor(e,t){super(e,"string","PgBinaryVector"),this.config.dimensions=t.dimensions}build(e){return new eh(e,this.config)}}class eh extends eg.PgColumn{static [t.entityKind]="PgBinaryVector";dimensions=this.config.dimensions;getSQLType(){return`bit(${this.dimensions})`}}function ef(e,t){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new ep(i,n)}var ey=v;class eb extends ey.PgColumnBuilder{static [t.entityKind]="PgHalfVectorBuilder";constructor(e,t){super(e,"array","PgHalfVector"),this.config.dimensions=t.dimensions}build(e){return new e_(e,this.config)}}class e_ extends ey.PgColumn{static [t.entityKind]="PgHalfVector";dimensions=this.config.dimensions;getSQLType(){return`halfvec(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}function eN(e,t){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new eb(i,n)}var ew=v;class eS extends ew.PgColumnBuilder{static [t.entityKind]="PgSparseVectorBuilder";constructor(e,t){super(e,"string","PgSparseVector"),this.config.dimensions=t.dimensions}build(e){return new ex(e,this.config)}}class ex extends ew.PgColumn{static [t.entityKind]="PgSparseVector";dimensions=this.config.dimensions;getSQLType(){return`sparsevec(${this.dimensions})`}}
1function ez(e,t){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new eS(i,n)}var ev=v;class eC extends ev.PgColumnBuilder{static [t.entityKind]="PgVectorBuilder";constructor(e,t){super(e,"array","PgVector"),this.config.dimensions=t.dimensions}build(e){return new eT(e,this.config)}}class eT extends ev.PgColumn{static [t.entityKind]="PgVector";dimensions=this.config.dimensions;getSQLType(){return`vector(${this.dimensions})`}mapToDriverValue(e){return JSON.stringify(e)}mapFromDriverValue(e){return e.slice(1,-1).split(",").map(e=>Number.parseFloat(e))}}function eP(e,t){let{name:i,config:n}=(0,V.getColumnNameAndConfig)(e,t);return new eC(i,n)}let eq=Symbol.for("drizzle:PgInlineForeignKeys"),eI=Symbol.for("drizzle:EnableRLS");class e$ extends s.Table{static [t.entityKind]="PgTable";static Symbol=Object.assign({},s.Table.Symbol,{InlineForeignKeys:eq,EnableRLS:eI});[eq]=[];[eI]=!1;[s.Table.Symbol.ExtraConfigBuilder]=void 0;[s.Table.Symbol.ExtraConfigColumns]={}}function eA(e,t,i,n,r=e){let v=new e$(e,n,r),C="function"==typeof t?t({bigint:a.bigint,bigserial:o.bigserial,boolean:l.boolean,char:u.char,cidr:c.cidr,customType:d.customType,date:m.date,doublePrecision:g.doublePrecision,inet:p.inet,integer:h.integer,interval:f.interval,json:y.json,jsonb:b.jsonb,line:_.line,macaddr:N.macaddr,macaddr8:w.macaddr8,numeric:S.numeric,point:x.point,geometry:z.geometry,real:P,serial:A,smallint:j,smallserial:F,text:E,time:H,timestamp:er,uuid:el,varchar:em,bit:ef,halfvec:eN,sparsevec:ez,vector:eP}):t,T=Object.fromEntries(Object.entries(C).map(([e,t])=>{t.setName(e);let i=t.build(v);return v[eq].push(...t.buildForeignKeys(i,v)),[e,i]})),q=Object.fromEntries(Object.entries(C).map(([e,t])=>(t.setName(e),[e,t.buildExtraConfigColumn(v)]))),I=Object.assign(v,T);return I[s.Table.Symbol.Columns]=T,I[s.Table.Symbol.ExtraConfigColumns]=q,i&&(I[e$.Symbol.ExtraConfigBuilder]=i),Object.assign(I,{enableRLS:()=>(I[e$.Symbol.EnableRLS]=!0,I)})}var ek=e.i(269330),eB=e.i(948260);class eK{constructor(e){this.table=e}static [t.entityKind]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class eD{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static [t.entityKind]="TableAliasProxyHandler";get(e,i){if(i===s.Table.Symbol.IsAlias)return!0;if(i===s.Table.Symbol.Name||this.replaceOriginalName&&i===s.Table.Symbol.OriginalName)return this.alias;if(i===eB.ViewBaseConfig)return{...e[eB.ViewBaseConfig],name:this.alias,isAlias:!0};if(i===s.Table.Symbol.Columns){let t=e[s.Table.Symbol.Columns];if(!t)return t;let i={};return Object.keys(t).map(n=>{i[n]=new Proxy(t[n],new eK(new Proxy(e,this)))}),i}let n=e[i];return(0,t.is)(n,ek.Column)?new Proxy(n,new eK(new Proxy(e,this))):n}}function ej(e,t){return new Proxy(e,new eD(t,!1))}function eL(e,t){return new Proxy(e,new eK(new Proxy(e.table,new eD(t,!1))))}function eO(e,t){return new i.SQL.Aliased(eQ(e.sql,t),e.fieldAlias)}function eQ(e,n){return i.sql.join(e.queryChunks.map(e=>(0,t.is)(e,ek.Column)?eL(e,n):(0,t.is)(e,i.SQL)?eQ(e,n):(0,t.is)(e,i.SQL.Aliased)?eO(e,n):e))}t.entityKind;var eF=e.i(297392);class eV{static [t.entityKind]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,n){if("_"===n)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(n===eB.ViewBaseConfig)return{...e[eB.ViewBaseConfig],selectedFields:new Proxy(e[eB.ViewBaseConfig].selectedFields,this)};if("symbol"==typeof n)return e[n];let r=((0,t.is)(e,eF.Subquery)?e._.selectedFields:(0,t.is)(e,i.View)?e[eB.ViewBaseConfig].selectedFields:e)[n];if((0,t.is)(r,i.SQL.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!r.isSelectionField)return r.sql;let e=r.clone();return e.isSelectionField=!0,e}if((0,t.is)(r,i.SQL)){if("sql"===this.config.sqlBehavior)return r;throw Error(`You tried to reference "${n}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return(0,t.is)(r,ek.Column)?this.config.alias?new Proxy(r,new eK(new Proxy(r.table,new eD(this.config.alias,this.config.replaceOriginalName??!1)))):r:"object"!=typeof r||null===r?r:new Proxy(r,new eV(this.config))}}function eU(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function eR(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,i)=>e+(0===i?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function eM(e){return e}class eE{static [t.entityKind]="CasingCache";cache={};cachedTables={};convert;
1constructor(e){this.convert="snake_case"===e?eU:"camelCase"===e?eR:eM}getColumnCasing(e){if(!e.keyAsName)return e.name;let t=e.table[s.Table.Symbol.Schema]??"public",i=e.table[s.Table.Symbol.OriginalName],n=`${t}.${i}.${e.name}`;return this.cache[n]||this.cacheTable(e.table),this.cache[n]}cacheTable(e){let t=e[s.Table.Symbol.Schema]??"public",i=e[s.Table.Symbol.OriginalName],n=`${t}.${i}`;if(!this.cachedTables[n]){for(let t of Object.values(e[s.Table.Symbol.Columns])){let e=`${n}.${t.name}`;this.cache[e]=this.convert(t.name)}this.cachedTables[n]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class eJ extends Error{static [t.entityKind]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}function eG(...e){return e[0].columns?new eX(e[0].columns,e[0].name):new eX(e)}t.entityKind;class eX{static [t.entityKind]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new eW(e,this.columns,this.name)}}class eW{constructor(e,t,i){this.table=e,this.columns=t,this.name=i}static [t.entityKind]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[e$.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function eH(e,n){return!(0,i.isDriverValueEncoder)(n)||(0,i.isSQLWrapper)(e)||(0,t.is)(e,i.Param)||(0,t.is)(e,i.Placeholder)||(0,t.is)(e,ek.Column)||(0,t.is)(e,s.Table)||(0,t.is)(e,i.View)?e:new i.Param(e,n)}e.s(["PrimaryKeyBuilder",0,eX,"primaryKey",0,eG],320874);let eY=(e,t)=>i.sql`${e} = ${eH(t,e)}`,eZ=(e,t)=>i.sql`${e} <> ${eH(t,e)}`;function e0(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new i.SQL(1===t.length?t:[new i.StringChunk("("),i.sql.join(t,new i.StringChunk(" and ")),new i.StringChunk(")")])}function e1(...e){let t=e.filter(e=>void 0!==e);if(0!==t.length)return new i.SQL(1===t.length?t:[new i.StringChunk("("),i.sql.join(t,new i.StringChunk(" or ")),new i.StringChunk(")")])}function e3(e){return i.sql`not ${e}`}let e8=(e,t)=>i.sql`${e} > ${eH(t,e)}`,e6=(e,t)=>i.sql`${e} >= ${eH(t,e)}`,e2=(e,t)=>i.sql`${e} < ${eH(t,e)}`,e4=(e,t)=>i.sql`${e} <= ${eH(t,e)}`;function e5(e,t){return Array.isArray(t)?0===t.length?i.sql`false`:i.sql`${e} in ${t.map(t=>eH(t,e))}`:i.sql`${e} in ${eH(t,e)}`}function e9(e,t){return Array.isArray(t)?0===t.length?i.sql`true`:i.sql`${e} not in ${t.map(t=>eH(t,e))}`:i.sql`${e} not in ${eH(t,e)}`}function e7(e){return i.sql`${e} is null`}function te(e){return i.sql`${e} is not null`}function tt(e){return i.sql`exists ${e}`}function ti(e){return i.sql`not exists ${e}`}function tn(e,t,n){return i.sql`${e} between ${eH(t,e)} and ${eH(n,e)}`}function tr(e,t,n){return i.sql`${e} not between ${eH(t,e)} and ${eH(n,e)}`}function ts(e,t){return i.sql`${e} like ${t}`}function ta(e,t){return i.sql`${e} not like ${t}`}function to(e,t){return i.sql`${e} ilike ${t}`}function tl(e,t){return i.sql`${e} not ilike ${t}`}function tu(e){return i.sql`${e} asc`}function tc(e){return i.sql`${e} desc`}class td{constructor(e,t,i){this.sourceTable=e,this.referencedTable=t,this.relationName=i,this.referencedTableName=t[s.Table.Symbol.Name]}static [t.entityKind]="Relation";referencedTableName;fieldName}t.entityKind;class tm extends td{constructor(e,t,i,n){super(e,t,i?.relationName),this.config=i,this.isNullable=n}static [t.entityKind]="One";withFieldName(e){let t=new tm(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class tg extends td{constructor(e,t,i){super(e,t,i?.relationName),this.config=i}static [t.entityKind]="Many";withFieldName(e){let t=new tg(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}var tp=i;class th extends tp.View{static [t.entityKind]="PgViewBase"}class tf{static [t.entityKind]="PgDialect";casing;constructor(e){this.casing=new eE(e?.casing)}async migrate(e,t,n){let r="string"==typeof n?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",s="string"==typeof n?"drizzle":n.migrationsSchema??"drizzle",a=i.sql` 2 CREATE TABLE IF NOT EXISTS ${i.sql.identifier(s)}.${i.sql.identifier(r)} ( 3 id SERIAL PRIMARY KEY, 4 hash text NOT NULL, 5 created_at bigint 6 ) 7 `;await t.execute(i.sql`CREATE SCHEMA IF NOT EXISTS ${i.sql.identifier(s)}`),await t.execute(a);let o=(await t.all(i.sql`select id, hash, created_at from ${i.sql.identifier(s)}.${i.sql.identifier(r)} order by created_at desc limit 1`))[0];await t.transaction(async t=>{for await(let n of e)if(!o||Number(o.created_at)<n.folderMillis){for(let e of n.sql)await t.execute(i.sql.raw(e));await t.execute(i.sql`insert into ${i.sql.identifier(s)}.${i.sql.identifier(r)} ("hash", "created_at") values(${n.hash}, ${n.folderMillis})`)}})}escapeName(e){return`"${e}"`}escapeParam(e){return`$${e+1}`}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;let t=[i.sql`with `];for(let[n,r]of e.entries())t.push(i.sql`${i.sql.identifier(r._.alias)} as (${r._.sql})`),n<e.length-1&&t.push(i.sql`, `);return t.push(i.sql` `),i.sql.join(t)}buildDeleteQuery({table:e,where:t,returning:n,withList:r}){let s=this.buildWithCTE(r),a=n?i.sql` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0,o=t?i.sql` where ${t}`:void 0;return i.sql`${s}delete from ${e}${o}${a}`}buildUpdateSet(e,t){let n=e[s.Table.Symbol.Columns],r=Object.keys(n).filter(e=>void 0!==t[e]||n[e]?.onUpdateFn!==void 0),a=r.length;return i.sql.join(r.flatMap((e,r)=>{let s=n[e],o=t[e]??i.sql.param(s.onUpdateFn(),s),l=i.sql`${i.sql.identifier(this.casing.getColumnCasing(s))} = ${o}`;
7return r<a-1?[l,i.sql.raw(", ")]:[l]}))}buildUpdateQuery({table:e,set:t,where:n,returning:r,withList:s,from:a,joins:o}){let l=this.buildWithCTE(s),u=e[e$.Symbol.Name],c=e[e$.Symbol.Schema],d=e[e$.Symbol.OriginalName],m=u===d?void 0:u,g=i.sql`${c?i.sql`${i.sql.identifier(c)}.`:void 0}${i.sql.identifier(d)}${m&&i.sql` ${i.sql.identifier(m)}`}`,p=this.buildUpdateSet(e,t),h=a&&i.sql.join([i.sql.raw(" from "),this.buildFromTable(a)]),f=this.buildJoins(o),y=r?i.sql` returning ${this.buildSelection(r,{isSingleTable:!a})}`:void 0,b=n?i.sql` where ${n}`:void 0;return i.sql`${l}update ${g} set ${p}${h}${f}${b}${y}`}buildSelection(e,{isSingleTable:n=!1}={}){let r=e.length,s=e.flatMap(({field:e},s)=>{let a=[];if((0,t.is)(e,i.SQL.Aliased)&&e.isSelectionField)a.push(i.sql.identifier(e.fieldAlias));else if((0,t.is)(e,i.SQL.Aliased)||(0,t.is)(e,i.SQL)){let r=(0,t.is)(e,i.SQL.Aliased)?e.sql:e;n?a.push(new i.SQL(r.queryChunks.map(e=>(0,t.is)(e,v.PgColumn)?i.sql.identifier(this.casing.getColumnCasing(e)):e))):a.push(r),(0,t.is)(e,i.SQL.Aliased)&&a.push(i.sql` as ${i.sql.identifier(e.fieldAlias)}`)}else(0,t.is)(e,ek.Column)&&(n?a.push(i.sql.identifier(this.casing.getColumnCasing(e))):a.push(e));return s<r-1&&a.push(i.sql`, `),a});return i.sql.join(s)}buildJoins(e){if(!e||0===e.length)return;let n=[];for(let[r,s]of e.entries()){0===r&&n.push(i.sql` `);let a=s.table,o=s.lateral?i.sql` lateral`:void 0,l=s.on?i.sql` on ${s.on}`:void 0;if((0,t.is)(a,e$)){let e=a[e$.Symbol.Name],t=a[e$.Symbol.Schema],r=a[e$.Symbol.OriginalName],u=e===r?void 0:s.alias;n.push(i.sql`${i.sql.raw(s.joinType)} join${o} ${t?i.sql`${i.sql.identifier(t)}.`:void 0}${i.sql.identifier(r)}${u&&i.sql` ${i.sql.identifier(u)}`}${l}`)}else if((0,t.is)(a,i.View)){let e=a[eB.ViewBaseConfig].name,t=a[eB.ViewBaseConfig].schema,r=a[eB.ViewBaseConfig].originalName,u=e===r?void 0:s.alias;n.push(i.sql`${i.sql.raw(s.joinType)} join${o} ${t?i.sql`${i.sql.identifier(t)}.`:void 0}${i.sql.identifier(r)}${u&&i.sql` ${i.sql.identifier(u)}`}${l}`)}else n.push(i.sql`${i.sql.raw(s.joinType)} join${o} ${a}${l}`);r<e.length-1&&n.push(i.sql` `)}return i.sql.join(n)}buildFromTable(e){if((0,t.is)(e,s.Table)&&e[s.Table.Symbol.IsAlias]){let t=i.sql`${i.sql.identifier(e[s.Table.Symbol.OriginalName])}`;return e[s.Table.Symbol.Schema]&&(t=i.sql`${i.sql.identifier(e[s.Table.Symbol.Schema])}.${t}`),i.sql`${t} ${i.sql.identifier(e[s.Table.Symbol.Name])}`}return e}buildSelectQuery({withList:e,fields:n,fieldsFlat:r,where:a,having:o,table:l,joins:u,orderBy:c,groupBy:d,limit:m,offset:g,lockingClause:p,distinct:h,setOperators:f}){let y,b,_,N=r??(0,V.orderSelectedFields)(n);for(let e of N){let n;if((0,t.is)(e.field,ek.Column)&&(0,s.getTableName)(e.field.table)!==((0,t.is)(l,eF.Subquery)?l._.alias:(0,t.is)(l,th)?l[eB.ViewBaseConfig].name:(0,t.is)(l,i.SQL)?void 0:(0,s.getTableName)(l))&&(n=e.field.table,!u?.some(({alias:e})=>e===(n[s.Table.Symbol.IsAlias]?(0,s.getTableName)(n):n[s.Table.Symbol.BaseName])))){let t=(0,s.getTableName)(e.field.table);throw Error(`Your "${e.path.join("->")}" field references a column "${t}"."${e.field.name}", but the table "${t}" is not part of the query! Did you forget to join it?`)}}let w=!u||0===u.length,S=this.buildWithCTE(e);h&&(y=!0===h?i.sql` distinct`:i.sql` distinct on (${i.sql.join(h.on,i.sql`, `)})`);let x=this.buildSelection(N,{isSingleTable:w}),z=this.buildFromTable(l),v=this.buildJoins(u),C=a?i.sql` where ${a}`:void 0,T=o?i.sql` having ${o}`:void 0;c&&c.length>0&&(b=i.sql` order by ${i.sql.join(c,i.sql`, `)}`),d&&d.length>0&&(_=i.sql` group by ${i.sql.join(d,i.sql`, `)}`);let P="object"==typeof m||"number"==typeof m&&m>=0?i.sql` limit ${m}`:void 0,q=g?i.sql` offset ${g}`:void 0,I=i.sql.empty();if(p){let e=i.sql` for ${i.sql.raw(p.strength)}`;p.config.of&&e.append(i.sql` of ${i.sql.join(Array.isArray(p.config.of)?p.config.of:[p.config.of],i.sql`, `)}`),p.config.noWait?e.append(i.sql` nowait`):p.config.skipLocked&&e.append(i.sql` skip locked`),I.append(e)}let $=i.sql`${S}select${y} ${x} from ${z}${v}${C}${_}${T}${b}${P}${q}${I}`;return f.length>0?this.buildSetOperations($,f):$}buildSetOperations(e,t){let[i,...n]=t;if(!i)throw Error("Cannot pass undefined values to any set operator");
7return 0===n.length?this.buildSetOperationQuery({leftSelect:e,setOperator:i}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:i}),n)}buildSetOperationQuery({leftSelect:e,setOperator:{type:n,isAll:r,rightSelect:s,limit:a,orderBy:o,offset:l}}){let u,c=i.sql`(${e.getSQL()}) `,d=i.sql`(${s.getSQL()})`;if(o&&o.length>0){let e=[];for(let n of o)if((0,t.is)(n,v.PgColumn))e.push(i.sql.identifier(n.name));else if((0,t.is)(n,i.SQL)){for(let e=0;e<n.queryChunks.length;e++){let r=n.queryChunks[e];(0,t.is)(r,v.PgColumn)&&(n.queryChunks[e]=i.sql.identifier(r.name))}e.push(i.sql`${n}`)}else e.push(i.sql`${n}`);u=i.sql` order by ${i.sql.join(e,i.sql`, `)} `}let m="object"==typeof a||"number"==typeof a&&a>=0?i.sql` limit ${a}`:void 0,g=i.sql.raw(`${n} ${r?"all ":""}`),p=l?i.sql` offset ${l}`:void 0;return i.sql`${c}${g}${d}${u}${m}${p}`}buildInsertQuery({table:e,values:n,onConflict:r,returning:a,withList:o,select:l,overridingSystemValue_:u}){let c=[],d=Object.entries(e[s.Table.Symbol.Columns]).filter(([e,t])=>!t.shouldDisableInsert()),m=d.map(([,e])=>i.sql.identifier(this.casing.getColumnCasing(e)));if(l)(0,t.is)(n,i.SQL)?c.push(n):c.push(n.getSQL());else for(let[e,r]of(c.push(i.sql.raw("values ")),n.entries())){let s=[];for(let[e,n]of d){let a=r[e];if(void 0===a||(0,t.is)(a,i.Param)&&void 0===a.value)if(void 0!==n.defaultFn){let e=n.defaultFn(),r=(0,t.is)(e,i.SQL)?e:i.sql.param(e,n);s.push(r)}else if(n.default||void 0===n.onUpdateFn)s.push(i.sql`default`);else{let e=n.onUpdateFn(),r=(0,t.is)(e,i.SQL)?e:i.sql.param(e,n);s.push(r)}else s.push(a)}c.push(s),e<n.length-1&&c.push(i.sql`, `)}let g=this.buildWithCTE(o),p=i.sql.join(c),h=a?i.sql` returning ${this.buildSelection(a,{isSingleTable:!0})}`:void 0,f=r?i.sql` on conflict ${r}`:void 0,y=!0===u?i.sql`overriding system value `:void 0;return i.sql`${g}insert into ${e} ${m} ${y}${p}${f}${h}`}buildRefreshMaterializedViewQuery({view:e,concurrently:t,withNoData:n}){let r=t?i.sql` concurrently`:void 0,s=n?i.sql` with no data`:void 0;return i.sql`refresh materialized view${r} ${e}${s}`}prepareTyping(e){if((0,t.is)(e,b.PgJsonb)||(0,t.is)(e,y.PgJson))return"json";if((0,t.is)(e,S.PgNumeric))return"decimal";if((0,t.is)(e,W))return"time";if((0,t.is)(e,et)||(0,t.is)(e,en))return"timestamp";if((0,t.is)(e,m.PgDate)||(0,t.is)(e,m.PgDateString))return"date";else if((0,t.is)(e,eo))return"uuid";else return"none"}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,prepareTyping:this.prepareTyping,invokeSource:t})}buildRelationalQueryWithoutPK({fullSchema:e,schema:n,tableNamesMap:r,table:a,tableConfig:o,queryConfig:l,tableAlias:u,nestedQueryRelation:c,joinOn:d}){let m,g=[],p,h,f=[],y,b=[];if(!0===l)g=Object.entries(o.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:eL(t,u),relationTableTsKey:void 0,isJson:!1,selection:[]}));else{let a=Object.fromEntries(Object.entries(o.columns).map(([e,t])=>[e,eL(t,u)]));if(l.where){let e="function"==typeof l.where?l.where(a,{and:e0,between:tn,eq:eY,exists:tt,gt:e8,gte:e6,ilike:to,inArray:e5,isNull:e7,isNotNull:te,like:ts,lt:e2,lte:e4,ne:eZ,not:e3,notBetween:tr,notExists:ti,notLike:ta,notIlike:tl,notInArray:e9,or:e1,sql:i.sql}):l.where;y=e&&eQ(e,u)}let c=[],d=[];if(l.columns){let e=!1;for(let[t,i]of Object.entries(l.columns))void 0!==i&&t in o.columns&&(e||!0!==i||(e=!0),d.push(t));d.length>0&&(d=e?d.filter(e=>l.columns?.[e]===!0):Object.keys(o.columns).filter(e=>!d.includes(e)))}else d=Object.keys(o.columns);for(let e of d){let t=o.columns[e];c.push({tsKey:e,value:t})}let m=[];if(l.with&&(m=Object.entries(l.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:o.relations[e]}))),l.extras)for(let[e,t]of Object.entries("function"==typeof l.extras?l.extras(a,{sql:i.sql}):l.extras))c.push({tsKey:e,value:eO(t,u)});for(let{tsKey:e,value:n}of c)g.push({dbKey:(0,t.is)(n,i.SQL.Aliased)?n.fieldAlias:o.columns[e].name,tsKey:e,field:(0,t.is)(n,ek.Column)?eL(n,u):n,relationTableTsKey:void 0,isJson:!1,selection:[]});let _="function"==typeof l.orderBy?l.orderBy(a,{sql:i.sql,asc:tu,desc:tc}):l.orderBy??[];for(let{tsKey:a,queryConfig:o,relation:c}of(Array.isArray(_)||(_=[_]),f=_.map(e=>(0,t.is)(e,ek.Column)?eL(e,u):eQ(e,u)),p=l.limit,h=l.offset,m)){let l=function(e,i,n){if((0,t.is)(n,tm)&&n.c
7onfig)return{fields:n.config.fields,references:n.config.references};let r=i[(0,s.getTableUniqueName)(n.referencedTable)];if(!r)throw Error(`Table "${n.referencedTable[s.Table.Symbol.Name]}" not found in schema`);let a=e[r];if(!a)throw Error(`Table "${r}" not found in schema`);let o=n.sourceTable,l=i[(0,s.getTableUniqueName)(o)];if(!l)throw Error(`Table "${o[s.Table.Symbol.Name]}" not found in schema`);let u=[];for(let e of Object.values(a.relations))(n.relationName&&n!==e&&e.relationName===n.relationName||!n.relationName&&e.referencedTable===n.sourceTable)&&u.push(e);if(u.length>1)throw n.relationName?Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):Error(`There are multiple relations between "${r}" and "${n.sourceTable[s.Table.Symbol.Name]}". Please specify relation name`);if(u[0]&&(0,t.is)(u[0],tm)&&u[0].config)return{fields:u[0].config.references,references:u[0].config.fields};throw Error(`There is not enough information to infer relation "${l}.${n.fieldName}"`)}(n,r,c),d=r[(0,s.getTableUniqueName)(c.referencedTable)],m=`${u}_${a}`,p=e0(...l.fields.map((e,t)=>eY(eL(l.references[t],m),eL(e,u)))),h=this.buildRelationalQueryWithoutPK({fullSchema:e,schema:n,tableNamesMap:r,table:e[d],tableConfig:n[d],queryConfig:(0,t.is)(c,tm)?!0===o?{limit:1}:{...o,limit:1}:o,tableAlias:m,joinOn:p,nestedQueryRelation:c}),f=i.sql`${i.sql.identifier(m)}.${i.sql.identifier("data")}`.as(a);b.push({on:i.sql`true`,table:new eF.Subquery(h.sql,{},m),alias:m,joinType:"left",lateral:!0}),g.push({dbKey:a,tsKey:a,field:f,relationTableTsKey:d,isJson:!0,selection:h.selection})}}if(0===g.length)throw new eJ({message:`No fields selected for table "${o.tsName}" ("${u}")`});if(y=e0(d,y),c){let e=i.sql`json_build_array(${i.sql.join(g.map(({field:e,tsKey:n,isJson:r})=>r?i.sql`${i.sql.identifier(`${u}_${n}`)}.${i.sql.identifier("data")}`:(0,t.is)(e,i.SQL.Aliased)?e.sql:e),i.sql`, `)})`;(0,t.is)(c,tg)&&(e=i.sql`coalesce(json_agg(${e}${f.length>0?i.sql` order by ${i.sql.join(f,i.sql`, `)}`:void 0}), '[]'::json)`);let n=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:o.tsName,selection:g}];void 0!==p||void 0!==h||f.length>0?(m=this.buildSelectQuery({table:ej(a,u),fields:{},fieldsFlat:[{path:[],field:i.sql.raw("*")}],where:y,limit:p,offset:h,orderBy:f,setOperators:[]}),y=void 0,p=void 0,h=void 0,f=[]):m=ej(a,u),m=this.buildSelectQuery({table:(0,t.is)(m,e$)?m:new eF.Subquery(m,{},u),fields:{},fieldsFlat:n.map(({field:e})=>({path:[],field:(0,t.is)(e,ek.Column)?eL(e,u):e})),joins:b,where:y,limit:p,offset:h,orderBy:f,setOperators:[]})}else m=this.buildSelectQuery({table:ej(a,u),fields:{},fieldsFlat:g.map(({field:e})=>({path:[],field:(0,t.is)(e,ek.Column)?eL(e,u):e})),joins:b,where:y,limit:p,offset:h,orderBy:f,setOperators:[]});return{tableTsKey:o.tsName,sql:m,selection:g}}}class ty{static [t.entityKind]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class tb{static [t.entityKind]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}var t_=e.i(788715);e.i(905664);var tN=e.i(839246),tw=e.i(849304);t.entityKind;var tS=e.i(395101);let tx=Symbol.for("drizzle:PgViewConfig");function tz(e){return(0,t.is)(e,e$)?[e[s.Schema]?`${e[s.Schema]}.${e[s.Table.Symbol.BaseName]}`:e[s.Table.Symbol.BaseName]]:(0,t.is)(e,eF.Subquery)?e._.usedTables??[]:(0,t.is)(e,i.SQL)?e.usedTables??[]:[]}class tv{static [t.entityKind]="PgSelectBuilder";fields;session;dialect;withList=[];distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,e.withList&&(this.withList=e.withList),this.distinct=e.distinct}authToken;setToken(e){return this.authToken=e,this}from(e){let n,r=!!this.fields;return n=this.fields?this.fields:(0,t.is)(e,eF.Subquery)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):(0,t.is)(e,th)?e[eB.ViewBaseConfig].selectedFields:(0,t.is)(e,i.SQL)?{}:(0,V.getTableColumns)(e),new tT({table:e,fields:n,isPartialSelect:r,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct}).setToken(this.authToken)}}class tC extends ty{static [t.entityKind]="PgSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=new Set;constructor({table:e,fields:t,isPartialSelect:i,session:n,dialect:r,withList:s,distinct:a}){for(const o of(super(),this.config={withList:s,table:e,fields:{...t},distinct:a,setOperators:[]},this.isPartialSelect=i,this.session=n,this.dialect=r,this._={selectedFields:t,config:this.config},this.tableName=(0,V.getTableLikeName)(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{},tz(e)))this.usedTables.add(o)}getUsedTables(){return[...this.usedTables]}createJoin(e,n){return(r,a)=>{let o=this.tableName,l=(0,V.getTableLikeName)(r);for(let e of tz(r))this.usedTables.add(e);if("string"==typeof l&&this.config.joins?.some(e=>e.alias===l))throw Error(`Alias "${l}" is already used in this query`);
7if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof o&&(this.config.fields={[o]:this.config.fields}),"string"==typeof l&&!(0,t.is)(r,i.SQL))){let e=(0,t.is)(r,eF.Subquery)?r._.selectedFields:(0,t.is)(r,i.View)?r[eB.ViewBaseConfig].selectedFields:r[s.Table.Symbol.Columns];this.config.fields[l]=e}if("function"==typeof a&&(a=a(new Proxy(this.config.fields,new eV({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:a,table:r,joinType:e,alias:l,lateral:n}),"string"==typeof l)switch(e){case"left":this.joinsNotNullableMap[l]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[l]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[l]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[l]=!1}return this}}leftJoin=this.createJoin("left",!1);leftJoinLateral=this.createJoin("left",!0);rightJoin=this.createJoin("right",!1);innerJoin=this.createJoin("inner",!1);innerJoinLateral=this.createJoin("inner",!0);fullJoin=this.createJoin("full",!1);crossJoin=this.createJoin("cross",!1);crossJoinLateral=this.createJoin("cross",!0);createSetOperator(e,t){return i=>{let n="function"==typeof i?i(tq()):i;if(!(0,V.haveSameKeys)(this.getSelectedFields(),n.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:n}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);intersectAll=this.createSetOperator("intersect",!0);except=this.createSetOperator("except",!1);exceptAll=this.createSetOperator("except",!0);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new eV({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new eV({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new eV({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){let t=e[0](new Proxy(this.config.fields,new eV({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),i=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=i:this.config.orderBy=i}else this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=e:this.config.orderBy=e;return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}for(e,t={}){return this.config.lockingClause={strength:e,config:t},this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){let{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){let t=[];if(t.push(...tz(this.config.table)),this.config.joins)for(let e of this.config.joins)t.push(...tz(e.table));return new Proxy(new eF.Subquery(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new eV({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new eV({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enable:!0,autoInvalidate:!0}:!1===e?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}}class tT extends tC{static [t.entityKind]="PgSelect";_prepare(e){let{session:t,config:i,dialect:n,joinsNotNullableMap:r,authToken:s,cacheConfig:a,usedTables:o}=this;if(!t)throw Error("Cannot execute a query on a query builder. Please use a database instance instead.");let{fields:l}=i;return t_.tracer.startActiveSpan("drizzle.prepareQuery",()=>{let i=(0,V.orderSelectedFields)(l),u=t.prepareQuery(n.sqlToQuery(this.getSQL()),i,e,!0,void 0,{type:"select",tables:[...o]},a);return u.joinsNotNullableMap=r,u.setToken(s)})}prepare(e){return this._prepare(e)}authToken;setToken(e){return this.authToken=e,this}execute=e=>t_.tracer.startActiveSpan("drizzle.operation",()=>this._prepare().execute(e,this.authToken))}function tP(e,t){return(i,n,...r)=>{let s=[n,...r].map(i=>({type:e,isAll:t,rightSelect:i}));for(let e of s)if(!(0,V.haveSameKeys)(i.getSelectedFields(),e.rightSelect.getSelectedFields()))throw Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return i.addSetOperators(s)}}(0,V.applyMixins)(tT,[tb]);let tq=()=>({union:tI,unionAll:t$,intersect:tA,intersectAll:tk,except:tB,exceptAll:tK}),tI=tP("union",!1),t$=tP("union",!0),tA=tP("intersect",!1),tk=tP("intersect",!0),tB=tP("except",!1),tK=tP("except",!0);class tD{static [t.entityKind]="PgQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=(0,t.is)(e,tf)?e:void 0,this.dialectConfig=(0,t.is)(e,tf)?void 0:e}$with=(e,t)=>{let i=this;return{as:n=>("function"==typeof n&&(n=n(i)),new Proxy(new eF.WithSubquery(n.getSQL(),t??("getSelectedFields"in n?n.getSelectedFields()??{}:{}),e,!0),new eV({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){let t=this;return{select:function(i){return new tv({fields:i??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(e){return new tv({fields:e??void 0,session:void 0,dialect:t.getDialect(),distinct:!0})},selectDistinctOn:function(e,i){return new tv({fields:i??void 0,session:void 0,dialect:t.getDialect(),distinct:{on:e}})}}}select(e){return new tv({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new tv({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}selectDistinctOn(e,t){return new tv({fields:t??void 0,session:void 0,dialect:this.getDialect(),distinct:{on:e}})}getDialect(){return this.dialect||(this.dialect=new tf(this.dialectConfig)),this.dialect}}class tj{constructor(e,t){this.name=e,this.schema=t}static [t.entityKind]="PgDefaultViewBuilderCore";config={};with(e){return this.config.with=e,this}}class tL extends tj{static [t.entityKind]="PgViewBuilder";as(e){"function"==typeof e&&(e=e(new tD));let t=new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),i=new Proxy(e.getSelectedFields(),t);return new Proxy(new tU({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:i,query:e.getSQL().inlineParams()}}),t)}}
7class tO extends tj{static [t.entityKind]="PgManualViewBuilder";columns;constructor(e,t,i){super(e,i),this.columns=(0,V.getTableColumns)(((e,t)=>eA(e,t,void 0,void 0))(e,t))}existing(){return new Proxy(new tU({pgConfig:void 0,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new tU({pgConfig:this.config,config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:e.inlineParams()}}),new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}}class tQ{constructor(e,t){this.name=e,this.schema=t}static [t.entityKind]="PgMaterializedViewBuilderCore";config={};using(e){return this.config.using=e,this}with(e){return this.config.with=e,this}tablespace(e){return this.config.tablespace=e,this}withNoData(){return this.config.withNoData=!0,this}}class tF extends tQ{static [t.entityKind]="PgMaterializedViewBuilder";as(e){"function"==typeof e&&(e=e(new tD));let t=new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}),i=new Proxy(e.getSelectedFields(),t);return new Proxy(new tM({pgConfig:{with:this.config.with,using:this.config.using,tablespace:this.config.tablespace,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:i,query:e.getSQL().inlineParams()}}),t)}}class tV extends tQ{static [t.entityKind]="PgManualMaterializedViewBuilder";columns;constructor(e,t,i){super(e,i),this.columns=(0,V.getTableColumns)(((e,t)=>eA(e,t,void 0,void 0))(e,t))}existing(){return new Proxy(new tM({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:void 0}}),new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}as(e){return new Proxy(new tM({pgConfig:{tablespace:this.config.tablespace,using:this.config.using,with:this.config.with,withNoData:this.config.withNoData},config:{name:this.name,schema:this.schema,selectedFields:this.columns,query:e.inlineParams()}}),new eV({alias:this.name,sqlBehavior:"error",sqlAliasedBehavior:"alias",replaceOriginalName:!0}))}}class tU extends th{static [t.entityKind]="PgView";[tx];constructor({pgConfig:e,config:t}){super(t),e&&(this[tx]={with:e.with})}}let tR=Symbol.for("drizzle:PgMaterializedViewConfig");class tM extends th{static [t.entityKind]="PgMaterializedView";[tR];constructor({pgConfig:e,config:t}){super(t),this[tR]={with:e?.with,using:e?.using,tablespace:e?.tablespace,withNoData:e?.withNoData}}}class tE{constructor(e){this.schemaName=e}static [t.entityKind]="PgSchema";table=(e,t,i)=>eA(e,t,i,this.schemaName);view=(e,t)=>{var i;return i=this.schemaName,t?new tO(e,t,i):new tL(e,i)};materializedView=(e,t)=>{var i;return i=this.schemaName,t?new tV(e,t,i):new tF(e,i)};enum(e,t){return Array.isArray(t)?(0,n.pgEnumWithSchema)(e,[...t],this.schemaName):(0,n.pgEnumObjectWithSchema)(e,t,this.schemaName)}sequence=(e,t)=>(0,r.pgSequenceWithSchema)(e,t,this.schemaName);getSQL(){return new i.SQL([i.sql.identifier(this.schemaName)])}shouldOmitSQLParens(){return!0}}function tJ(e){if("public"===e)throw Error("You can't specify 'public' as schema name. Postgres is using public schema by default. If you want to use 'public' schema, just use pgTable() instead of creating a schema");return new tE(e)}e.s(["pgSchema",0,tJ],152484);let tG=tJ("core"),tX=(0,d.customType)({dataType:()=>"geometry(MultiPolygon,4326)"}),tW=tG.table("cities",{id:el().defaultRandom().primaryKey().notNull(),slug:E().notNull(),label:E().notNull(),stateCode:E(),countryCode:E().notNull(),latitude:(0,S.numeric)().notNull(),longitude:(0,S.numeric)().notNull(),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,tS.unique)("core_cities_slug_key").on(e.slug),(0,tS.unique)("core_cities_lat_lng_key").on(e.latitude,e.longitude),(0,tw.index)("core_cities_label_trgm_idx").using("gin",e.label.op("gin_trgm_ops"))]);tG.table("city_aliases",{id:el().defaultRandom().primaryKey().notNull(),cityId:el().notNull(),aliasSlug:E().notNull(),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,tS.unique)("core_city_aliases_alias_slug_key").on(e.aliasSlug),(0,tw.index)("core_city_aliases_city_id_idx").using("btree",e.cityId),(0,tN.foreignKey)({columns:[e.cityId],foreignColumns:[tW.id],name:"core_city_aliases_city_id_fkey"})]),tG.table("city_external_ids",{id:el().defaultRandom().primaryKey().notNull(),cityId:el().notNull(),provider:E().notNull(),externalId:E().notNull(),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,tS.unique)("core_city_external_ids_provider_external_id_key").on(e.provider,e.externalId),(0,tw.index)("core_city_external_ids_city_id_idx").using("btree",e.cityId),(0,tN.foreignKey)({columns:[e.cityId],foreignColumns:[tW.id],name:"core_city_external_ids_city_id_fkey"})]);let tH=tG.table("metros",{id:el().defaultRandom().primaryKey().notNull(),slug:E().notNull(),label:E().notNull(),countryCode:E().notNull(),anchorCityId:el(),latitude:(0,S.numeric)().notNull(),longitude:(0,S.numeric)().notNull(),externalProvider:E(),externalId:E(),sourceVersion:E(),searchAliases:E().array().notNull().default([]),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,tS.unique)("core_metros_slug_key").on(e.slug),(0,tS.unique)("core_metros_external_provider_external_id_key").on(e.externalProvider,e.externalId),(0,tw.index)("core_metros_country_code_idx").using("btree",e.countryCode),(0,tw.index)("core_metros_label_trgm_idx").using("gin",e.label.op("gin_trgm_ops")),(0,tN.foreignKey)({columns:[e.anchorCityId],foreignColumns:[tW.id],name:"core_metros_anchor_city_id_fkey"})]);tG.table("us_zip_areas",{zipCode:E().primaryKey().notNull(),latitude:(0,S.numeric)().notNull(),longitude:(0,S.numeric)().notNull(),boundary:tX().notNull(),sourceVersion:E().notNull(),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>
7[(0,tw.index)("core_us_zip_areas_boundary_gist_idx").using("gist",e.boundary)]),tG.table("metro_cities",{metroId:el().notNull(),cityId:el().notNull(),isAnchor:(0,l.boolean)().notNull().default(!1),createdAt:er({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[eG({columns:[e.metroId,e.cityId],name:"core_metro_cities_pkey"}),(0,tw.index)("core_metro_cities_city_id_idx").using("btree",e.cityId),(0,tN.foreignKey)({columns:[e.metroId],foreignColumns:[tH.id],name:"core_metro_cities_metro_id_fkey"}).onDelete("cascade"),(0,tN.foreignKey)({columns:[e.cityId],foreignColumns:[tW.id],name:"core_metro_cities_city_id_fkey"}).onDelete("cascade")]),e.s(["citiesInCore",0,tW],876972)},108373,683865,165846,269330,839246,395101,293062,466908,297392,788715,948260,675313,315,43489,905664,e=>{"use strict";let t,i;var n,r=e.i(957597),s=e.i(817422);let a=Symbol.for("drizzle:entityKind");function o(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,a))throw Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let i=Object.getPrototypeOf(e).constructor;if(i)for(;i;
7){if(a in i&&i[a]===t[a])return!0;i=Object.getPrototypeOf(i)}return!1}Symbol.for("drizzle:hasOwnEntityKind"),e.s(["entityKind",0,a,"is",0,o],683865);let l=Symbol.for("drizzle:Name"),u=Symbol.for("drizzle:Schema"),c=Symbol.for("drizzle:Columns"),d=Symbol.for("drizzle:ExtraConfigColumns"),m=Symbol.for("drizzle:OriginalName"),g=Symbol.for("drizzle:BaseName"),p=Symbol.for("drizzle:IsAlias"),h=Symbol.for("drizzle:ExtraConfigBuilder"),f=Symbol.for("drizzle:IsDrizzleTable");class y{static [a]="Table";static Symbol={Name:l,Schema:u,OriginalName:m,Columns:c,ExtraConfigColumns:d,BaseName:g,IsAlias:p,ExtraConfigBuilder:h};[l];[m];[u];[c];[d];[g];[p]=!1;[f]=!0;[h]=void 0;constructor(e,t,i){this[l]=this[m]=e,this[u]=t,this[g]=i}}function b(e){return"object"==typeof e&&null!==e&&f in e}e.s(["IsAlias",0,p,"Schema",0,u,"Table",0,y,"getTableName",0,function(e){return e[l]},"getTableUniqueName",0,function(e){return`${e[u]??"public"}.${e[l]}`},"isTable",0,b],165846);class _{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static [a]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}e.s(["Column",0,_],269330);class N{static [a]="ColumnBuilder";config;constructor(e,t,i){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:i,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}class w{static [a]="PgForeignKeyBuilder";reference;_onUpdate="no action";_onDelete="no action";constructor(e,t){this.reference=()=>{let{name:t,columns:i,foreignColumns:n}=e();return{name:t,columns:i,foreignTable:n[0].table,foreignColumns:n}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=void 0===e?"no action":e,this}onDelete(e){return this._onDelete=void 0===e?"no action":e,this}build(e){return new S(e,this)}}class S{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static [a]="PgForeignKey";reference;onUpdate;onDelete;getName(){let{name:e,columns:t,foreignColumns:i}=this.reference(),n=t.map(e=>e.name),r=i.map(e=>e.name),s=[this.table[l],...n,i[0].table[l],...r];return e??`${s.join("_")}_fk`}}function x(e,...t){return e(...t)}function z(e,t){return`${e[l]}_${t.join("_")}_unique`}e.s(["ForeignKeyBuilder",0,w,"foreignKey",0,function(e){return new w(function(){let{name:t,columns:i,foreignColumns:n}=e;return{name:t,columns:i,foreignColumns:n}})}],839246);class v{constructor(e,t){this.name=t,this.columns=e}static [a]="PgUniqueConstraintBuilder";columns;nullsNotDistinctConfig=!1;nullsNotDistinct(){return this.nullsNotDistinctConfig=!0,this}build(e){return new T(e,this.columns,this.nullsNotDistinctConfig,this.name)}}class C{static [a]="PgUniqueOnConstraintBuilder";name;constructor(e){this.name=e}on(...e){return new v(e,this.name)}}class T{constructor(e,t,i,n){this.table=e,this.columns=t,this.name=n??z(this.table,this.columns.map(e=>e.name)),this.nullsNotDistinct=i}static [a]="PgUniqueConstraint";columns;name;nullsNotDistinct=!1;getName(){return this.name}}function P(e,t,i){for(let n=t;n<e.length;n++){let r=e[n];if("\\"===r){n++;continue}if('"'===r)return[e.slice(t,n).replace(/\\/g,""),n+1];if(!i&&(","===r||"}"===r))return[e.slice(t,n).replace(/\\/g,""),n]}return[e.slice(t).replace(/\\/g,""),e.length]}e.s(["UniqueConstraintBuilder",0,v,"unique",0,function(e){return new C(e)},"uniqueKeyName",0,z],395101);class q extends N{foreignKeyConfigs=[];static [a]="PgColumnBuilder";array(e){return new A(this.config.name,this,e)}references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e,t){return this.config.isUnique=!0,this.config.uniqueName=e,this.config.uniqueType=t?.nulls,this}generatedAlwaysAs(e){return this.config.generated={as:e,type:"always",mode:"stored"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:i,actions:n})=>x((i,n)=>{let r=new w(()=>({columns:[e],foreignColumns:[i()]}));return n.onUpdate&&r.onUpdate(n.onUpdate),n.onDelete&&r.onDelete(n.onDelete),r.build(t)},i,n))}buildExtraConfigColumn(e){return new $(e,this.config)}}class I extends _{constructor(e,t){t.uniqueName||(t.uniqueName=z(e,[t.name])),super(e,t),this.table=e}static [a]="PgColumn"}
7class $ extends I{static [a]="ExtraConfigColumn";getSQLType(){return this.getSQLType()}indexConfig={order:this.config.order??"asc",nulls:this.config.nulls??"last",opClass:this.config.opClass};defaultConfig={order:"asc",nulls:"last",opClass:void 0};asc(){return this.indexConfig.order="asc",this}desc(){return this.indexConfig.order="desc",this}nullsFirst(){return this.indexConfig.nulls="first",this}nullsLast(){return this.indexConfig.nulls="last",this}op(e){return this.indexConfig.opClass=e,this}}class A extends q{static [a]="PgArrayBuilder";constructor(e,t,i){super(e,"array","PgArray"),this.config.baseBuilder=t,this.config.size=i}build(e){let t=this.config.baseBuilder.build(e);return new k(e,this.config,t)}}class k extends I{constructor(e,t,i,n){super(e,t),this.baseColumn=i,this.range=n,this.size=t.size}size;static [a]="PgArray";getSQLType(){return`${this.baseColumn.getSQLType()}[${"number"==typeof this.size?this.size:""}]`}mapFromDriverValue(e){return"string"==typeof e&&(e=function(e){let[t]=function e(t,i=0){let n=[],r=i,s=!1;for(;r<t.length;){let a=t[r];if(","===a){(s||r===i)&&n.push(""),s=!0,r++;continue}if(s=!1,"\\"===a){r+=2;continue}if('"'===a){let[e,i]=P(t,r+1,!0);n.push(e),r=i;continue}if("}"===a)return[n,r+1];if("{"===a){let[i,s]=e(t,r+1);n.push(i),r=s;continue}let[o,l]=P(t,r,!1);n.push(o),r=l}return[n,r]}(e,1);return t}(e)),e.map(e=>this.baseColumn.mapFromDriverValue(e))}mapToDriverValue(e,t=!1){let i=e.map(e=>null===e?null:o(this.baseColumn,k)?this.baseColumn.mapToDriverValue(e,!0):this.baseColumn.mapToDriverValue(e));return t?i:function e(t){return`{${t.map(t=>Array.isArray(t)?e(t):"string"==typeof t?`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:`${t}`).join(",")}}`}(i)}}e.s(["IndexedColumn",0,class{static [a]="IndexedColumn";constructor(e,t,i,n){this.name=e,this.keyAsName=t,this.type=i,this.indexConfig=n}name;keyAsName;type;indexConfig},"PgColumn",0,I,"PgColumnBuilder",0,q],293062);class B extends q{static [a]="PgEnumObjectColumnBuilder";constructor(e,t){super(e,"string","PgEnumObjectColumn"),this.config.enum=t}build(e){return new K(e,this.config)}}class K extends I{static [a]="PgEnumObjectColumn";enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}let D=Symbol.for("drizzle:isPgEnum");function j(e){return!!e&&"function"==typeof e&&D in e&&!0===e[D]}class L extends q{static [a]="PgEnumColumnBuilder";constructor(e,t){super(e,"string","PgEnumColumn"),this.config.enum=t}build(e){return new O(e,this.config)}}class O extends I{static [a]="PgEnumColumn";enum=this.config.enum;enumValues=this.config.enum.enumValues;constructor(e,t){super(e,t),this.enum=t.enum}getSQLType(){return this.enum.enumName}}e.s(["isPgEnum",0,j,"pgEnumObjectWithSchema",0,function(e,t,i){let n=Object.assign(e=>new B(e??"",n),{enumName:e,enumValues:Object.values(t),schema:i,[D]:!0});return n},"pgEnumWithSchema",0,function(e,t,i){let n=Object.assign(e=>new L(e??"",n),{enumName:e,enumValues:t,schema:i,[D]:!0});return n}],466908);class Q{static [a]="Subquery";constructor(e,t,i,n=!1,r=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:i,isWith:n,usedTables:r}}}e.s(["Subquery",0,Q,"WithSubquery",0,class extends Q{static [a]="WithSubquery"}],297392);let F={startActiveSpan:(e,n)=>t?(i||(i=t.trace.getTracer("drizzle-orm","0.44.7")),x((t,i)=>i.startActiveSpan(e,e=>{try{return n(e)}catch(i){throw e.setStatus({code:t.SpanStatusCode.ERROR,message:i instanceof Error?i.message:"Unknown error"}),i}finally{e.end()}}),t,i)):n()};e.s(["tracer",0,F],788715);let V=Symbol.for("drizzle:ViewBaseConfig");function U(e){return null!=e&&"function"==typeof e.getSQL}e.s(["ViewBaseConfig",0,V],948260);class R{static [a]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new M([this])}}class M{constructor(e){for(const t of(this.queryChunks=e,e))if(o(t,y)){const e=t[y.Symbol.Schema];this.usedTables.push(void 0===e?t[y.Symbol.Name]:e+"."+t[y.Symbol.Name])}}static [a]="SQL";decoder=J;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return F.startActiveSpan("drizzle.buildSQL",t=>{let i=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":i.sql,"drizzle.query.params":JSON.stringify(i.params)}),i})}buildQueryFromSourceParams(e,t){let i=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:n,escapeName:r,escapeParam:s,prepareTyping:a,inlineParams:l,paramStartIndex:u}=i;var c=e.map(e=>{if(o(e,R))return{sql:e.value.join(""),params:[]};if(o(e,E))return{sql:r(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){let t=[new R("(")];for(let[i,n]of e.entries())t.push(n),i<e.length-1&&t.push(new R(", "));return t.push(new R(")")),this.buildQueryFromSourceParams(t,i)}if(o(e,M))return this.buildQueryFromSourceParams(e.queryChunks,{...i,inlineParams:l||e.shouldInlineParams});if(o(e,y)){let t=e[y.Symbol.Schema],i=e[y.Symbol.Name];return{sql:void 0===t||e[p]?r(i):r(t)+"."+r(i),params:[]}}if(o(e,_)){let i=n.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:r(i),params:[]};let s=e.table[y.Symbol.Schema];return{sql:e.table[p]||void 0===s?r(e.table[y.Symbol.Name])+"."+r(i):r(s)+"."+r(e.table[y.Symbol.Name])+"."+r(i),params:[]}}if(o(e,Z)){let t=e[V].schema,i=e[V].name;return{sql:void 0===t||e[V].isAlias?r(i):r(t)+"."+r(i),params:[]}}if(o(e,X)){if(o(e.value,H))return{sql:s(u.value++,e),params:[e],typings:["none"]};let t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if(o(t,M))return this.buildQueryFromSourceParams([t],i);if(l)return{sql:this.mapInlineParam(t,i),params:[]};let n=["none"];return a&&(n=[a(e.encoder)]),{sql:s(u.value++,t),params:[t],typings:n}}return o(e,H)?{sql:s(u.value++,e),params:[e],typings:["none"]}:o(e,M.Aliased)&&void 0!==e.fieldAlias?{sql:r(e.fieldAlias),params:[]}:o(e,Q)?e._.isWith?{sql:r(e._.alias),params:[]}:this.buildQueryFromSourceParams([new R("("),e._.sql,new R(") "),new E(e._.alias)],i):j(e)?e.schema?{sql:r(e.schema)+"."+r(e.enumName),params:[]}:{sql:r(e.enumName),params:[]}:U(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],i):this.buildQueryFromSourceParams([new R("("),e.getSQL(),new R(")")],i):l?{sql:this.mapInlineParam(e,i),params:[]}:{sql:s(u.value++,e),params:[e],typings:["none"]}});let d={sql:"",params:[]};for(let e of c)d.sql+=e.sql,d.params.push(...e.params),e.typings?.length&&(d.typings||(d.typings=[]),d.typings.push(...e.typings));return d}mapInlineParam(e,{escapeString:t}
7){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){let i=e.toString();return"[object Object]"===i?t(JSON.stringify(e)):t(i)}throw Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new M.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class E{constructor(e){this.value=e}static [a]="Name";brand;getSQL(){return new M([this])}}let J={mapFromDriverValue:e=>e},G={mapToDriverValue:e=>e};({...J,...G});class X{constructor(e,t=G){this.value=e,this.encoder=t}static [a]="Param";brand;getSQL(){return new M([this])}}function W(e,...t){let i=[];for(let[n,r]of((t.length>0||e.length>0&&""!==e[0])&&i.push(new R(e[0])),t.entries()))i.push(r,new R(e[n+1]));return new M(i)}(n=W||(W={})).empty=function(){return new M([])},n.fromList=function(e){return new M(e)},n.raw=function(e){return new M([new R(e)])},n.join=function(e,t){let i=[];for(let[n,r]of e.entries())n>0&&void 0!==t&&i.push(t),i.push(r);return new M(i)},n.identifier=function(e){return new E(e)},n.placeholder=function(e){return new H(e)},n.param=function(e,t){return new X(e,t)},(M||(M={})).Aliased=class e{constructor(e,t){this.sql=e,this.fieldAlias=t}static [a]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new e(this.sql,this.fieldAlias)}};class H{constructor(e){this.name=e}static [a]="Placeholder";getSQL(){return new M([this])}}let Y=Symbol.for("drizzle:IsDrizzleView");class Z{static [a]="View";[V];[Y]=!0;constructor({name:e,schema:t,selectedFields:i,query:n}){this[V]={name:e,originalName:e,schema:t,selectedFields:i,query:n,isExisting:!n,isAlias:!1}}getSQL(){return new M([this])}}function ee(e){return"object"==typeof e&&null!==e&&Y in e}function et(e){return e[y.Symbol.Columns]}function ei(e){return e[V].selectedFields}_.prototype.getSQL=function(){return new M([this])},y.prototype.getSQL=function(){return new M([this])},Q.prototype.getSQL=function(){return new M([this])},e.s(["Param",0,X,"Placeholder",0,H,"SQL",0,M,"StringChunk",0,R,"View",0,Z,"isDriverValueEncoder",0,function(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue},"isSQLWrapper",0,U,"isView",0,ee,"sql",0,W],675313),"u"<typeof TextDecoder||new TextDecoder,e.s(["applyMixins",0,function(e,t){for(let i of t)for(let t of Object.getOwnPropertyNames(i.prototype))"constructor"!==t&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(i.prototype,t)||Object.create(null))},"getColumnNameAndConfig",0,function(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}},"getTableColumns",0,et,"getTableLikeName",0,function(e){return o(e,Q)?e._.alias:o(e,Z)?e[V].name:o(e,M)?void 0:e[y.Symbol.IsAlias]?e[y.Symbol.Name]:e[y.Symbol.BaseName]},"getViewSelectedFields",0,ei,"haveSameKeys",0,function(e,t){let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(let[e,t]of i.entries())if(t!==n[e])return!1;return!0},"orderSelectedFields",0,function e(t,i){return Object.entries(t).reduce((t,[n,r])=>{if("string"!=typeof n)return t;let s=i?[...i,n]:[n];return o(r,_)||o(r,M)||o(r,M.Aliased)?t.push({path:s,field:r}):o(r,y)?t.push(...e(r[y.Symbol.Columns],s)):t.push(...e(r,s)),t},[])}],315);let en={INT8_MIN:-128,INT8_MAX:127,INT8_UNSIGNED_MAX:255,INT16_MIN:-32768,INT16_MAX:32767,INT16_UNSIGNED_MAX:65535,INT24_MIN:-8388608,INT24_MAX:8388607,INT24_UNSIGNED_MAX:0xffffff,INT32_MIN:-0x80000000,INT32_MAX:0x7fffffff,INT32_UNSIGNED_MAX:0xffffffff,INT48_MIN:-0x800000000000,INT48_MAX:0x7fffffffffff,INT48_UNSIGNED_MAX:0xffffffffffff,INT64_MIN:-0x8000000000000000n,INT64_MAX:0x7fffffffffffffffn,INT64_UNSIGNED_MAX:0xffffffffffffffffn};function er(e,t){return t.includes(e.columnType)}function es(e){return"enumValues"in e&&Array.isArray(e.enumValues)&&e.enumValues.length>0}let ea=s.z.union([s.z.string(),s.z.number(),s.z.boolean(),s.z.null()]),eo=s.z.union([ea,s.z.record(s.z.string(),s.z.any()),s.z.array(s.z.any())]),el=s.z.custom(e=>e instanceof r.Buffer);function eu(e){return b(e)?et(e):ei(e)}function ec(e,t,i,n){let r={};for(let[a,l]of Object.entries(e)){if(!o(l,_)&&!o(l,M)&&!o(l,M.Aliased)&&"object"==typeof l){let e=b(l)||ee(l)?eu(l):l;r[a]=ec(e,t[a]??{},i,n);continue}let e=t[a];if(void 0!==e&&"function"!=typeof e){r[a]=e;continue}let u=o(l,_)?l:void 0,c=u?function e(t,i){let n,r=i?.zodInstance??s.z,a=i?.coerce??{};return es(t)&&(n=t.enumValues.length?r.enum(t.enumValues):r.string()),n||(er(t,["PgGeometry","PgPointTuple"])?n=r.tuple([r.number(),r.number()]):er(t,["PgGeometryObject","PgPointObject"])?n=r.object({x:r.number(),y:r.number()}):er(t,["PgHalfVector","PgVector"])?(n=r.array(r.number()),n=t.dimensions?n.length(t.dimensions):n):er(t,["PgLine"])?n=r.tuple([r.number(),r.number(),r.number()]):er(t,["PgLineABC"])?n=r.object({a:r.number(),b:r.number(),c:r.number()}):er(t,["PgArray"])?(n=r.array(e(t.baseColumn,i)),n=t.size?n.length(t.size):n):"array"===t.dataType?n=r.array(r.any()):"number"===t.dataType?n=function(e,t,i){let n,r,s=e.getSQLType().includes("unsigned"),a=!1;er(e,["MySqlTinyInt","SingleStoreTinyInt"])?(n=s?0:en.INT8_MIN,r=s?en.INT8_UNSIGNED_MAX:en.INT8_MAX,a=!0):er(e,["PgSmallInt","PgSmallSerial","MySqlSmallInt","SingleStoreSmallInt"])?(n=s?0:en.INT16_MIN,r=s?en.INT16_UNSIGNED_MAX:en.INT16_MAX,a=!0):er(e,["PgReal","MySqlFloat","MySqlMediumInt","SingleStoreMediumInt","SingleStoreFloat"])?(n=s?0:en.INT24_MIN,r=s?en.INT24_UNSIGNED_MAX:en.INT24_MAX,a=er(e,["MySqlMediumInt","SingleStoreMediumInt"])):er(e,["PgInteger","PgSerial","MySqlInt","SingleStoreInt"])?(n=s?0:en.INT32_MIN,r=s?en.INT32_UNSIGNED_MAX:en.INT32_MAX,a=!0):er(e,["PgDoublePrecision","MySqlReal","MySqlDouble","SingleStoreReal","SingleStoreDouble","SQLiteReal"])?(n=s?0:en.INT48_MIN,r=s?en.INT48_UNSIGNED_MAX:en.INT48_MAX):er(e,["PgBigInt53","PgBigSeri
7al53","MySqlBigInt53","MySqlSerial","SingleStoreBigInt53","SingleStoreSerial","SQLiteInteger"])?(n=(s=s||er(e,["MySqlSerial","SingleStoreSerial"]))?0:Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER,a=!0):er(e,["MySqlYear","SingleStoreYear"])?(n=1901,r=2155,a=!0):(n=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER);let o=!0===i||i?.number?a?t.coerce.number():t.coerce.number().int():a?t.int():t.number();return o.gte(n).lte(r)}(t,r,a):"bigint"===t.dataType?n=function(e,t,i){let n=e.getSQLType().includes("unsigned"),r=n?0n:en.INT64_MIN,s=n?en.INT64_UNSIGNED_MAX:en.INT64_MAX;return(!0===i||i?.bigint?t.coerce.bigint():t.bigint()).gte(r).lte(s)}(t,r,a):"boolean"===t.dataType?n=!0===a||a.boolean?r.coerce.boolean():r.boolean():"date"===t.dataType?n=!0===a||a.date?r.coerce.date():r.date():"string"===t.dataType?n=function(e,t,i){let n,r;if(er(e,["PgUUID"]))return t.uuid();let s=!1;er(e,["PgVarchar","SQLiteText"])?n=e.length:er(e,["MySqlVarChar","SingleStoreVarChar"])?n=e.length??en.INT16_UNSIGNED_MAX:er(e,["MySqlText","SingleStoreText"])&&(n="longtext"===e.textType?en.INT32_UNSIGNED_MAX:"mediumtext"===e.textType?en.INT24_UNSIGNED_MAX:"text"===e.textType?en.INT16_UNSIGNED_MAX:en.INT8_UNSIGNED_MAX),er(e,["PgChar","MySqlChar","SingleStoreChar"])&&(n=e.length,s=!0),er(e,["PgBinaryVector"])&&(r=/^[01]+$/,n=e.dimensions);let a=!0===i||i?.string?t.coerce.string():t.string();return a=r?a.regex(r):a,n&&s?a.length(n):n?a.max(n):a}(t,r,a):"json"===t.dataType?n=eo:"custom"===t.dataType?n=r.any():"buffer"===t.dataType&&(n=el)),n||(n=r.any()),n}(u,n):s.z.any(),d="function"==typeof e?e(c):c;!i.never(u)&&(r[a]=d,u&&(i.nullable(u)&&(r[a]=r[a].nullable()),i.optional(u)&&(r[a]=r[a].optional())))}return s.z.object(r)}let ed={never:()=>!1,optional:()=>!1,nullable:e=>!e.notNull},em={never:e=>e?.generated?.type==="always"||e?.generatedIdentity?.type==="always",optional:e=>!e.notNull||e.notNull&&e.hasDefault,nullable:e=>!e.notNull};e.s(["createInsertSchema",0,(e,t)=>ec(eu(e),t??{},em),"createSelectSchema",0,(e,t)=>{if(es(e))return((void 0)??s.z).enum(e.enumValues);return ec(eu(e),t??{},ed)}],108373);class eg extends q{static [a]="PgBooleanBuilder";constructor(e){super(e,"boolean","PgBoolean")}build(e){return new ep(e,this.config)}}class ep extends I{static [a]="PgBoolean";getSQLType(){return"boolean"}}e.s(["boolean",0,function(e){return new eg(e??"")}],43489);class eh{constructor(e,t){this.name=e,this.value=t}static [a]="PgCheckBuilder";brand;build(e){return new ef(e,this)}}class ef{constructor(e,t){this.table=e,this.name=t.name,this.value=t.value}static [a]="PgCheck";name;value}e.s(["CheckBuilder",0,eh,"check",0,function(e,t){return new eh(e,t)}],905664)},415469,e=>{"use strict";var t=e.i(817422);t.z.object({north:t.z.number(),south:t.z.number(),east:t.z.number(),west:t.z.number()});let i=t.z.literal("mobileCheckout"),n=t.z.discriminatedUnion("kind",[t.z.object({kind:t.z.literal("restaurants"),sources:t.z.array(t.z.string()).min(1),filterKey:i.optional()}),t.z.object({kind:t.z.literal("hotels"),sources:t.z.array(t.z.string()).min(1)})]);t.z.object({query:t.z.string().trim().min(1).max(160),catalog:n,countryCode:t.z.string().trim().length(2).optional(),limit:t.z.number().int().min(1).max(50).default(20)}),t.z.discriminatedUnion("kind",[t.z.object({kind:t.z.literal("city"),cityId:t.z.string().uuid()}),t.z.object({kind:t.z.literal("metro"),metroId:t.z.string().uuid()}),t.z.object({kind:t.z.literal("state"),stateCode:t.z.string().regex(/^[A-Z]{2}$/)}),t.z.object({kind:t.z.literal("us_zip"),zipCode:t.z.string().regex(/^\d{5}$/)})]),e.s(["restaurantLocationSearchFilterKeySchema",0,i])},9045,155705,172009,e=>{"use strict";var t=e.i(817422),i=e.i(415469),n=e.i(709404),r=e.i(108373),s=e.i(43489),a=e.i(905664),o=e.i(839246),l=e.i(422308),u=e.i(849304),c=e.i(723007),d=e.i(396695),m=e.i(519442),g=e.i(152484),p=e.i(320874),h=e.i(866945),f=e.i(69218),y=e.i(395101),b=e.i(402903),_=e.i(675313),N=e.i(876972);let w=(0,g.pgSchema)("restaurants"),S=w.table("restaurants",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),legacyConvexId:(0,h.text)(),canonicalSource:(0,h.text)(),name:(0,h.text)().notNull(),latitude:(0,m.numeric)().notNull(),longitude:(0,m.numeric)().notNull(),timeZone:(0,h.text)(),streetAddress:(0,h.text)().notNull(),city:(0,h.text)().notNull(),state:(0,h.text)(),postalCode:(0,h.text)(),countryCode:(0,h.text)().notNull(),neighborhood:(0,h.text)(),cuisines:(0,h.text)().array().notNull().default([]),rating:(0,m.numeric)(),userRating
7Count:(0,c.integer)(),priceRange:(0,h.text)(),priceLevel:(0,c.integer)(),estimatedPricePerPerson:(0,h.text)(),seating:(0,h.text)().array(),photoUrls:(0,h.text)().array(),phoneNumber:(0,h.text)(),website:(0,h.text)(),googlePlaceId:(0,h.text)(),cityId:(0,b.uuid)(),canonicalCityVerifiedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}),canonicalAddressVerifiedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}),location:(0,l.geometry)({type:"point",mode:"xy",srid:4326}).generatedAlwaysAs(()=>_.sql`st_setsrid(st_makepoint(${S.longitude}::double precision, ${S.latitude}::double precision), 4326)`),createdAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"})},e=>[(0,u.index)("rest_restaurants_location_gist").using("gist",e.location),(0,u.index)("rest_restaurants_lat_lng_idx").using("btree",e.latitude,e.longitude),(0,u.index)("rest_restaurants_city_idx").using("btree",e.city),(0,u.index)("rest_restaurants_city_id_idx").using("btree",e.cityId),(0,y.unique)("rest_restaurants_google_place_id_key").on(e.googlePlaceId),(0,y.unique)("rest_restaurants_legacy_convex_id_key").on(e.legacyConvexId),(0,o.foreignKey)({columns:[e.cityId],foreignColumns:[N.citiesInCore.id],name:"rest_restaurants_city_id_fkey"})]),x=w.table("restaurant_source_cities",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),source:(0,h.text)().notNull(),filterKey:(0,h.text)().notNull(),citySlug:(0,h.text)().notNull(),cityLabel:(0,h.text)().notNull(),stateCode:(0,h.text)(),countryCode:(0,h.text)().notNull(),latitude:(0,m.numeric)().notNull(),longitude:(0,m.numeric)().notNull(),restaurantCount:(0,c.integer)().notNull().default(0),cityId:(0,b.uuid)(),updatedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,y.unique)("rest_source_cities_source_filter_city_key").on(e.source,e.filterKey,e.citySlug),(0,u.index)("rest_source_cities_source_filter_country_idx").using("btree",e.source,e.filterKey,e.countryCode),(0,u.index)("rest_source_cities_city_label_trgm_idx").using("gin",e.cityLabel.op("gin_trgm_ops")),(0,u.index)("rest_source_cities_city_id_idx").using("btree",e.cityId),(0,u.uniqueIndex)("rest_source_cities_source_filter_cityid_key").on(e.source,e.filterKey,e.cityId).where(_.sql`${e.cityId} IS NOT NULL`),(0,o.foreignKey)({columns:[e.cityId],foreignColumns:[N.citiesInCore.id],name:"rest_source_cities_city_id_fkey"})]),z=w.table("restaurant_sources",{source:(0,h.text)().notNull(),restaurantId:(0,b.uuid)().notNull(),sourceRestaurantId:(0,h.text)().notNull(),isActive:(0,s.boolean)().default(!0).notNull(),bookingUrl:(0,h.text)(),metadata:(0,d.jsonb)().$type(),firstSeenAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),lastSeenAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),removedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}),biltMobileCheckout:(0,s.boolean)(),hasGiftCard:(0,s.boolean)().default(!1).notNull(),sourceCityId:(0,b.uuid)(),createdAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"})},e=>[(0,p.primaryKey)({columns:[e.source,e.restaurantId],name:"rest_restaurant_sources_pkey"}),(0,y.unique)("rest_restaurant_sources_source_source_restaurant_id_key").on(e.source,e.sourceRestaurantId),(0,u.index)("rest_restaurant_sources_restaurant_id_idx").using("btree",e.restaurantId),(0,u.index)("rest_restaurant_sources_source_is_active_idx").using("btree",e.source,e.isActive),(0,u.index)("rest_restaurant_sources_source_first_seen_at_idx").using("btree",e.source,e.firstSeenAt),(0,u.index)("rest_restaurant_sources_source_last_seen_at_idx").using("btree",e.source,e.lastSeenAt),(0,u.index)("rest_restaurant_sources_source_city_id_idx").using("btree",e.sourceCityId),(0,u.index)("rest_restaurant_sources_has_gift_card_idx").using("btree",e.restaurantId,e.source).where(_.sql`is_active = true AND has_gift_card = true`),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_restaurant_sources_restaurant_id_fkey"}),(0,o.foreignKey)({columns:[e.sourceCityId],foreignColumns:[x.id],name:"rest_restaurant_sources_source_city_id_fkey"})]),v=w.table("restaurant_source_snapshots",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),source:(0,h.text)().notNull(),filterKey:(0,h.text)(),scrapedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).notNull(),totalCount:(0,c.integer)().notNull(),addedCount:(0,c.integer)().notNull(),removedCount:(0,c.integer)().notNull(),addedRestaurantIds:(0,d.jsonb)().$type(),removedRestaurantIds:(0,d.jsonb)().$type(),rawDataS3Url:(0,h.text)("raw_data_s3_url"),createdAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,u.index)("rest_source_snapshots_source_filter_scraped_idx").using("btree",e.source,e.filterKey,e.scrapedAt.desc()),(0,u.
7index)("rest_source_snapshots_source_scraped_idx").using("btree",e.source,e.scrapedAt.desc())]),C=w.table("restaurant_source_snapshot_changes",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),snapshotId:(0,b.uuid)("snapshot_id").notNull(),source:(0,h.text)().notNull(),filterKey:(0,h.text)("filter_key"),restaurantId:(0,b.uuid)("restaurant_id").notNull(),changeType:(0,h.text)("change_type").notNull(),scrapedAt:(0,f.timestamp)("scraped_at",{withTimezone:!0,mode:"string"}).notNull(),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,u.index)("rest_snapshot_changes_snapshot_type_idx").using("btree",e.snapshotId,e.changeType,e.restaurantId),(0,u.index)("rest_snapshot_changes_source_type_scraped_idx").using("btree",e.source,e.filterKey,e.changeType,e.scrapedAt.desc()),(0,o.foreignKey)({columns:[e.snapshotId],foreignColumns:[v.id],name:"rest_snapshot_changes_snapshot_id_fkey"}),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_snapshot_changes_restaurant_id_fkey"}),(0,a.check)("rest_snapshot_changes_change_type_check",_.sql`${e.changeType} IN ('added', 'removed')`)]),T=w.table("restaurant_place_aliases",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),restaurantId:(0,b.uuid)().notNull(),provider:(0,h.text)().notNull(),providerPlaceId:(0,h.text)().notNull(),confidence:(0,m.numeric)(),rawName:(0,h.text)(),rawAddress:(0,h.text)(),rawLatitude:(0,m.numeric)(),rawLongitude:(0,m.numeric)(),metadata:(0,d.jsonb)().$type(),firstSeenAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),lastSeenAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),createdAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,y.unique)("rest_place_aliases_provider_place_key").on(e.provider,e.providerPlaceId),(0,u.index)("rest_place_aliases_restaurant_id_idx").using("btree",e.restaurantId),(0,u.index)("rest_place_aliases_provider_idx").using("btree",e.provider),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_place_aliases_restaurant_id_fkey"})]),P=w.table("restaurant_map_entries",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),restaurantId:(0,b.uuid)().notNull(),source:(0,h.text)().notNull(),sourceRestaurantId:(0,h.text)().notNull(),name:(0,h.text)().notNull(),latitude:(0,m.numeric)().notNull(),longitude:(0,m.numeric)().notNull(),timeZone:(0,h.text)(),city:(0,h.text)().notNull(),state:(0,h.text)(),neighborhood:(0,h.text)(),streetAddress:(0,h.text)().notNull(),postalCode:(0,h.text)(),countryCode:(0,h.text)().notNull(),cuisines:(0,h.text)().array().notNull().default([]),rating:(0,m.numeric)(),userRatingCount:(0,c.integer)(),priceRange:(0,h.text)(),priceLevel:(0,c.integer)(),estimatedPricePerPerson:(0,h.text)(),seating:(0,h.text)().array(),photoUrl:(0,h.text)(),phoneNumber:(0,h.text)(),website:(0,h.text)(),googlePlaceId:(0,h.text)(),cityId:(0,b.uuid)(),bookingUrl:(0,h.text)(),metadata:(0,d.jsonb)().$type(),firstSeenAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).notNull(),biltMobileCheckout:(0,s.boolean)(),hasGiftCard:(0,s.boolean)().default(!1).notNull(),location:(0,l.geometry)({type:"point",mode:"xy",srid:4326}).generatedAlwaysAs(()=>_.sql`st_setsrid(st_makepoint(${P.longitude}::double precision, ${P.latitude}::double precision), 4326)`),createdAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)({withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,y.unique)("rest_map_entries_source_restaurant_id_key").on(e.source,e.restaurantId),(0,u.index)("rest_map_entries_source_country_lat_lng_idx").using("btree",e.source,e.countryCode,e.latitude,e.longitude),(0,u.index)("rest_map_entries_source_city_lat_lng_idx").using("btree",e.source,e.city,e.latitude,e.longitude),(0,u.index)("rest_map_entries_source_country_first_seen_idx").using("btree",e.source,e.countryCode,e.firstSeenAt.desc()),(0,u.index)("rest_map_entries_restaurant_id_idx").using("btree",e.restaurantId),(0,u.
7index)("rest_map_entries_location_gist").using("gist",e.location),(0,u.index)("rest_map_entries_name_trgm_idx").using("gin",e.name.op("gin_trgm_ops")),(0,u.index)("rest_map_entries_bilt_mobile_checkout_idx").using("btree",e.biltMobileCheckout).where(_.sql`source = 'bilt' AND bilt_mobile_checkout = true`),(0,u.index)("rest_map_entries_has_gift_card_idx").using("btree",e.restaurantId,e.countryCode,e.source).where(_.sql`has_gift_card = true`),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_map_entries_restaurant_id_fkey"}),(0,u.index)("rest_map_entries_city_id_idx").using("btree",e.cityId),(0,o.foreignKey)({columns:[e.cityId],foreignColumns:[N.citiesInCore.id],name:"rest_map_entries_city_id_fkey"})]),q=w.table("restaurant_reports",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),restaurantId:(0,b.uuid)("restaurant_id"),source:(0,h.text)(),sourceRestaurantId:(0,h.text)("source_restaurant_id"),snapshotId:(0,h.text)("snapshot_id"),mapId:(0,h.text)("map_id"),category:(0,h.text)().notNull(),message:(0,h.text)().notNull(),pageUrl:(0,h.text)("page_url"),reporterId:(0,h.text)("reporter_id"),reporterEmail:(0,h.text)("reporter_email"),posthogDistinctId:(0,h.text)("posthog_distinct_id"),dedupeKey:(0,h.text)("dedupe_key").notNull(),status:(0,h.text)().default("pending").notNull(),reviewedBy:(0,h.text)("reviewed_by"),reviewedAt:(0,f.timestamp)("reviewed_at",{withTimezone:!0,mode:"string"}),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,u.index)("rest_reports_status_created_idx").using("btree",e.status,e.createdAt.desc()),(0,u.index)("rest_reports_restaurant_created_idx").using("btree",e.restaurantId,e.createdAt.desc()),(0,u.index)("rest_reports_source_listing_idx").using("btree",e.source,e.sourceRestaurantId),(0,y.unique)("rest_reports_dedupe_key").on(e.dedupeKey),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_reports_restaurant_id_fkey"}),(0,a.check)("rest_reports_status_check",_.sql`${e.status} IN ('pending', 'verified', 'rejected')`),(0,a.check)("rest_reports_category_check",_.sql`${e.category} IN ('restaurant_closed', 'provider_not_working', 'broken_link', 'wrong_location', 'duplicate', 'other')`)]),I=w.table("restaurant_map_suppressions",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),effect:(0,h.text)().notNull(),reasonCode:(0,h.text)("reason_code").notNull(),reasonDetail:(0,h.text)("reason_detail"),restaurantId:(0,b.uuid)("restaurant_id"),source:(0,h.text)(),sourceRestaurantId:(0,h.text)("source_restaurant_id"),capability:(0,h.text)(),restaurantIdAtDecision:(0,b.uuid)("restaurant_id_at_decision"),identityFingerprint:(0,d.jsonb)("identity_fingerprint").$type(),evidenceReportId:(0,b.uuid)("evidence_report_id"),effectiveAt:(0,f.timestamp)("effective_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),expiresAt:(0,f.timestamp)("expires_at",{withTimezone:!0,mode:"string"}),revokedAt:(0,f.timestamp)("revoked_at",{withTimezone:!0,mode:"string"}),revokedReason:(0,h.text)("revoked_reason"),createdBy:(0,h.text)("created_by").notNull(),revokedBy:(0,h.text)("revoked_by"),version:(0,c.integer)().default(1).notNull(),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,u.index)("rest_suppressions_active_effect_idx").using("btree",e.effect,e.effectiveAt).where(_.sql`${e.revokedAt} IS NULL`),(0,u.index)("rest_suppressions_restaurant_idx").using("btree",e.restaurantId),(0,u.index)("rest_suppressions_source_listing_idx").using("btree",e.source,e.sourceRestaurantId),(0,u.uniqueIndex)("rest_suppressions_active_restaurant_key").on(e.restaurantId).where(_.sql`${e.effect} = 'hide_restaurant' AND ${e.revokedAt} IS NULL`),(0,u.uniqueIndex)("rest_suppressions_active_provider_key").on(e.source,e.sourceRestaurantId).where(_.sql`${e.effect} = 'hide_provider' AND ${e.revokedAt} IS NULL`),(0,u.uniqueIndex)("rest_suppressions_active_capability_key").on(e.source,e.sourceRestaurantId,e.capability).where(_.sql`${e.effect} = 'disable_cta' AND ${e.revokedAt} IS NULL`),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"rest_suppressions_restaurant_id_fkey"}),(0,o.foreignKey)({columns:[e.restaurantIdAtDecision],foreignColumns:[S.id],name:"rest_suppressions_restaurant_decision_id_fkey"}),(0,o.foreignKey)({columns:[e.evidenceReportId],foreignColumns:[q.id],name:"rest_suppressions_evidence_report_id_fkey"}),(0,a.check)("rest_suppressions_effect_check",_.sql`${e.effect} IN ('hide_restaurant', 'hide_provider', 'disable_cta')`),(0,a.check)("rest_suppressions_reason_code_check",_.sql`${e.reasonCode} IN ('permanently_closed', 'provider_unsupported', 'broken_link', 'duplicate', 'wrong_location', 'fraud_or_safety', 'other')`),(0,a.check)("rest_suppressions_capability_check",_.sql`${e.capability} IS NULL OR ${e.capability} IN ('booking', 'ordering', 'gift_card', 'profile')`),(0,a.check)("rest_suppressions_target_shape_check",_.sql`( 8 ${e.effect} = 'hide_restaurant' 9 AND ${e.restaurantId} IS NOT NULL 10 AND ${e.source} IS NULL 11 AND ${e.sourceRestaurantId} IS NULL 12 AND ${e.capability} IS NULL 13 ) OR ( 14 ${e.effect} = 'hide_provider' 15 AND ${e.restaurantId} IS NULL 16 AND ${e.source} IS NOT NULL 17 AND ${e.sourceRestaurantId} IS NOT NULL 18 AND ${e.capability} IS NULL 19 ) OR ( 20 ${e.effect} = 'disable_cta' 21 AND ${e.restaurantId} IS NULL 22 AND ${e.source} IS NOT NULL 23 AND ${e.sourceRestaurantId} IS NOT NULL 24 AND ${e.capability} IS NOT NULL 25 )`),(0,a.check)("rest_suppressions_expiry_check",_.sql`${e.expiresAt} IS NULL OR ${e.expiresAt} > ${e.effectiveAt}`),(0,a.check)("rest_suppressions_revoke_check",_.sql`${e.revokedAt} IS NULL OR ${e.revokedAt} >= ${e.effectiveAt}`),(0,a.check)("rest_suppressions_version_check",_.sql`${e.version} > 0`)]),$=w.table("restaurant_map_suppression_events",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),suppressionId:(0,b.uuid)("suppression_
25id").notNull(),action:(0,h.text)().notNull(),actorId:(0,h.text)("actor_id").notNull(),requestId:(0,h.text)("request_id").notNull(),state:(0,d.jsonb)().$type().notNull(),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,y.unique)("rest_suppression_events_request_key").on(e.requestId),(0,u.index)("rest_suppression_events_suppression_created_idx").using("btree",e.suppressionId,e.createdAt.desc()),(0,o.foreignKey)({columns:[e.suppressionId],foreignColumns:[I.id],name:"rest_suppression_events_suppression_id_fkey"}),(0,a.check)("rest_suppression_events_action_check",_.sql`${e.action} IN ('created', 'updated', 'revoked', 'expired')`)]),A=w.table("restaurant_map_suppression_state",{key:(0,h.text)().primaryKey().default("current").notNull(),revision:(0,c.integer)().default(0).notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,a.check)("rest_suppression_state_key_check",_.sql`${e.key} = 'current'`),(0,a.check)("rest_suppression_state_revision_check",_.sql`${e.revision} >= 0`)]);w.table("restaurant_map_serving_revisions",{key:(0,h.text)().primaryKey().notNull(),revision:(0,c.integer)().default(0).notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,a.check)("rest_map_serving_revisions_key_check",_.sql`${e.key} = 'restaurant-map-entries'`),(0,a.check)("rest_map_serving_revisions_revision_check",_.sql`${e.revision} >= 0`)]);let k=w.table("restaurant_map_suppression_outbox",{id:(0,b.uuid)().defaultRandom().primaryKey().notNull(),suppressionRevision:(0,c.integer)("suppression_revision").notNull(),mapId:(0,h.text)("map_id").notNull(),status:(0,h.text)().default("pending").notNull(),attempts:(0,c.integer)().default(0).notNull(),claimToken:(0,h.text)("claim_token"),completedMapIds:(0,d.jsonb)("completed_map_ids").$type().default([]).notNull(),availableAt:(0,f.timestamp)("available_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),lastError:(0,h.text)("last_error"),completedAt:(0,f.timestamp)("completed_at",{withTimezone:!0,mode:"string"}),deadLetteredAt:(0,f.timestamp)("dead_lettered_at",{withTimezone:!0,mode:"string"}),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,y.unique)("rest_suppression_outbox_revision_map_key").on(e.suppressionRevision,e.mapId),(0,u.index)("rest_suppression_outbox_status_available_idx").using("btree",e.status,e.availableAt),(0,a.check)("rest_suppression_outbox_status_check",_.sql`${e.status} IN ('pending', 'processing', 'completed', 'failed', 'dead_letter')`),(0,a.check)("rest_suppression_outbox_attempts_check",_.sql`${e.attempts} >= 0`)]),B=w.table("doordash_chase_stores",{storeId:(0,h.text)("store_id").primaryKey().notNull(),restaurantId:(0,b.uuid)("restaurant_id"),name:(0,h.text)().notNull(),chain:(0,h.text)(),latitude:(0,m.numeric)().notNull(),longitude:(0,m.numeric)().notNull(),streetAddress:(0,h.text)("street_address"),displayAddress:(0,h.text)("display_address"),city:(0,h.text)().notNull(),state:(0,h.text)(),postalCode:(0,h.text)("postal_code"),countryCode:(0,h.text)("country_code").default("US").notNull(),storeUrl:(0,h.text)("store_url"),imageUrl:(0,h.text)("image_url"),category:(0,h.text)(),categoryLabel:(0,h.text)("category_label"),verticalLabel:(0,h.text)("vertical_label"),sourceVerticalIds:(0,h.text)("source_vertical_ids").array(),sourceVerticalNames:(0,h.text)("source_vertical_names").array(),primaryVerticalIds:(0,h.text)("primary_vertical_ids").array(),rating:(0,m.numeric)(),reviewCount:(0,c.integer)("review_count"),deliveryAvailable:(0,s.boolean)("delivery_available"),pickupAvailable:(0,s.boolean)("pickup_available"),currentlyAvailable:(0,s.boolean)("currently_available"),asapAvailable:(0,s.boolean)("asap_available"),scheduleDeliveryAvailable:(0,s.boolean)("schedule_delivery_available"),deliveryAheadAvailable:(0,s.boolean)("delivery_ahead_available"),availabilityLabel:(0,h.text)("availability_label"),asapMinutes:(0,c.integer)("asap_minutes"),dashpass:(0,s.boolean)(),deliveryFee:(0,h.text)("delivery_fee"),minimumSubtotal:(0,c.integer)("minimum_subtotal"),eligibleByBenefitFooter:(0,s.boolean)("eligible_by_benefit_footer").default(!0).notNull(),benef
25itTitle:(0,h.text)("benefit_title"),benefitDescription:(0,h.text)("benefit_description"),benefitUseCase:(0,h.text)("benefit_use_case"),benefitCheckedAt:(0,f.timestamp)("benefit_checked_at",{withTimezone:!0,mode:"string"}),benefitStatus:(0,c.integer)("benefit_status"),benefitLocation:(0,h.text)("benefit_location"),benefitComponent:(0,h.text)("benefit_component"),isActive:(0,s.boolean)("is_active").default(!0).notNull(),firstSeenAt:(0,f.timestamp)("first_seen_at",{withTimezone:!0,mode:"string"}),lastSeenAt:(0,f.timestamp)("last_seen_at",{withTimezone:!0,mode:"string"}),lastScrapedAt:(0,f.timestamp)("last_scraped_at",{withTimezone:!0,mode:"string"}),metadata:(0,d.jsonb)().$type(),location:(0,l.geometry)({type:"point",mode:"xy",srid:4326}).generatedAlwaysAs(()=>_.sql`st_setsrid(st_makepoint(${B.longitude}::double precision, ${B.latitude}::double precision), 4326)`),createdAt:(0,f.timestamp)("created_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull(),updatedAt:(0,f.timestamp)("updated_at",{withTimezone:!0,mode:"string"}).defaultNow().notNull()},e=>[(0,u.index)("dd_chase_stores_location_gist").using("gist",e.location),(0,u.index)("dd_chase_stores_state_city_idx").using("btree",e.state,e.city),(0,u.index)("dd_chase_stores_lat_lng_idx").using("btree",e.latitude,e.longitude),(0,u.index)("dd_chase_stores_active_idx").using("btree",e.isActive),(0,u.index)("dd_chase_stores_delivery_idx").using("btree",e.deliveryAvailable).where(_.sql`delivery_available = true`),(0,u.index)("dd_chase_stores_pickup_idx").using("btree",e.pickupAvailable).where(_.sql`pickup_available = true`),(0,u.index)("dd_chase_stores_category_idx").using("btree",e.category),(0,u.index)("dd_chase_stores_name_trgm_idx").using("gin",e.name.op("gin_trgm_ops")),(0,o.foreignKey)({columns:[e.restaurantId],foreignColumns:[S.id],name:"dd_chase_stores_restaurant_id_fkey"})]),K=function(...e){return e}("bilt","resy","tock","csr","inkind","blackbird","seated","franki","rewards-network","rakuten","doordash","doordash-chase","upside","toast-local","clover-paze","nyc-restaurant-week","houston-restaurant-week","dine-la-restaurant-week","boston-restaurant-week","dc-restaurant-week","new-orleans-restaurant-week","miami-restaurant-week","pittsburgh-restaurant-week","orlando-restaurant-week","austin-restaurant-week","dfw-restaurant-week");e.s(["RESTAURANT_SOURCE_KEYS",0,K,"RESTAURANT_SOURCE_REGISTRY",0,{bilt:{label:"Bilt"},resy:{label:"Resy"},tock:{label:"Tock"},csr:{label:"CSR dining"},inkind:{label:"inKind"},blackbird:{label:"Blackbird"},seated:{label:"Seated"},franki:{label:"Franki"},"rewards-network":{label:"Rewards Network"},rakuten:{label:"Rakuten Dining"},doordash:{label:"DoorDash In-Store Rewards"},"doordash-chase":{label:"DoorDash Chase Credit"},upside:{label:"Upside"},"toast-local":{label:"Toast Local"},"clover-paze":{label:"Paze Clover"},"nyc-restaurant-week":{label:"NYC Restaurant Week"},"houston-restaurant-week":{label:"Houston Restaurant Weeks"},"dine-la-restaurant-week":{label:"Dine LA Restaurant Week"},"boston-restaurant-week":{label:"Boston Restaurant Week"},"dc-restaurant-week":{label:"DC Restaurant Week"},"new-orleans-restaurant-week":{label:"COOLinary New Orleans"},"miami-restaurant-week":{label:"Miami Spice"},"pittsburgh-restaurant-week":{label:"Pittsburgh Restaurant Week"},"orlando-restaurant-week":{label:"Orlando Magical Dining"},"austin-restaurant-week":{label:"Austin Restaurant Weeks"},"dfw-restaurant-week":{label:"DFW Restaurant Week"}}],155705);let D=t.z.union([t.z.enum(K),t.z.literal("bilt_mobile_checkout")]);(0,r.createSelectSchema)(S),(0,r.createSelectSchema)(z),(0,r.createSelectSchema)(v),(0,r.createSelectSchema)(C),(0,r.createSelectSchema)(P),(0,r.createSelectSchema)(x),(0,r.createSelectSchema)(T),(0,r.createSelectSchema)(q),(0,r.createSelectSchema)(I),(0,r.createSelectSchema)($),(0,r.createSelectSchema)(A),(0,r.createSelectSchema)(k),(0,r.createSelectSchema)(B),(0,r.createInsertSchema)(S),(0,r.createInsertSchema)(z),(0,r.createInsertSchema)(v),(0,r.createInsertSchema)(C),(0,r.createInsertSchema)(P),(0,r.createInsertSchema)(x),(0,r.createInsertSchema)(T),(0,r.createInsertSchema)(q),(0,r.createInsertSchema)(I),(0,r.createInsertSchema)($),(0,r.createInsertSchema)(A),(0,r.createInsertSchema)(k),(0,r.createInsertSchema)(B);let j=t.z.enum(["success","unsure","fail"]),L=t.z.enum(["reddit","facebook","admin","other"]),O=t.z.object({id:t.z.string().min(1),outcome:j,observedOn:t.z.string().regex(/^\d{4}-\d{2}-\d{2}$/),comment:t.z.string().min(1),source:L,sourceUrl:t.z.string().url().optional()}),Q=t.z.object({status:j,datapoints:t.z.array(O)}),F=t.z.enum(["toast","clover","securetree","other"]),V=t.z.object({url:t.z.string().trim().url().refine(e=>{try{let t=new URL(e).protocol;return"http:"===t||"https:"===t}catch{return!1}},"Gift card URL must use http or https."),provider:F.optional(),label:t.z.string().trim().min(1).optional(),description:t.z.string().trim().min(1).optional()});t.z.object({bounds:t.z.object({north:t.z.number(),south:t.z.number(),east:t.z.number(),west:t.z.number()}),countBounds:t.z.object({north:t.z.number(),south:t.z.number(),east:t.z.number(),west:t.z.number()}).optional(),sources:t.z.array(t.z.string()).min(1),requiredSources:t.z.array(t.z.string()).optional(),selectedSources:t.z.array(t.z.string()).optional(),excludedSources:t.z.array(t.z.string()).optional(),sourceMode:t.z.enum(["and","or","compare"]).optional(),countryCode:t.z.literal("US").default("US"),filters:t.z.object({biltMobileCheckout:t.z.boolean().optional(),giftCards:t.z.boolean().optional(),giftCardsOrToastOrdering:t.z.boolean().optional(),toastGiftCards:t.z.boolean().optional(),toastOrdering:t.z.boolean().optional(),businessTypes:t.z.array(t.z.string()).optional()}).optional(),cities:t.z.array(t.z.string()).optional(),search:t.z.string().optional(),searchIncludeCityFields:t.z.boolean().optional(),searchIncludeCuisineFields:t.z.boolean().optional(),selectedRestaurantId:t.z.string().uuid().optional(),limit:t.z.number().int().min(0).max(5e3).optional(),zoom:t.z.number().min(0).max(22).optional(),cluster:t.z.boolean().optional(),includeSourceCounts:t.z.boolean().optional()}),t.z.object({query:t.z.string(),sources:t.z.array(t.z.string()).min(1),countryCode:t.z.string().default("US"),limit:t.z.number().int().min(1).max(50).optional(),includeCuisineFields:t.z.boolean().optional(),filterKey:i.restaurantLocationSearchFilterKeySchema.optional(),type:t.z.enum(["restaurant","city"]).optional(),visibilityHash:t.z.string().regex(/^[a-f0-9]{64}$/i).optional()}),t.z.object({candidates:t.z.array(t.z.object({descriptor:t.z.string().trim().min(3).max(256),hasCloverMarker:t.z.boolean(),isDining:t.z.boolean()})).max(400)}),t.z.object({restaurantId:t.z.string().uuid()}),t.z.object({sources:t.z.array(t.z.string()).min(1),countryCode:t.z.string().default("US"),filterKey:t.z.string().optional(),citySlugs:t.z.array(t.z.string()).min(1).max(50).optional(),limit:t.z.number().int().min(1).max(200).optional()}),t.z.object({source:t.z.string().optional(),sources:t.z.array(t.z.string()).min(1).optional(),countryCode:t.z.string().optional(),biltMobileCheckout:t.z.boolean().optional(),windowDays:t.z.number().int().min(1).max(365).optional(),limit:t.z.number().int().min(1).max(1e3).optional()}),t.z.object({source:t.z.string(),since:t.z.string().datetime({offset:!0}),before:t.z.string().datetime({offset:!0}).optional(),countryCode:t.z.string().default("US"),limit:t.z.number().int().min(1).max(1e3).optional()}),t.z.object({source:t.z.string(),countryCode:t.z.string().optional(),filterKey:t.z.string().optional(),limit:t.z.number().int().min(1).max(100).optional()}),t.z.object({source:t.z.string(),countryCode:t.z.string().optional(),filterKey:t.z.string().optional()}),t.z.object({source:t.z.string(),since:t.z.string().datetime({offset:!0}),filterKey:t.z.string().optional()}),t.z.object({source:t.z.string(),countryCode:t.z.string().default("US"),filters:t.z.object({biltMobileCheckout:t.z.boolean().optional(),giftCards:t.z.boolean().optional(),giftCardsOrToastOrdering:t.z.boolean().optional(),toastGiftCards:t.z.boolean().optional(),toastOrdering:t.z.boolean().optional(),resyCreditIneligible:t.z.boolean().optional(),businessTypes:t.z.array(t.z.string()).optional()}).optional()}),t.z.object({source:t.z.string(),countryCode:t.z.string().default("US")});let U=t.z.enum(["budget","moderate","upscale","fine-dining"]),R=t.z.object({slug:t.z.string().optional(),label:t.z.string().optional(),stateCode:t.z.string().nullable().optional()}),M=t.z.enum(["restaurant","location","cuisine","rating","price","programs"]),E=t.z.object({key:M,direction:t.z.enum(["asc","desc"])});t.z.object({availableSources:t.z.array(t.z.string()).min(1),requiredSources:t.z.array(t.z.string()).optional(),selectedSources:t.z.array(t.z.string()).optional(),excludedSources:t.z.array(t.z.string()).optional(),sourceMode:t.z.enum(["and","or","compare"]).default("and"),countryCode:t.z.string().default("US"),cursor:t.z.string().optional(),limit:t.z.number().int().min(1).max(250).default(24),search:t.z.string().optional(),searchIncludeCuisineFields:t.z.boolean().optional(),cities:t.z.array(R).optional(),cuisines:t.z.array(t.z.string()).optional(),priceRanges:t.z.array(U).optional(),minRating:t.z.number().min(0).max(5).optional(),giftCards:t.z.boolean().optional(),toastFilters:t.z.array(t.z.enum(["gift-cards","ordering"])).optional(),businessTypes:t.z.array(t.z.string()).optional(),sort:E.optional()}),t.z.object({availableSources:t.z.array(t.z.string()).min(1),requiredSources:t.z.array(t.z.string()).optional(),countryCode:t.z.string().default("US")}),t.z.object({mainSources:t.z.array(t.z.string()).min(1),stackWithSources:t.z.array(t.z.string()).default([]),countryCode:t.z.string().default("US")}),t.z.object({source:t.z.string(),filterKey:t.z.string().optional()}),t.z.object({source:t.z.string(),countryCode:t.z.string().optional(),filterKey:t.z.string().optional(),limit:t.z.number().int().min(1).max(100).optional()}),t.z.object({snapshotId:t.z.string().uuid(),changeType:t.z.enum(["added","removed"]),countryCode:t.z.string().optional(),cursor:t.z.string().optional(),limit:t.z.number().int().min(1).max(100).default(100)}),t.z.object({restaurants:t.z.array(t.z.object({googlePlaceId:t.z.string().nullable().optional(),legacyConvexId:t.z.string().nullable().optional(),name:t.z.string(),latitude:t.z.string(),longitude:t.z.string(),streetAddress:t.z.string(),city:t.z.string(),state:t.z.string().nullable().optional(),postalCode:t.z.string().nullable().optional(),countryCode:t.z.string(),neighborhood:t.z.string().nullable().optional(),cuisines:t.z.array(t.z.string()).optional(),rating:t.z.string().nullable().optional(),userRating
25Count:t.z.number().nullable().optional(),priceRange:t.z.string().nullable().optional(),priceLevel:t.z.number().nullable().optional(),estimatedPricePerPerson:t.z.string().nullable().optional(),seating:t.z.array(t.z.string()).nullable().optional(),photoUrls:t.z.array(t.z.string()).nullable().optional(),phoneNumber:t.z.string().nullable().optional(),website:t.z.string().nullable().optional()})).min(1)}),n.defaultPaginationSchema.extend({name:t.z.string().optional(),city:t.z.string().optional(),state:t.z.string().optional(),countryCode:t.z.string().optional()}),t.z.object({restaurantIds:t.z.array(t.z.string().uuid()).min(1),citySlug:t.z.string().min(1)}),t.z.object({restaurantIds:t.z.array(t.z.string().uuid()).min(1).max(100),expectedTargets:t.z.array(t.z.object({restaurantId:t.z.string().uuid(),sourceRestaurantId:t.z.string().trim().min(1).max(500)})).min(1).max(500),reason:t.z.string().trim().min(1).max(500)}),t.z.enum(["permanently_closed","provider_unsupported","broken_link","duplicate","wrong_location","fraud_or_safety","other"]);let J=t.z.enum(["permanently_closed","provider_unsupported","broken_link","fraud_or_safety","other"]),G=t.z.enum(["booking","ordering","gift_card","profile"]),X=t.z.object({effect:t.z.literal("hide_restaurant"),restaurantId:t.z.string().uuid(),expectedRestaurantIdAtDecision:t.z.string().uuid().nullable().optional()}),W=t.z.object({effect:t.z.literal("hide_provider"),source:D,sourceRestaurantId:t.z.string().trim().min(1).max(500),expectedRestaurantIdAtDecision:t.z.string().uuid().nullable().optional()}),H=t.z.object({effect:t.z.literal("disable_cta"),source:t.z.enum(K),sourceRestaurantId:t.z.string().trim().min(1).max(500),capability:G}),Y=t.z.discriminatedUnion("effect",[X,W]);function Z(e){return"hide_restaurant"===e.effect?`restaurant:${e.restaurantId}`:`provider:${e.source}:${e.sourceRestaurantId}`}t.z.object({targets:t.z.array(Y).min(1).max(100),reasonCode:J,reasonDetail:t.z.string().trim().min(1).max(1e3),expiresAt:t.z.string().datetime().optional(),requestId:t.z.string().trim().min(8).max(150),expectedRevision:t.z.number().int().min(0)}).refine(e=>new Set(e.targets.map(Z)).size===e.targets.length,"Bulk suppression targets must be unique"),t.z.discriminatedUnion("effect",[X,W,H]).and(t.z.object({reasonCode:J,reasonDetail:t.z.string().trim().min(1).max(1e3).optional(),evidenceReportId:t.z.string().uuid().optional(),expiresAt:t.z.string().datetime().optional(),requestId:t.z.string().trim().min(8).max(200),expectedRevision:t.z.number().int().min(0)})),t.z.object({suppressionId:t.z.string().uuid(),expectedVersion:t.z.number().int().positive(),expectedRevision:t.z.number().int().min(0),reason:t.z.string().trim().min(1).max(1e3),requestId:t.z.string().trim().min(8).max(200)}),t.z.object({includeInactive:t.z.boolean().optional(),source:D.optional(),sourceRestaurantId:t.z.string().trim().min(1).max(500).optional(),restaurantId:t.z.string().uuid().optional(),limit:t.z.number().int().min(1).max(500).default(100)}).refine(e=>!e.sourceRestaurantId||!!e.source,"A provider listing ID requires its provider source"),t.z.object({restaurantId:t.z.string().uuid()});let ee=t.z.enum(["restaurant_closed","provider_not_working","broken_link","wrong_location","duplicate","other"]);t.z.object({category:ee,message:t.z.string().trim().min(5).max(4e3),restaurantId:t.z.string().uuid().optional(),source:D.optional(),sourceRestaurantId:t.z.string().trim().min(1).max(500).optional(),snapshotId:t.z.string().trim().min(1).max(200).optional(),mapId:t.z.string().trim().min(1).max(200).optional(),pageUrl:t.z.string().url().max(2e3).optional(),posthogDistinctId:t.z.string().trim().min(1).max(255).optional()}).refine(e=>!e.sourceRestaurantId||!!e.source,"A provider listing ID requires its provider source").refine(e=>!e.source||!!e.sourceRestaurantId,"Provider reports require an exact provider listing ID"),t.z.object({restaurantId:t.z.string().uuid().optional(),status:t.z.enum(["pending","verified","rejected"]).optional(),limit:t.z.number().int().min(1).max(200).default(100)}),t.z.object({reportId:t.z.string().uuid(),decision:t.z.enum(["verified","rejected"]),expectedStatus:t.z.literal("pending")}),t.z.object({search:t.z.string().optional(),limit:t.z.number().int().min(1).max(1e3).optional()}),t.z.object({restaurantId:t.z.string().uuid(),evidence:Q.nullable()}),t.z.object({restaurantId:t.z.string().uuid(),giftCard:V.nullable()}),t.z.object({city:t.z.string().min(1),programs:t.z.array(t.z.enum(K)).min(1),countryCode:t.z.string().default("US"),limit:t.z.number().int().min(1).max(500).optional()}),e.s(["CsrDiningCreditGiftCardEvidenceSchema",0,Q,"CsrGiftCardProviderSchema",0,F,"isRestaurantMapSuppressionSource",0,function(e){return D.safeParse(e).success}],172009),e.s([],9045)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.