@warmhub/sdk-ts 0.110.0 → 0.111.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkpoint.js +1 -1
- package/dist/checkpoint.js.map +1 -1
- package/dist/chunk-CJ2HCKNL.js +10 -0
- package/dist/chunk-CJ2HCKNL.js.map +1 -0
- package/dist/{chunk-X5CR7GVH.js → chunk-R6BZ46ZK.js} +3 -3
- package/dist/{chunk-X5CR7GVH.js.map → chunk-R6BZ46ZK.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2VVQAGZ2.js +0 -10
- package/dist/chunk-2VVQAGZ2.js.map +0 -1
|
@@ -17,7 +17,7 @@ import {z as z$1}from'zod';var Hn="X-WarmHub-Client-Flags",_n="compatibility-ove
|
|
|
17
17
|
`)-1&&B.runes[2]===E.CODES.get(`
|
|
18
18
|
`)+1&&B.runes[3]===m.MAX_RUNE&&(B.runes=[],B.op=h.Op.ANY_CHAR_NOT_NL));}collapse(B,e){if(B.length===1)return B[0];let t=0;for(let C of B)t+=C.op===e?C.subs.length:1;let i=new Array(t).fill(null),r=0;for(let C of B)if(C.op===e){for(let o=0;o<C.subs.length;o++)i[r++]=C.subs[o];this.reuse(C);}else i[r++]=C;let s=this.newRegexp(e);if(s.subs=i,e===h.Op.ALTERNATE&&(s.subs=this.factor(s.subs),s.subs.length===1)){let C=s;s=s.subs[0],this.reuse(C);}return s}factor(B){if(B.length<2)return B;let e=0,t=B.length,i=0,r=null,s=0,C=0,o=0;for(let c=0;c<=t;c++){let p=null,g=0,d=0;if(c<t){let O=B[e+c];if(O.op===h.Op.CONCAT&&O.subs.length>0&&(O=O.subs[0]),O.op===h.Op.LITERAL&&(p=O.runes,g=O.runes.length,d=O.flags&D.FOLD_CASE),d===C){let S=0;for(;S<s&&S<g&&r[S]===p[S];)S++;if(S>0){s=S;continue}}}if(c!==o)if(c===o+1)B[i++]=B[e+o];else {let O=this.newRegexp(h.Op.LITERAL);O.flags=C,O.runes=r.slice(0,s);for(let R=o;R<c;R++)B[e+R]=this.removeLeadingString(B[e+R],s),this.checkLimits(B[e+R]);let S=this.collapse(B.slice(e+o,e+c),h.Op.ALTERNATE),L=this.newRegexp(h.Op.CONCAT);L.subs=[O,S],B[i++]=L;}o=c,r=p,s=g,C=d;}t=i,e=0,o=0,i=0;let u=null;for(let c=0;c<=t;c++){let p=null;if(!(c<t&&(p=I.leadingRegexp(B[e+c]),u!==null&&u.equals(p)&&(I.isCharClass(u)||u.op===h.Op.REPEAT&&u.min===u.max&&I.isCharClass(u.subs[0]))))){if(c!==o)if(c===o+1)B[i++]=B[e+o];else {let g=u;for(let S=o;S<c;S++){let L=S!==o;B[e+S]=this.removeLeadingRegexp(B[e+S],L),this.checkLimits(B[e+S]);}let d=this.collapse(B.slice(e+o,e+c),h.Op.ALTERNATE),O=this.newRegexp(h.Op.CONCAT);O.subs=[g,d],B[i++]=O;}o=c,u=p;}}t=i,e=0,o=0,i=0;for(let c=0;c<=t;c++)if(!(c<t&&I.isCharClass(B[e+c]))){if(c!==o)if(c===o+1)B[i++]=B[e+o];else {let p=o;for(let d=o+1;d<c;d++){let O=B[e+p],S=B[e+d];(O.op<S.op||O.op===S.op&&(O.runes!==null?O.runes.length:0)<(S.runes!==null?S.runes.length:0))&&(p=d);}let g=B[e+o];B[e+o]=B[e+p],B[e+p]=g;for(let d=o+1;d<c;d++)I.mergeCharClass(B[e+o],B[e+d]),this.reuse(B[e+d]);this.cleanAlt(B[e+o]),B[i++]=B[e+o];}c<t&&(B[i++]=B[e+c]),o=c+1;}t=i,e=0,o=0,i=0;for(let c=0;c<t;++c)c+1<t&&B[e+c].op===h.Op.EMPTY_MATCH&&B[e+c+1].op===h.Op.EMPTY_MATCH||(B[i++]=B[e+c]);return t=i,e=0,B.slice(e,t)}removeLeadingString(B,e){if(B.op===h.Op.CONCAT&&B.subs.length>0){let t=this.removeLeadingString(B.subs[0],e);if(B.subs[0]=t,t.op===h.Op.EMPTY_MATCH)switch(this.reuse(t),B.subs.length){case 0:case 1:B.op=h.Op.EMPTY_MATCH,B.subs=h.emptySubs();break;case 2:{let i=B;B=B.subs[1],this.reuse(i);break}default:B.subs=B.subs.slice(1,B.subs.length);break}return B}return B.op===h.Op.LITERAL&&(B.runes=B.runes.slice(e,B.runes.length),B.runes.length===0&&(B.op=h.Op.EMPTY_MATCH)),B}removeLeadingRegexp(B,e){if(B.op===h.Op.CONCAT&&B.subs.length>0){switch(e&&this.reuse(B.subs[0]),B.subs=B.subs.slice(1,B.subs.length),B.subs.length){case 0:B.op=h.Op.EMPTY_MATCH,B.subs=h.emptySubs();break;case 1:{let t=B;B=B.subs[0],this.reuse(t);break}}return B}return e&&this.reuse(B),this.newRegexp(h.Op.EMPTY_MATCH)}parseInternal(){if((this.flags&D.LITERAL)!==0)return I.literalRegexp(this.wholeRegexp,this.flags);let B=-1,e=-1,t=-1,i=new Ni(this.wholeRegexp);for(;i.more();){let r=-1;B:switch(i.peek()){case E.CODES.get("("):if((this.flags&D.LOOKBEHIND)!==0){if(i.lookingAt("(?<=")){this.parsePosLookBehind(),i.skip(4);break}if(i.lookingAt("(?<!")){this.parseNegLookBehind(),i.skip(4);break}}if((this.flags&D.PERL_X)!==0&&i.lookingAt("(?")){this.parsePerlFlags(i);break}this.op(h.Op.LEFT_PAREN).cap=++this.numCap,i.skip(1);break;case E.CODES.get("|"):this.parseVerticalBar(),i.skip(1);break;case E.CODES.get(")"):this.parseRightParen(),i.skip(1);break;case E.CODES.get("^"):(this.flags&D.ONE_LINE)!==0?this.op(h.Op.BEGIN_TEXT):this.op(h.Op.BEGIN_LINE),i.skip(1);break;case E.CODES.get("$"):(this.flags&D.ONE_LINE)!==0?this.op(h.Op.END_TEXT).flags|=D.WAS_DOLLAR:this.op(h.Op.END_LINE),i.skip(1);break;case E.CODES.get("."):(this.flags&D.DOT_NL)!==0?this.op(h.Op.ANY_CHAR):this.op(h.Op.ANY_CHAR_NOT_NL),i.skip(1);break;case E.CODES.get("["):this.parseClass(i);break;case E.CODES.get("*"):case E.CODES.get("+"):case E.CODES.get("?"):{r=i.pos();let s=null;switch(i.pop()){case E.CODES.get("*"):s=h.Op.STAR;break;case E.CODES.get("+"):s=h.Op.PLUS;break;case E.CODES.get("?"):s=h.Op.QUEST;break}this.repeat(s,e,t,r,i,B);break}case E.CODES.get("{"):{r=i.pos();let s=I.parseRepeat(i);if(s<0){i.rewindTo(r),this.literal(i.pop());break}e=s>>16,t=(s&m.MAX_BMP)<<16>>16,this.repeat(h.Op.REPEAT,e,t,r,i,B);break}case E.CODES.get("\\"):{let s=i.pos();if(i.skip(1),(this.flags&D.PERL_X)!==0&&i.more())switch(i.pop()){case E.CODES.get("A"):this.op(h.Op.BEGIN_TEXT);break B;case E.CODES.get("b"):this.op(h.Op.WORD_BOUNDARY);break B;case E.CODES.get("B"):this.op(h.Op.NO_WORD_BOUNDARY);break B;case E.CODES.get("C"):throw new H(I.ERR_INVALID_ESCAPE,"\\C");case E.CODES.get("Q"):{let u=i.rest(),c=u.indexOf("\\E");c>=0?(u=u.substring(0,c),i.skipString(u),i.skipString("\\E")):i.skipString(u);let p=0;for(;p<u.length;){let g=u.codePointAt(p);this.literal(g),p+=F.charCount(g);}break B}case E.CODES.get("z"):this.op(h.Op.END_TEXT);break B;default:i.rewindTo(s);break}else i.rewindTo(s);let C=this.newRegexp(h.Op.CHAR_CLASS);if(C.flags=this.flags,i.lookingAt("\\p")||i.lookingAt("\\P")){let u=new rB;if(this.parseUnicodeClass(i,u)){C.runes=u.toArray(),this.push(C);break B}}let o=new rB;if(this.parsePerlClassEscape(i,o)){C.runes=o.toArray(),this.push(C);break B}i.rewindTo(s),this.reuse(C),this.literal(I.parseEscape(i));break}default:this.literal(i.pop());break}B=r;}if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length!==1)throw new H(I.ERR_MISSING_PAREN,this.wholeRegexp);return this.stack[0].namedGroups=this.namedGroups,this.stack[0]}parsePerlFlags(B){let e=B.pos(),t=B.rest();if(t.startsWith("(?P<")||t.startsWith("(?<")){let C=t.charAt(2)==="P"?4:3,o=t.indexOf(">");if(o<0)throw new H(I.ERR_INVALID_NAMED_CAPTURE,t);let u=t.substring(C,o);if(B.skipString(u),B.skip(C+1),!I.isValidCaptureName(u))throw new H(I.ERR_INVALID_NAMED_CAPTURE,t.substring(0,o+1));let c=this.op(h.Op.LEFT_PAREN);if(c.cap=++this.numCap,this.namedGroups[u])throw new H(I.ERR_DUPLICATE_NAMED_CAPTURE,u);this.namedGroups[u]=this.numCap,c.name=u;return}B.skip(2);let i=this.flags,r=1,s=false;B:for(;B.more();){let C=B.pop();switch(C){case E.CODES.get("i"):i|=D.FOLD_CASE,s=true;break;case E.CODES.get("m"):i&=-17,s=true;break;case E.CODES.get("s"):i|=D.DOT_NL,s=true;break;case E.CODES.get("U"):i|=D.NON_GREEDY,s=true;break;case E.CODES.get("-"):if(r<0)break B;r=-1,i=~i,s=false;break;case E.CODES.get(":"):case E.CODES.get(")"):if(r<0){if(!s)break B;i=~i;}C===E.CODES.get(":")&&this.op(h.Op.LEFT_PAREN),this.flags=i;return;default:break B}}throw new H(I.ERR_INVALID_PERL_OP,B.from(e))}parsePosLookBehind(){let B=this.newRegexp(h.Op.LEFT_PAREN);return B.flags=this.flags,B.lb=++this.nlb,this.push(B)}parseNegLookBehind(){let B=this.newRegexp(h.Op.LEFT_PAREN);return B.flags=this.flags,B.lb=-++this.nlb,this.push(B)}parseVerticalBar(){this.concat(),this.swapVerticalBar()||this.op(h.Op.VERTICAL_BAR);}swapVerticalBar(){let B=this.stack.length;if(B>=3&&this.stack[B-2].op===h.Op.VERTICAL_BAR&&I.isCharClass(this.stack[B-1])&&I.isCharClass(this.stack[B-3])){let e=this.stack[B-1],t=this.stack[B-3];if(e.op>t.op){let i=t;t=e,e=i,this.stack[B-3]=t;}return I.mergeCharClass(t,e),this.reuse(e),this.pop(),true}if(B>=2){let e=this.stack[B-1],t=this.stack[B-2];if(t.op===h.Op.VERTICAL_BAR)return B>=3&&this.cleanAlt(this.stack[B-3]),this.stack[B-2]=e,this.stack[B-1]=t,true}return false}parseRightParen(){if(this.concat(),this.swapVerticalBar()&&this.pop(),this.alternate(),this.stack.length<2)throw new H(I.ERR_UNEXPECTED_PAREN,this.wholeRegexp);let B=this.pop(),e=this.pop();if(e.op!==h.Op.LEFT_PAREN)throw new H(I.ERR_UNEXPECTED_PAREN,this.wholeRegexp);if(this.flags=e.flags,e.lb!==0){if(I.hasCapture(B))throw new H(I.ERR_INVALID_CAPTURE_IN_LOOKBEHIND,this.wholeRegexp);e.lb>0?e.op=h.Op.PLB:e.op=h.Op.NLB,e.subs=[B],this.push(e);return}e.cap===0?this.push(B):(e.op=h.Op.CAPTURE,e.subs=[B],this.push(e));}parsePerlClassEscape(B,e){let t=B.pos();if((this.flags&D.PERL_X)===0||!B.more()||B.pop()!==E.CODES.get("\\")||!B.more())return false;B.pop();let i=B.from(t),r=ht.has(i)?ht.get(i):null;return r===null?false:(e.appendGroup(r,(this.flags&D.FOLD_CASE)!==0),true)}parseNamedClass(B,e){let t=B.rest(),i=t.indexOf(":]");if(i<0)return false;let r=t.substring(0,i+2);B.skipString(r);let s=Tt.has(r)?Tt.get(r):null;if(s===null)throw new H(I.ERR_INVALID_CHAR_RANGE,r);return e.appendGroup(s,(this.flags&D.FOLD_CASE)!==0),true}parseUnicodeClass(B,e){let t=B.pos();if((this.flags&D.UNICODE_GROUPS)===0||!B.lookingAt("\\p")&&!B.lookingAt("\\P"))return false;B.skip(1);let i=1,r=B.pop();if(r===E.CODES.get("P")&&(i=-1),!B.more())throw B.rewindTo(t),new H(I.ERR_INVALID_CHAR_RANGE,B.rest());r=B.pop();let s;if(r!==E.CODES.get("{"))s=F.runeToString(r);else {let c=B.rest(),p=c.indexOf("}");if(p<0)throw B.rewindTo(t),new H(I.ERR_INVALID_CHAR_RANGE,B.rest());s=c.substring(0,p),B.skipString(s),B.skip(1);}s.length!==0&&s.codePointAt(0)===E.CODES.get("^")&&(i=0-i,s=s.substring(1));let C=I.unicodeTable(s);if(C===null)throw new H(I.ERR_INVALID_CHAR_RANGE,B.from(t));C.sign<0&&(i=0-i);let o=C.tab,u=C.fold;if((this.flags&D.FOLD_CASE)===0||u===null)e.appendTableWithSign(o,i);else {let c=new rB().appendTable(o).appendTable(u).cleanClass().toArray();e.appendClassWithSign(c,i);}return true}parseClass(B){let e=B.pos();B.skip(1);let t=this.newRegexp(h.Op.CHAR_CLASS);t.flags=this.flags;let i=new rB,r=1;B.more()&&B.lookingAt("^")&&(r=-1,B.skip(1),(this.flags&D.CLASS_NL)===0&&i.appendRange(E.CODES.get(`
|
|
19
19
|
`),E.CODES.get(`
|
|
20
|
-
`)));let s=true;for(;!B.more()||B.peek()!==E.CODES.get("]")||s;){if(B.more()&&B.lookingAt("-")&&(this.flags&D.PERL_X)===0&&!s){let c=B.rest();if(c==="-"||!c.startsWith("-]"))throw B.rewindTo(e),new H(I.ERR_INVALID_CHAR_RANGE,B.rest())}s=false;let C=B.pos();if(B.lookingAt("[:")){if(this.parseNamedClass(B,i))continue;B.rewindTo(C);}if(this.parseUnicodeClass(B,i)||this.parsePerlClassEscape(B,i))continue;B.rewindTo(C);let o=I.parseClassChar(B,e),u=o;if(B.more()&&B.lookingAt("-")){if(B.skip(1),B.more()&&B.lookingAt("]"))B.skip(-1);else if(u=I.parseClassChar(B,e),u<o)throw new H(I.ERR_INVALID_CHAR_RANGE,B.from(C))}(this.flags&D.FOLD_CASE)===0?i.appendRange(o,u):i.appendFoldedRange(o,u);}B.skip(1),i.cleanClass(),r<0&&i.negateClass(),t.runes=i.toArray(),this.push(t);}},Ri=class{constructor(n){this.value=n;}get(){return this.value}set(n){this.value=n;}compareAndSet(n,B){return this.value===n?(this.value=B,true):false}},Ti=class aB{static initTest(B){let e=aB.compile(B),t=new aB(e.expr,e.prog,e.numSubexp,e.longest);return t.cond=e.cond,t.prefix=e.prefix,t.prefixUTF8=e.prefixUTF8,t.prefixComplete=e.prefixComplete,t.prefixRune=e.prefixRune,t.prefilter=e.prefilter,t}static compile(B){return aB.compileImpl(B,D.PERL,false)}static compilePOSIX(B){return aB.compileImpl(B,D.POSIX,true)}static compileImpl(B,e,t){let i=Jt.parse(B,e),r=i.maxCap();i=kt.simplify(i);let s=Si.build(i),C=Mt.compileRegexp(i),o=new aB(B,C,r,t);o.prefilter=s.type===b.Type.NONE?null:s;let[u,c]=C.prefix();return o.prefixComplete=u,o.prefix=c,o.prefixUTF8=F.stringToUtf8ByteArray(o.prefix),o.prefix.length>0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=i.namedGroups,o}static match(B,e){return aB.compile(B).match(e)}constructor(B,e,t=0,i=0){this.expr=B,this.prog=e,this.numSubexp=t,this.longest=i,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=false,this.prefixRune=0,this.pooled=new Ri,this.dfa=new _t(this.prog),this.onepass=ot.compile(this.prog),this.prefilter=null;}matchPrefixComplete(B,e,t,i){if((t===D.ANCHOR_START||t===D.ANCHOR_BOTH)&&e!==0)return null;let r=-1,s=-1,C=B.prefixLength(this);if(t===D.UNANCHORED){let o=B.index(this,e);if(o<0)return null;r=e+o,s=r+C;}else if(t===D.ANCHOR_BOTH){if(B.endPos()!==C||B.index(this,0)!==0)return null;r=0,s=C;}else if(t===D.ANCHOR_START){if(B.index(this,0)!==0)return null;r=0,s=C;}if(r<0)return null;if(i>0){let o=new Int32Array(i).fill(-1);return o[0]=r,o[1]=s,Array.from(o)}return []}executeEngine(B,e,t,i){if(this.prefixComplete&&(i===0||this.numSubexp===0))return this.matchPrefixComplete(B,e,t,i);if(this.prefilter!==null&&t===D.UNANCHORED&&!this.prefilter.eval(B,e))return null;if(this.onepass!==null)return ot.execute(this,B,e,t,i);if(i>0)return this.prog.numLb===0&&B.endPos()<=kB.maxBitStateLen(this.prog)?kB.execute(this,B,e,t,i):this.doExecuteNFA(B,e,t,i);if(this.prog.numLb===0){let r=this.dfa.match(B,e,t);if(r!==null)return r?[]:null;if(B.endPos()<=kB.maxBitStateLen(this.prog))return kB.execute(this,B,e,t,i)}return this.doExecuteNFA(B,e,t,i)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let B;do B=this.pooled.get();while(B&&!this.pooled.compareAndSet(B,B.next));return B}reset(){this.pooled.set(null);}put(B,e){let t=this.pooled.get();do t=this.pooled.get(),!e&&t&&(B=UB.fromMachine(B),e=true),B.next!==t&&(B.next=t);while(!this.pooled.compareAndSet(t,B))}toString(){return this.expr}doExecuteNFA(B,e,t,i){let r=this.get(),s=false;r?r.next!==null&&(r=UB.fromMachine(r),s=true):(r=UB.fromRE2(this),s=true),r.init(i);let C=r.match(B,e,t)?r.submatches():null;return this.put(r,s),C}match(B){return this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,0)!==null}matchWithGroup(B,e,t,i,r){return B instanceof EB||(F.isByteArray(B)?B=IB.utf8(B):B=IB.utf16(B)),this.matchMachineInput(B,e,t,i,r)}matchMachineInput(B,e,t,i,r){if(e>t)return [false,null];let s=B.isUTF16Encoding()?x.fromUTF16(B.asCharSequence(),0,t):x.fromUTF8(B.asBytes(),0,t),C=this.executeEngine(s,e,i,2*r);return C===null?[false,null]:[true,C]}matchUTF8(B){return this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,0)!==null}replaceAll(B,e){return this.replaceAllFunc(B,()=>e,2*B.length+1)}replaceFirst(B,e){return this.replaceAllFunc(B,()=>e,1)}replaceAllFunc(B,e,t){let i=0,r=0,s="",C=x.fromUTF16(B),o=0;for(;r<=B.length;){let u=this.executeEngine(C,r,D.UNANCHORED,2);if(u===null||u.length===0)break;s+=B.substring(i,u[0]),(u[1]>i||u[0]===0)&&(s+=e(B.substring(u[0],u[1])),o++),i=u[1];let c=C.step(r)&7;if(r+c>u[1]?r+=c:r+1>u[1]?r++:r=u[1],o>=t)break}return s+=B.substring(i),s}pad(B){if(B===null)return null;let e=(1+this.numSubexp)*2;if(B.length<e){let t=new Array(e).fill(-1);for(let i=0;i<B.length;i++)t[i]=B[i];B=t;}return B}allMatches(B,e,t=i=>i){let i=[],r=B.endPos();e<0&&(e=r+1);let s=0,C=0,o=-1;for(;C<e&&s<=r;){let u=this.executeEngine(B,s,D.UNANCHORED,this.prog.numCap);if(u===null||u.length===0)break;let c=true;if(u[1]===s){u[0]===o&&(c=false);let p=B.step(s);p<0?s=r+1:s+=p&7;}else s=u[1];o=u[1],c&&(i.push(t(this.pad(u))),C++);}return i}findUTF8(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,2);return e===null?null:B.slice(e[0],e[1])}findUTF8Index(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,2);return e===null?null:e.slice(0,2)}find(B){let e=this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,2);return e===null?"":B.substring(e[0],e[1])}findIndex(B){return this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,2)}findUTF8Submatch(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,this.prog.numCap);if(e===null)return null;let t=new Array(1+this.numSubexp).fill(null);for(let i=0;i<t.length;i++)2*i<e.length&&e[2*i]>=0&&(t[i]=B.slice(e[2*i],e[2*i+1]));return t}findUTF8SubmatchIndex(B){return this.pad(this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,this.prog.numCap))}findSubmatch(B){let e=this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,this.prog.numCap);if(e===null)return null;let t=new Array(1+this.numSubexp).fill(null);for(let i=0;i<t.length;i++)2*i<e.length&&e[2*i]>=0&&(t[i]=B.substring(e[2*i],e[2*i+1]));return t}findSubmatchIndex(B){return this.pad(this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,this.prog.numCap))}findAllUTF8(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>B.slice(i[0],i[1]));return t.length===0?null:t}findAllUTF8Index(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>i.slice(0,2));return t.length===0?null:t}findAll(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>B.substring(i[0],i[1]));return t.length===0?null:t}findAllIndex(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>i.slice(0,2));return t.length===0?null:t}findAllUTF8Submatch(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>{let r=new Array(i.length/2|0).fill(null);for(let s=0;s<r.length;s++)i[2*s]>=0&&(r[s]=B.slice(i[2*s],i[2*s+1]));return r});return t.length===0?null:t}findAllUTF8SubmatchIndex(B,e){let t=this.allMatches(x.fromUTF8(B),e);return t.length===0?null:t}findAllSubmatch(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>{let r=new Array(i.length/2|0).fill(null);for(let s=0;s<r.length;s++)i[2*s]>=0&&(r[s]=B.substring(i[2*s],i[2*s+1]));return r});return t.length===0?null:t}findAllSubmatchIndex(B,e){let t=this.allMatches(x.fromUTF16(B),e);return t.length===0?null:t}},Li=class hB{static isHexadecimal(B){return "0"<=B&&B<="9"||"A"<=B&&B<="F"||"a"<=B&&B<="f"}static translate(B){let e="";if(B instanceof RegExp&&(B.ignoreCase&&(e+="i"),B.multiline&&(e+="m"),B.dotAll&&(e+="s"),B=B.source),typeof B!="string")return B;let t="",i=false,r=B.length;r===0&&(t="(?:)",i=true);let s=false,C=0;for(;C<r;){let u=B[C];if(u==="\\"){if(C+1<r)switch(u=B[C+1],u){case "\\":t+="\\\\",C+=2;continue;case "c":if(C+2<r){let g=B[C+2].charCodeAt(0);if(g>=65&&g<=90||g>=97&&g<=122){let d=g%32;t+="\\x",t+=(d>>4).toString(16).toUpperCase(),t+=(d&15).toString(16).toUpperCase(),C+=3,i=true;continue}}t+="c",C+=2,i=true;continue;case "u":if(C+2<r){if(B[C+2]==="{"){let g=C+3,d=false,O=false;for(;g<r;){let S=B[g];if(S==="}"){O=true;break}if(!hB.isHexadecimal(S))break;d=true,g++;}if(O&&d){t+="\\x",C+=2,i=true;continue}}else if(C+5<r){let g=true;for(let d=0;d<4;d++)if(!hB.isHexadecimal(B[C+2+d])){g=false;break}if(g){t+="\\x{"+B.substring(C+2,C+6)+"}",C+=6,i=true;continue}}}t+="u",C+=2,i=true;continue;case "x":{let g=false;if(C+2<r&&B[C+2]==="{"){let d=C+3,O=false,S=false;for(;d<r;){let L=B[d];if(L==="}"){S=true;break}if(!hB.isHexadecimal(L))break;O=true,d++;}S&&O&&(g=true);}else C+3<r&&hB.isHexadecimal(B[C+2])&&hB.isHexadecimal(B[C+3])&&(g=true);g?(t+="\\x",C+=2):(t+="x",C+=2,i=true);continue}case "n":case "r":case "t":case "a":case "f":case "v":case "d":case "D":case "s":case "S":case "w":case "W":case "b":case "B":case "p":case "P":case "A":case "z":case "Q":case "E":case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":t+="\\"+u,C+=2;continue;default:{let g=B.codePointAt(C+1);if(g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122){let d=F.charCount(g);t+=B.substring(C+1,C+1+d),C+=d+1,i=true;}else {t+="\\";let d=F.charCount(g);t+=B.substring(C+1,C+1+d),C+=d+1;}continue}}}else if(u==="/"){t+="\\/",C+=1,i=true;continue}else if(u==="[")s=true;else if(u==="]")s=false;else if(!s&&u==="("&&C+2<r&&B[C+1]==="?"&&B[C+2]==="<"&&C+3<r&&!"=!>)".includes(B[C+3])){t+="(?P<",C+=3,i=true;continue}let c=B.codePointAt(C),p=F.charCount(c);t+=B.substring(C,C+p),C+=p;}let o=i?t:B;return e.length>0?`(?${e})${o}`:o}},Ut=class P{static CASE_INSENSITIVE=X.CASE_INSENSITIVE;static DOTALL=X.DOTALL;static MULTILINE=X.MULTILINE;static DISABLE_UNICODE_GROUPS=X.DISABLE_UNICODE_GROUPS;static LONGEST_MATCH=X.LONGEST_MATCH;static LOOKBEHINDS=X.LOOKBEHINDS;static quote(B){return F.quoteMeta(B)}static quoteReplacement(B,e=false){return it.quoteReplacement(B,e)}static translateRegExp(B){return Li.translate(B)}static compile(B,e=0){let t=B;if((e&P.CASE_INSENSITIVE)!==0&&(t=`(?i)${t}`),(e&P.DOTALL)!==0&&(t=`(?s)${t}`),(e&P.MULTILINE)!==0&&(t=`(?m)${t}`),(e&-544)!==0)throw new ui("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let i=D.PERL;(e&P.DISABLE_UNICODE_GROUPS)!==0&&(i&=-129),(e&P.LOOKBEHINDS)!==0&&(i|=D.LOOKBEHIND);let r=new P(B,e);return r.re2Input=Ti.compileImpl(t,i,(e&P.LONGEST_MATCH)!==0),r}static matches(B,e){return P.compile(B).testExact(e)}static initTest(B,e,t){if(B==null)throw new Error("pattern is null");if(t==null)throw new Error("re2 is null");let i=new P(B,e);return i.re2Input=t,i}constructor(B,e){this.patternInput=B,this.flagsInput=e,this.re2Input=null;}reset(){this.re2Input.reset();}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(B){return this.testExact(B)}matcher(B){return F.isByteArray(B)&&(B=IB.utf8(B)),new it(this,B)}test(B){return F.isByteArray(B)?this.re2Input.matchUTF8(B):this.re2Input.match(B)}testExact(B){let e=F.isByteArray(B)?x.fromUTF8(B):x.fromUTF16(B);return this.re2Input.executeEngine(e,0,D.ANCHOR_BOTH,0)!==null}split(B,e=0){let t=this.matcher(B),i=[],r=0,s=0;for(;t.find();){if(s===0&&t.end()===0){s=t.end();continue}if(e>0&&i.length===e-1)break;if(s===t.start()){if(e===0){r+=1,s=t.end();continue}}else for(;r>0;)i.push(""),r-=1;i.push(t.substring(s,t.start())),s=t.end();}if(e===0&&s!==t.inputLength()){for(;r>0;)i.push(""),r-=1;i.push(t.substring(s,t.inputLength()));}return (e!==0||i.length===0)&&i.push(t.substring(s,t.inputLength())),i}*matchAll(B){let e=this.matcher(B);for(;e.find();){let t=[e.group(0)];for(let r=1;r<=e.groupCount();r++){let s=e.group(r);t.push(s===null?void 0:s);}t.index=e.start(0),t.input=B;let i=this.namedGroups();if(Object.keys(i).length>0){let r=e.getNamedGroups();for(let s in r)r[s]===null&&(r[s]=void 0);t.groups=r;}else t.groups=void 0;yield t;}}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(B){return this===B?true:B===null||this.constructor!==B.constructor?false:this.flagsInput===B.flagsInput&&this.patternInput===B.patternInput}};var pe=["number","string","boolean","wref","array"],wi=new Set(pe),Z=new Set([...pe,...pe.map(n=>`${n}?`)]);function V(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}var SB=new Set(["minLength","maxLength","pattern","enum"]),AB=new Set(["minimum","maximum","integer"]),NB=new Set(["shape"]),RB=new Set(["items","minItems","maxItems"]),vt=new Set(["type","description"]),VB=new Set([...vt,...SB,...AB,...NB,...RB]),bi={string:SB,number:AB,wref:NB,array:RB,boolean:new Set};function M(n){if(!V(n)||!("type"in n)||typeof n.type!="string"||!Z.has(n.type))return false;let B=n.type.endsWith("?")?n.type.slice(0,-1):n.type,e=bi[B]??new Set;return !(!Object.keys(n).every(t=>vt.has(t)||e.has(t))||"minLength"in n&&typeof n.minLength!="number"||"maxLength"in n&&typeof n.maxLength!="number"||"pattern"in n&&typeof n.pattern!="string"||"pattern"in n&&typeof n.pattern=="string"&&Z.has(n.pattern)&&(typeof n.type=="string"&&n.type.endsWith("?")?n.type.slice(0,-1):n.type)!=="string"||"enum"in n&&!Array.isArray(n.enum)||"minimum"in n&&typeof n.minimum!="number"||"maximum"in n&&typeof n.maximum!="number"||"integer"in n&&typeof n.integer!="boolean"||"shape"in n&&typeof n.shape!="string"||"shape"in n&&typeof n.shape=="string"&&Z.has(n.shape)&&(typeof n.type=="string"&&n.type.endsWith("?")?n.type.slice(0,-1):n.type)!=="wref"||"items"in n&&typeof n.items=="number"||"items"in n&&typeof n.items=="boolean"||"minItems"in n&&typeof n.minItems!="number"||"maxItems"in n&&typeof n.maxItems!="number")}function yi(n){return typeof n=="string"&&Z.has(n)?n:M(n)?n.type:null}function Kt(n){let B=yi(n);if(!B)return null;let e=B.endsWith("?")?B.slice(0,-1):B;return wi.has(e)?e:null}var Q=64*1024,TB=256,LB=256,xi="uses unsupported regex syntax",Ee=`WarmHub content fields are limited to ${Q} bytes. WarmHub is not a document store; store large documents in S3, Box, Drive, or another document system and reference them from WarmHub instead.`,Hi=new TextEncoder;function lB(n){return Hi.encode(n).byteLength}function fe(n,B){if(B.length*3<=Q)return null;let e=lB(B);return e<=Q?null:`Field "${n}" is ${e} bytes; ${Ee}`}function wB(n,B,e){let t=fe(n,B);t&&e.push(t);}function jB(n){try{return new RegExp(n),!1}catch{return true}}function _i(n){let B="",e=false;for(let t=0;t<n.length;t++){let i=n[t];if(i==="\\"){let r=n[t+1];if(e&&r==="b"){B+="\\x08",t++;continue}B+=i,r!==void 0&&(B+=r,t++);continue}i==="["?e=true:i==="]"&&(e=false),B+=i;}return B}function De(n){try{return Ut.compile(_i(n))}catch{return}}function Vt(n){return De(n)?void 0:xi}function $(n){return typeof n=="string"&&n.endsWith("?")?{spec:n.slice(0,-1),optionalByType:true}:M(n)&&typeof n.type=="string"&&n.type.endsWith("?")?{spec:{...n,type:n.type.slice(0,-1)},optionalByType:true}:{spec:n,optionalByType:false}}function YB(n,B){return n?.endsWith("?")||$(B).optionalByType}var jt=["org:read","org:configure","org:admin","org:action-callback"];function Gi(n){return jt.includes(n)}var Pi="003e7e6c-2f1e-53ea-9dfa-627edd04a8cc",Mi=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function Yt(n){if(!Mi.test(n))throw new Error("Operation-event submission ID must be a canonical UUID");let B=n.toLowerCase().replaceAll("-","");return Uint8Array.from({length:16},(e,t)=>Number.parseInt(B.slice(t*2,t*2+2),16))}function ge(n,B){return (n<<B|n>>>32-B)>>>0}function ki(n){let B=n.length*8,e=Math.ceil((n.length+9)/64)*64,t=new Uint8Array(e);t.set(n),t[n.length]=128;let i=new DataView(t.buffer);i.setUint32(e-8,Math.floor(B/4294967296)),i.setUint32(e-4,B>>>0);let r=1732584193,s=4023233417,C=2562383102,o=271733878,u=3285377520,c=new Uint32Array(80);for(let d=0;d<e;d+=64){for(let y=0;y<16;y+=1)c[y]=i.getUint32(d+y*4);for(let y=16;y<80;y+=1)c[y]=ge((c[y-3]??0)^(c[y-8]??0)^(c[y-14]??0)^(c[y-16]??0),1);let O=r,S=s,L=C,R=o,J=u;for(let y=0;y<80;y+=1){let W,q;y<20?(W=S&L|~S&R,q=1518500249):y<40?(W=S^L^R,q=1859775393):y<60?(W=S&L|S&R|L&R,q=2400959708):(W=S^L^R,q=3395469782);let xn=ge(O,5)+W+J+q+(c[y]??0)>>>0;J=R,R=L,L=ge(S,30),S=O,O=xn;}r=r+O>>>0,s=s+S>>>0,C=C+L>>>0,o=o+R>>>0,u=u+J>>>0;}let p=new Uint8Array(20),g=new DataView(p.buffer);for(let[d,O]of [r,s,C,o,u].entries())g.setUint32(d*4,O);return p}function Ji(n){let B=Array.from(n,e=>e.toString(16).padStart(2,"0")).join("").slice(0,32);return `${B.slice(0,8)}-${B.slice(8,12)}-${B.slice(12,16)}-${B.slice(16,20)}-${B.slice(20)}`}function Ui(n,B){if(!Number.isInteger(B)||B<0||B>2147483647)throw new Error("Stream chunk ordinal must be an integer from 0 through 2147483647");Yt(n);let e=n.toLowerCase(),t=Yt(Pi),i=new TextEncoder().encode(`${e}:${B}`),r=ki(Uint8Array.from([...t,...i])).slice(0,16);return r[6]=(r[6]??0)&15|80,r[8]=(r[8]??0)&63|128,Ji(r)}var de=new Set([8203,8204,8205,8288,8294,8295,8296,8297,8234,8235,8236,8237,8238,8232,8233]);function me(n){return n<=31||n===127||n>=128&&n<=159}function vi(n){return n<=65535?`\\u${n.toString(16).padStart(4,"0")}`:`\\u{${n.toString(16)}}`}function Ki(n){for(let B of n){let e=B.codePointAt(0);if(e!==void 0&&(me(e)||de.has(e)||e===34))return true}return false}function Vi(n){return n.length<=120?n:`${n.slice(0,120)}...<truncated>`}function Qt(n){if(!Ki(n))return n;let B=JSON.stringify(n).slice(1,-1),e="";for(let t of B){let i=t.codePointAt(0);i!==void 0&&(e+=me(i)||de.has(i)?vi(i):t);}return e}function _(n){return Vi(Qt(n))}function ji(n){return Qt(n)}function bB(n){if(n.length===0)return {unsafe:true,reason:"empty field name"};if(n!==n.trim())return {unsafe:true,reason:"leading or trailing whitespace"};for(let B of n){let e=B.codePointAt(0);if(e!==void 0){if(me(e))return {unsafe:true,reason:`control character (U+${e.toString(16).padStart(4,"0").toUpperCase()})`};if(de.has(e))return {unsafe:true,reason:`format or separator character (U+${e.toString(16).padStart(4,"0").toUpperCase()})`}}}return {unsafe:false}}function yB(n){return n.endsWith("?")?n.slice(0,-1):n}function tB(...n){return Wt(_,n)}function xB(...n){return Wt(ji,n)}function Wt(n,B){return B.map(e=>typeof e=="number"?`[${e}]`:n(e)).join(".").replace(/\.\[/g,"[")}function fB(n,B,e,t){let i=Yi(B);if(typeof n=="string"){if(i.length>0)return;wB(t??"<value>",n,e);return}if(Array.isArray(n)){let s=i.filter(Wi);if(i.length>0&&s.length===0)return;let C=QB(s.map(Qi));for(let o=0;o<n.length;o++)fB(n[o],C,e,`${t??"<value>"}[${o}]`);return}if(!V(n))return;let r=QB(i.map(qi));if(!(i.length>0&&r.length===0))for(let[s,C]of Object.entries(n)){let o=t?tB(t,s):_(s);wB(o,s,e),fB(C,QB(r.map(u=>u.get(s))),e,o);}}function Yi(n){return QB(n.map(B=>$(B).spec))}function QB(n){return n.filter(B=>B!==void 0)}function Qi(n){if(Array.isArray(n))return n[0];if(M(n)&&n.type==="array")return n.items}function Wi(n){return n==="array"||Array.isArray(n)?true:M(n)&&n.type==="array"}function qi(n){if(!V(n)||M(n))return;let B=new Map;for(let[e,t]of Object.entries(n))B.set(e.endsWith("?")?e.slice(0,-1):e,t);return B}var WB=500;function zt(n){let B=new Set;for(let e of Object.keys(n))B.add(e.endsWith("?")?e.slice(0,-1):e);return B}function Xt(n,B){let e=[],t=0;for(let i of Object.keys(n))B.has(i)||(t++,e.length<WB&&e.push(i));if(t!==0)return t>WB?{undeclaredFields:e,undeclaredFieldsTruncated:true,totalUndeclared:t}:{undeclaredFields:e}}function $t(n){let B=Zt(n);return (e,t)=>{for(let i of B){let r=e[i.fieldName];if(r==null){i.isOptional||t.push(`Missing required field: "${i.displayName}"`);continue}i.validate(i.displayName,r,t);}}}function Zt(n){return Object.entries(n).map(([B,e])=>{let t=B.endsWith("?")?B.slice(0,-1):B,i=$(e);return {fieldName:t,displayName:_(t),isOptional:YB(B,e),validate:Oe(i.spec)}})}function Oe(n){if(typeof n=="string")return (B,e,t)=>qt(B,e,n,t);if(Array.isArray(n)){let B=n.length>0?Oe($(n[0]).spec):void 0;return (e,t,i)=>{if(!Array.isArray(t))i.push(`Field "${e}" expected array, got ${typeof t}`);else if(B)for(let r=0;r<t.length;r++)B(`${e}[${r}]`,t[r],i);}}if(M(n)){if((n.type.endsWith("?")?n.type.slice(0,-1):n.type)==="array"){let t="items"in n&&n.items!=null?Oe($(n.items).spec):void 0;return (i,r,s)=>{if(!Array.isArray(r)){s.push(`Field "${i}" expected array, got ${typeof r}`);return}if(typeof n.minItems=="number"&&r.length<n.minItems&&s.push(`Field "${i}" has ${r.length} items, minimum is ${n.minItems}`),typeof n.maxItems=="number"&&r.length>n.maxItems&&s.push(`Field "${i}" has ${r.length} items, maximum is ${n.maxItems}`),t)for(let C=0;C<r.length;C++)t(`${i}[${C}]`,r[C],s);}}let e=zi(n);return (t,i,r)=>{qt(t,i,n.type,r),e(t,i,r);}}if(V(n)){let B=Zt(n);return (e,t,i)=>{if(typeof t!="object"||t===null||Array.isArray(t)){i.push(`Field "${e}" expected object, got ${typeof t}`);return}let r=t;for(let s of B){let C=r[s.fieldName],o=tB(e,s.fieldName);if(C==null){s.isOptional||i.push(`Missing required field: "${o}"`);continue}s.validate(o,C,i);}}}return ()=>{}}function zi(n){let B=typeof n.pattern=="string"?n.pattern:void 0,e=B===void 0?void 0:Xi(B);return (t,i,r)=>{if(typeof i=="string"){if(typeof n.minLength=="number"&&i.length<n.minLength&&r.push(`Field "${t}" length ${i.length} is below minimum ${n.minLength}`),typeof n.maxLength=="number"&&i.length>n.maxLength&&r.push(`Field "${t}" length ${i.length} exceeds maximum ${n.maxLength}`),B!==void 0){let s=_(B);e?.kind==="unsupported"?r.push(`Field "${t}" has unsupported pattern "${s}"`):e?.kind==="invalid"?r.push(`Field "${t}" has invalid pattern "${s}" \u2014 skipping regex check`):e?.kind==="compiled"&&!e.regex.test(i)&&r.push(`Field "${t}" does not match pattern "${s}"`);}Array.isArray(n.enum)&&!n.enum.includes(i)&&r.push(`Field "${t}" value "${_(String(i))}" is not in allowed values: ${n.enum.map(s=>_(String(s))).join(", ")}`);}typeof i=="number"&&(typeof n.minimum=="number"&&i<n.minimum&&r.push(`Field "${t}" value ${i} is below minimum ${n.minimum}`),typeof n.maximum=="number"&&i>n.maximum&&r.push(`Field "${t}" value ${i} exceeds maximum ${n.maximum}`),n.integer===true&&!Number.isInteger(i)&&r.push(`Field "${t}" must be an integer, got ${i}`));}}function Xi(n){if(jB(n))return {kind:"invalid"};let B=De(n);return B?{kind:"compiled",regex:B}:{kind:"unsupported"}}function qt(n,B,e,t){switch(e){case "number":typeof B!="number"&&t.push(`Field "${n}" expected number, got ${typeof B}`);break;case "string":typeof B!="string"?t.push(`Field "${n}" expected string, got ${typeof B}`):wB(n,B,t);break;case "wref":typeof B!="string"&&t.push(`Field "${n}" expected string, got ${typeof B}`);break;case "boolean":typeof B!="boolean"&&t.push(`Field "${n}" expected boolean, got ${typeof B}`);break;case "array":Array.isArray(B)||t.push(`Field "${n}" expected array, got ${typeof B}`);break;}}function Ie(n){let B=n.map(i=>$t(i.fields)),e=new Set;for(let i of n)for(let r of zt(i.fields))e.add(r);let t=n.map(i=>i.fields);return i=>{if(typeof i!="object"||i===null||Array.isArray(i))return {valid:false,errors:["Data must be a plain object"]};let r=i,s=[];for(let o of B)o(r,s);fB(r,t,s);let C=Xt(r,e);return s.length>0?C?{valid:false,errors:s,warnings:C}:{valid:false,errors:s}:C?{valid:true,warnings:C}:{valid:true}}}function Bn(n,B){return Fe(B)(n)}function Fe(n){return Ie([{name:"",fields:n}])}function Se(n){return (n.endsWith("?")?n.slice(0,-1):n).toLowerCase()}function en(n){return n.split(".").map(B=>Se(B)).join(".")}function $i(n,B){return n.allowUnsafeFieldNamePaths.has(B)}function HB(n,B,e,t,i){if(typeof e=="string"){Z.has(e)||t.push(`Invalid type at "${n}": "${_(e)}" (expected number|string|boolean|wref|array, optionally with ? suffix)`);return}if(Array.isArray(e)){if(e.length!==1){t.push(`Invalid array type at "${n}": array type spec must have exactly 1 element`);return}HB(`${n}[]`,`${B}[]`,e[0],t,i);return}if(V(e)){if(M(e)){Zi(n,B,e,t,i);return}if("type"in e&&typeof e.type=="string"&&Z.has(e.type)&&Object.keys(e).every(r=>VB.has(r))){let r=e.type.endsWith("?")?e.type.slice(0,-1):e.type,C=r==="string"?SB:r==="number"?AB:r==="wref"?NB:r==="array"?RB:new Set,o=Object.keys(e).filter(c=>c!=="type"&&c!=="description"&&!C.has(c));if(o.length>0&&o.some(p=>{let g=e[p];return typeof g!="string"&&!Array.isArray(g)&&!V(g)})){for(let p of o)t.push(`Constraint "${_(p)}" at "${n}" is not valid for type "${r}"`);return}if(o.length===0){let c=[];for(let[p,g]of Object.entries(e))p==="type"||p==="description"||C.has(p)&&((p==="minLength"||p==="maxLength"||p==="minimum"||p==="maximum"||p==="minItems"||p==="maxItems")&&typeof g!="number"?c.push(`Constraint "${p}" at "${n}" must be a number, got ${typeof g}`):p==="integer"&&typeof g!="boolean"?c.push(`Constraint "${p}" at "${n}" must be a boolean, got ${typeof g}`):p==="pattern"&&typeof g!="string"?c.push(`Constraint "${p}" at "${n}" must be a string, got ${typeof g}`):p==="enum"&&!Array.isArray(g)?c.push(`Constraint "${p}" at "${n}" must be an array, got ${typeof g}`):p==="shape"&&typeof g!="string"&&c.push(`Constraint "${p}" at "${n}" must be a string, got ${typeof g}`));if(c.length>0){t.push(...c);return}}if(Object.entries(e).some(([c,p])=>!(c==="type"||c==="description"||typeof p=="string"||Array.isArray(p)||V(p)))){t.push(`Object at "${n}" looks like a typed field object (type: "${_(String(e.type))}") but has constraint values with invalid types. Check that constraint values match their expected types (e.g., minLength must be a number, not a string).`);return}}for(let[r,s]of Object.entries(e)){let C=yB(r),o=bB(C),u=tB(n,r),c=xB(B,r);if(o.unsafe&&!$i(i,c)){t.push(`Invalid field name at "${u}": ${o.reason}`);continue}HB(u,c,s,t,i);}return}t.push(`Invalid type at "${n}": expected string, array, or object, got ${typeof e}`);}function Zi(n,B,e,t,i){let r=e.type;if(typeof r!="string"){t.push(`Invalid typed field object at "${n}": "type" must be a string`);return}if(!Z.has(r)){t.push(`Invalid type at "${n}.type": "${_(r)}" (expected number|string|boolean|wref|array, optionally with ? suffix)`);return}"description"in e&&typeof e.description!="string"&&t.push(`Invalid typed field object at "${n}": "description" must be a string`);let s=r.endsWith("?")?r.slice(0,-1):r;for(let C of Object.keys(e)){if(C==="type"||C==="description")continue;let o=_(C);s==="string"?SB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "string"`):s==="number"?AB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "number"`):s==="wref"?NB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "wref"`):s==="array"?RB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "array"`):t.push(`Constraint "${o}" at "${n}" is not valid for type "${s}"`);}if("minLength"in e&&(typeof e.minLength!="number"||!Number.isFinite(e.minLength)||e.minLength<0||!Number.isInteger(e.minLength))&&t.push(`"minLength" at "${n}" must be a non-negative finite integer`),"maxLength"in e&&(typeof e.maxLength!="number"||!Number.isFinite(e.maxLength)||e.maxLength<0||!Number.isInteger(e.maxLength))&&t.push(`"maxLength" at "${n}" must be a non-negative finite integer`),"minLength"in e&&"maxLength"in e&&typeof e.minLength=="number"&&typeof e.maxLength=="number"&&e.minLength>e.maxLength&&t.push(`"minLength" at "${n}" cannot exceed "maxLength"`),s==="string"&&typeof e.minLength=="number"&&Number.isFinite(e.minLength)&&Number.isInteger(e.minLength)&&e.minLength>Q&&t.push(`"minLength" at "${n}" cannot exceed ${Q}`),s==="string"&&typeof e.maxLength=="number"&&Number.isFinite(e.maxLength)&&Number.isInteger(e.maxLength)&&e.maxLength>Q&&t.push(`"maxLength" at "${n}" cannot exceed ${Q}`),"pattern"in e&&typeof e.pattern!="string"&&t.push(`"pattern" at "${n}" must be a string`),"pattern"in e&&typeof e.pattern=="string")if(jB(e.pattern))t.push(`"pattern" at "${n}" is not a valid regular expression`);else {let C=Vt(e.pattern);C&&t.push(`"pattern" at "${n}" ${C}`);}if("enum"in e){if(!Array.isArray(e.enum)||e.enum.length===0||!e.enum.every(C=>typeof C=="string"))t.push(`"enum" at "${n}" must be a non-empty array of strings`);else if(s==="string")for(let C of e.enum){let o=lB(C);if(o>Q){t.push(`"enum" value at "${n}" is ${o} bytes; string enum values cannot exceed ${Q} bytes`);break}}}"minimum"in e&&(typeof e.minimum!="number"||!Number.isFinite(e.minimum))&&t.push(`"minimum" at "${n}" must be a finite number`),"maximum"in e&&(typeof e.maximum!="number"||!Number.isFinite(e.maximum))&&t.push(`"maximum" at "${n}" must be a finite number`),"minimum"in e&&"maximum"in e&&typeof e.minimum=="number"&&typeof e.maximum=="number"&&e.minimum>e.maximum&&t.push(`"minimum" at "${n}" cannot exceed "maximum"`),"integer"in e&&typeof e.integer!="boolean"&&t.push(`"integer" at "${n}" must be a boolean`),"shape"in e&&(typeof e.shape!="string"?t.push(`"shape" at "${n}" must be a string (shape name)`):e.shape===""&&t.push(`"shape" at "${n}" must not be empty`)),"minItems"in e&&(typeof e.minItems!="number"||!Number.isFinite(e.minItems)||e.minItems<0||!Number.isInteger(e.minItems))&&t.push(`"minItems" at "${n}" must be a non-negative finite integer`),"maxItems"in e&&(typeof e.maxItems!="number"||!Number.isFinite(e.maxItems)||e.maxItems<0||!Number.isInteger(e.maxItems))&&t.push(`"maxItems" at "${n}" must be a non-negative finite integer`),"minItems"in e&&"maxItems"in e&&typeof e.minItems=="number"&&typeof e.maxItems=="number"&&e.minItems>e.maxItems&&t.push(`"minItems" at "${n}" cannot exceed "maxItems"`),s==="array"&&("items"in e?HB(`${n}.items`,`${B}.items`,e.items,t,i):t.push(`Typed array at "${n}" must have an "items" key specifying the element type`));}function Br(n={}){return {allowUnsafeFieldNamePaths:new Set(n.allowUnsafeFieldNamePaths??[])}}function er(n,B){return n.allowUnsafeFieldNamePaths.has(B)}var tr=new Set(["fields","description"]);function qB(n,B=""){let e=[];for(let[t,i]of Object.entries(n)){let r=t.endsWith("?")?t.slice(0,-1):t,s=B?`${B}.${r}`:r,C=Kt(i);if(C==="string"||C==="wref"||C==="number"||C==="boolean"){e.push(s);continue}M(i)||V(i)&&e.push(...qB(i,s));}return e}function Ne(n){return !(!V(n)||Array.isArray(n)||M(n)||"type"in n&&typeof n.type=="string"&&Z.has(n.type)&&Object.keys(n).every(B=>VB.has(B)))}function tn(n,B,e,t,i=B){let r=new Map;for(let[s,C]of Object.entries(n)){let o=yB(s),u=bB(o),c=tB(B,s),p=xB(i,s);if(u.unsafe&&!er(t,p)){e.push(`Invalid field name at "${c}": ${u.reason}`);continue}let g=Se(s),d=r.get(g);if(d!==void 0){e.push(`${tB(B,s)}: duplicate field name. Shape already declares "${_(d)}" (case-insensitive match).`);continue}r.set(g,s),Ne(C)?tn(C,c,e,t,p):HB(c,p,C,e,t);}}function Ae(n,B,e){if(Array.isArray(B)){B.length===1&&Ae(`${n}[]`,B[0],e);return}if(M(B)){let t=$(B).spec;M(t)&&typeof t.type=="string"&&t.type==="array"&&"items"in t&&Ae(`${n}.items`,t.items,e);return}Ne(B)&&Re(B,n,e);}function Re(n,B,e){for(let[t,i]of Object.entries(n)){let r=xB(B,t);bB(yB(t)).unsafe&&e.push(r),Ne(i)?Re(i,r,e):Ae(r,i,e);}}function nn(n){if(typeof n!="object"||n===null||Array.isArray(n))return [];let B=n.fields;if(typeof B!="object"||B===null||Array.isArray(B))return [];let e=[];return Re(B,"fields",e),e}function rn(n,B={}){if(typeof n!="object"||n===null||Array.isArray(n))return {valid:false,errors:["Shape definition must be a plain object"]};let e=n,t=[];for(let c of Object.keys(e))tr.has(c)||t.push(`Unsupported shape definition key "${_(c)}"`);if(!("fields"in e))return {valid:false,errors:['Shape definition must have a "fields" property']};let i=e.fields;if(typeof i!="object"||i===null||Array.isArray(i))return {valid:false,errors:['"fields" must be a plain object mapping field names to types']};let r=Br(B);tn(i,"fields",t,r);let s=qB(i),C=s.length,o=new Set,u=new Set;for(let c of s){let p=lB(c);p>LB&&t.push(`Indexable field path "${_(c)}" is ${p} bytes; maximum is ${LB}`);let g=en(c);if(o.has(g)){u.add(g);continue}o.add(g);}for(let c of u)t.push(`Shape declares ambiguous indexable field path "${_(c)}"; dotted field names, optional-key suffixes, and case-insensitive folded paths must not collide with another indexable path`);return C>TB&&t.push(`Shape declares ${C} indexable scalar fields; maximum is ${TB}`),"description"in e&&typeof e.description!="string"&&t.push('"description" must be a string'),fB(e,[],t),t.length>0?{valid:false,errors:t}:{valid:true}}function uB(n){if(!n||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(e=>uB(e)).join(",")}]`;let B=n;return `{${Object.keys(B).sort().map(e=>`${JSON.stringify(e)}:${uB(B[e])}`).join(",")}}`}var Te=["Arc","Bond","Pair","Set","List"],sn=["Triple"],ir=[...Te,...sn];function Cn(n){return Te.includes(n)}function zB(n){return sn.includes(n)}function XB(n){return ir.includes(n)}var rr=["Content"];var sr=["Readme","Agents"],Cr=["LlmsTxt"],on=n=>n==="Content";var an=n=>sr.includes(n),ln=n=>Cr.includes(n);var un=["View"],or=n=>un.includes(n),cn=["LicenseSubject","LicenseDeclaration"],ar=n=>cn.includes(n);function hn(n){return XB(n)||or(n)||ar(n)}function $B(n){return Te.includes(n)||rr.includes(n)||un.includes(n)||cn.includes(n)}function pn(n,B){let e=[];return Dr(n,e,B?.checkAddAdd??true,B),e}function Er(n,B){return B?.sourceOperationIndexes?.[n]??n}function fr(n){return n.name}function Dr(n,B,e,t){let i=new Map;for(let r=0;r<n.length;r++){let s=n[r];if(!s)continue;let C=fr(s);if(!C)continue;let u=re({...s,name:C})==="shape"?`shape:${C}`:`thing:${C}`,c=i.get(u)??[];c.push({operation:s.operation,index:Er(r,t)}),i.set(u,c);}for(let[r,s]of i)if(!(s.length<2))for(let C=1;C<s.length;C++){let o=s[C-1],u=s[C];if(!o||!u)continue;let c=`${o.operation}+${u.operation}`;e&&c==="add+add"&&B.push({code:"ILLEGAL_OP_SEQUENCE",operationIndex:u.index,message:`Cannot add "${r}" twice in the same commit`}),c==="revise+add"&&B.push({code:"ILLEGAL_OP_SEQUENCE",operationIndex:u.index,message:`Cannot revise then add "${r}" in the same commit`});}}var gr=["arc","bond","set","list","pair"],dr=["arc","bond","set","list"],mr=["add","revise"],Le="Collection create requires a name. Collections are ordinary named things (ADR 0004).",we='about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';function Or(n){return gr.find(B=>B===n)??null}function Ir(n){return mr.find(B=>B===n)??null}function En(n,B){let e=[];return e.push(...Fr(n,B)),e.push(...Sr(n,B)),e.push(...Ar(n,B)),e.push(...Nr(n,B)),e.push(...Rr(n,B)),e}function Fr(n,B){let e=[],t=n.name,i=n.operation==="rename"&&(n.kind==="shape"||n.name!==void 0&&!CB(n.name)),r=i&&t!==void 0&&hn(t)&&n.newName!==void 0&&!XB(n.newName)&&!$B(n.newName);if(t&&zB(t)&&!r&&e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${t}" is a retired collection shape and cannot be written manually`}),n.operation==="rename"&&(n.kind==="shape"||n.name!==void 0&&!CB(n.name))&&n.newName&&zB(n.newName))e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${n.newName}" is a retired collection shape and cannot be written manually`});else {let s=t&&$B(t)&&!r?t:i&&n.newName&&$B(n.newName)?n.newName:void 0;if(s&&(i||n.operation!=="retract"&&n.kind==="shape")){let C=n.operation==="add"?"created":n.operation==="rename"?"renamed":"revised";e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${s}" is a built-in shape and cannot be ${C} manually`});}}if(t){let s=CB(t);if(s&&zB(s.shapePrefix))e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Cannot ${n.operation} under retired collection shape "${s.shapePrefix}". Triple is read-only and retired for new collection writes.`});else if(n.kind==="thing"&&s&&Cn(s.shapePrefix)){let C=n.operation==="add"?`Cannot add kind="thing" under built-in shape "${s.shapePrefix}". Use kind="collection" instead.`:`Cannot revise kind="thing" under built-in shape "${s.shapePrefix}". Use kind="collection" to revise a collection.`;e.push({code:"VALIDATION_ERROR",operationIndex:B,message:C});}}return e}function Sr(n,B){if(n.kind!=="thing"||!n.name)return [];let e=CB(n.name);if(!e||!on(e.shapePrefix))return [];let t=e.bareName;return ln(t)?[{code:"READ_ONLY_BUILTIN_CONTENT",operationIndex:B,message:`${e.shapePrefix}/${t} is synthesized; writes are not allowed`}]:an(t)?[]:[{code:"UNKNOWN_CONTENT_NAME",operationIndex:B,message:`${e.shapePrefix}/${t} is not a recognized well-known content name`}]}function Ar(n,B){let e=[],t=n.name;if(n.newName?.includes("+"))return e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${n.newName}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`}),e;if(t?.includes("+")){if(n.kind==="collection"&&n.operation==="add")return e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${t}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`}),e;if(n.kind==="collection")return e;let i=CB(t);if(i&&XB(i.shapePrefix))return e;e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${t}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`});}return e}function Nr(n,B){let e=[];return !n.about||typeof n.about=="string"||e.push({code:"VALIDATION_ERROR",operationIndex:B,message:we}),e}function Rr(n,B){let e=[];if(n.kind!=="collection"||Ir(n.operation)===null)return e;n.operation==="add"&&!n.name&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:Le});let t=Or(n.type);if(t===null&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Collection "type" is invalid. Use one of: ${dr.join(", ")}. Got: "${n.type??""}"`}),!n.members||!Array.isArray(n.members))e.push({code:"VALIDATION_ERROR",operationIndex:B,message:'Collection requires a "members" array'});else for(let i=0;i<n.members.length;i++)typeof n.members[i]!="string"&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Collection member at index ${i} must be a string`});if(t!==null&&n.members){let i=Tr(t,n.members);i&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:i});}return e}function Tr(n,B){switch(n){case "arc":return B.length!==2?`Arc requires exactly 2 members, got ${B.length}`:null;case "bond":return B.length!==2?`Bond requires exactly 2 members, got ${B.length}`:null;case "pair":return B.length!==2?`Pair requires exactly 2 members, got ${B.length}`:null;case "set":case "list":return B.length<1?`${n==="set"?"Set":"List"} requires at least 1 member, got 0`:null;default:return n}}function Lr(n,B){return En(n,B)}function wr(n,B){return pn(n,B)}var br=new TextEncoder;async function ZB(n){let B=new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(n)));return Array.from(B,e=>e.toString(16).padStart(2,"0")).join("")}function _B(n){return nB(n),br.encode(n)}function nB(n){for(let B=0;B<n.length;B+=1){let e=n.charCodeAt(B);if(e>=55296&&e<=56319){let t=n.charCodeAt(B+1);if(!(t>=56320&&t<=57343))throw new RangeError("Checkpoint text must be valid Unicode");B+=1;}else if(e>=56320&&e<=57343)throw new RangeError("Checkpoint text must be valid Unicode")}}function iB(n,B){nB(n),nB(B);let e=0,t=0;for(;e<n.length&&t<B.length;){let i=n.codePointAt(e),r=B.codePointAt(t);if(i===void 0||r===void 0)break;let s=i-r;if(s!==0)return s;e+=i>65535?2:1,t+=r>65535?2:1;}return e===n.length&&t===B.length?0:e===n.length?-1:1}var He=67108864,Be=10,fn="warmhub-repository-checkpoint",Dn=2,yr="repository-checkpoint.json";var _e=z$1.string().regex(/^[0-9a-f]{64}$/),ye=z$1.number().int().nonnegative().safe(),xe=z$1.number().int().positive().safe(),xr=z$1.number().finite().refine(n=>!Number.isInteger(n)||Number.isSafeInteger(n),"JSON integers must be safe integers"),DB=z$1.lazy(()=>z$1.union([z$1.null(),z$1.boolean(),xr,z$1.string(),z$1.array(DB),z$1.record(z$1.string(),DB)])),be=z$1.object({wref:z$1.string().min(1),durableId:z$1.string().min(1),version:z$1.number().int().positive().safe(),active:z$1.literal(true),data:DB}),gn=z$1.string().regex(/^[^\r\n]+@v[1-9]\d*$/,"Checkpoint wref must be pinned with @vN"),Hr=z$1.array(gn).superRefine((n,B)=>{for(let e=1;e<n.length;e+=1){let t=n[e-1],i=n[e];t!==void 0&&i!==void 0&&iB(t,i)>=0&&B.addIssue({code:"custom",path:[e],message:"Affirmed wrefs must be unique and strictly increasing"});}}),Ge=z$1.discriminatedUnion("kind",[be.extend({kind:z$1.literal("shape")}).strict(),be.extend({kind:z$1.enum(["thing","collection"]),shapeName:z$1.string().min(1)}).strict(),be.extend({kind:z$1.literal("assertion"),shapeName:z$1.string().min(1),aboutWref:gn,affirmedWrefs:Hr}).strict()]),dn=z$1.object({part:ye,path:z$1.string().min(1),recordCount:xe,byteLength:xe,sha256:_e}).strict(),mn=z$1.object({shapeName:z$1.string().min(1),recordCount:xe,chunks:z$1.array(dn).min(1)}).strict(),_r={format:z$1.literal(fn),formatVersion:z$1.literal(Dn),checkpointId:z$1.string().uuid(),repository:z$1.object({id:z$1.string().uuid(),org:z$1.string().min(1),repo:z$1.string().min(1)}).strict(),repoSeq:ye,complete:z$1.literal(true),recordCount:ye,streams:z$1.array(mn)},Pe=z$1.object(_r).strict(),ee=Pe.extend({contentSha256:_e}).strict();new TextEncoder;var Gr=new TextDecoder("utf-8",{fatal:true});function Me(n,B){if(n.length===0||n.at(-1)!==10)throw new Error(`${B} must end with one LF`);if(n.length>=3&&n[0]===239&&n[1]===187&&n[2]===191)throw new Error(`${B} must not contain a UTF-8 BOM`);for(let e=0;e<n.length-1;e+=1)if(n[e]===10||n[e]===13)throw new Error(`${B} must contain exactly one LF and no CR`)}function gB(n,B,e){Me(n,e);let t=Gr.decode(n),i=B.parse(JSON.parse(t.slice(0,-1)));if(t!==`${uB(i)}
|
|
20
|
+
`)));let s=true;for(;!B.more()||B.peek()!==E.CODES.get("]")||s;){if(B.more()&&B.lookingAt("-")&&(this.flags&D.PERL_X)===0&&!s){let c=B.rest();if(c==="-"||!c.startsWith("-]"))throw B.rewindTo(e),new H(I.ERR_INVALID_CHAR_RANGE,B.rest())}s=false;let C=B.pos();if(B.lookingAt("[:")){if(this.parseNamedClass(B,i))continue;B.rewindTo(C);}if(this.parseUnicodeClass(B,i)||this.parsePerlClassEscape(B,i))continue;B.rewindTo(C);let o=I.parseClassChar(B,e),u=o;if(B.more()&&B.lookingAt("-")){if(B.skip(1),B.more()&&B.lookingAt("]"))B.skip(-1);else if(u=I.parseClassChar(B,e),u<o)throw new H(I.ERR_INVALID_CHAR_RANGE,B.from(C))}(this.flags&D.FOLD_CASE)===0?i.appendRange(o,u):i.appendFoldedRange(o,u);}B.skip(1),i.cleanClass(),r<0&&i.negateClass(),t.runes=i.toArray(),this.push(t);}},Ri=class{constructor(n){this.value=n;}get(){return this.value}set(n){this.value=n;}compareAndSet(n,B){return this.value===n?(this.value=B,true):false}},Ti=class aB{static initTest(B){let e=aB.compile(B),t=new aB(e.expr,e.prog,e.numSubexp,e.longest);return t.cond=e.cond,t.prefix=e.prefix,t.prefixUTF8=e.prefixUTF8,t.prefixComplete=e.prefixComplete,t.prefixRune=e.prefixRune,t.prefilter=e.prefilter,t}static compile(B){return aB.compileImpl(B,D.PERL,false)}static compilePOSIX(B){return aB.compileImpl(B,D.POSIX,true)}static compileImpl(B,e,t){let i=Jt.parse(B,e),r=i.maxCap();i=kt.simplify(i);let s=Si.build(i),C=Mt.compileRegexp(i),o=new aB(B,C,r,t);o.prefilter=s.type===b.Type.NONE?null:s;let[u,c]=C.prefix();return o.prefixComplete=u,o.prefix=c,o.prefixUTF8=F.stringToUtf8ByteArray(o.prefix),o.prefix.length>0&&(o.prefixRune=o.prefix.codePointAt(0)),o.namedGroups=i.namedGroups,o}static match(B,e){return aB.compile(B).match(e)}constructor(B,e,t=0,i=0){this.expr=B,this.prog=e,this.numSubexp=t,this.longest=i,this.cond=e.startCond(),this.prefix=null,this.prefixUTF8=null,this.prefixComplete=false,this.prefixRune=0,this.pooled=new Ri,this.dfa=new _t(this.prog),this.onepass=ot.compile(this.prog),this.prefilter=null;}matchPrefixComplete(B,e,t,i){if((t===D.ANCHOR_START||t===D.ANCHOR_BOTH)&&e!==0)return null;let r=-1,s=-1,C=B.prefixLength(this);if(t===D.UNANCHORED){let o=B.index(this,e);if(o<0)return null;r=e+o,s=r+C;}else if(t===D.ANCHOR_BOTH){if(B.endPos()!==C||B.index(this,0)!==0)return null;r=0,s=C;}else if(t===D.ANCHOR_START){if(B.index(this,0)!==0)return null;r=0,s=C;}if(r<0)return null;if(i>0){let o=new Int32Array(i).fill(-1);return o[0]=r,o[1]=s,Array.from(o)}return []}executeEngine(B,e,t,i){if(this.prefixComplete&&(i===0||this.numSubexp===0))return this.matchPrefixComplete(B,e,t,i);if(this.prefilter!==null&&t===D.UNANCHORED&&!this.prefilter.eval(B,e))return null;if(this.onepass!==null)return ot.execute(this,B,e,t,i);if(i>0)return this.prog.numLb===0&&B.endPos()<=kB.maxBitStateLen(this.prog)?kB.execute(this,B,e,t,i):this.doExecuteNFA(B,e,t,i);if(this.prog.numLb===0){let r=this.dfa.match(B,e,t);if(r!==null)return r?[]:null;if(B.endPos()<=kB.maxBitStateLen(this.prog))return kB.execute(this,B,e,t,i)}return this.doExecuteNFA(B,e,t,i)}numberOfCapturingGroups(){return this.numSubexp}numberOfInstructions(){return this.prog.numInst()}get(){let B;do B=this.pooled.get();while(B&&!this.pooled.compareAndSet(B,B.next));return B}reset(){this.pooled.set(null);}put(B,e){let t=this.pooled.get();do t=this.pooled.get(),!e&&t&&(B=UB.fromMachine(B),e=true),B.next!==t&&(B.next=t);while(!this.pooled.compareAndSet(t,B))}toString(){return this.expr}doExecuteNFA(B,e,t,i){let r=this.get(),s=false;r?r.next!==null&&(r=UB.fromMachine(r),s=true):(r=UB.fromRE2(this),s=true),r.init(i);let C=r.match(B,e,t)?r.submatches():null;return this.put(r,s),C}match(B){return this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,0)!==null}matchWithGroup(B,e,t,i,r){return B instanceof EB||(F.isByteArray(B)?B=IB.utf8(B):B=IB.utf16(B)),this.matchMachineInput(B,e,t,i,r)}matchMachineInput(B,e,t,i,r){if(e>t)return [false,null];let s=B.isUTF16Encoding()?x.fromUTF16(B.asCharSequence(),0,t):x.fromUTF8(B.asBytes(),0,t),C=this.executeEngine(s,e,i,2*r);return C===null?[false,null]:[true,C]}matchUTF8(B){return this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,0)!==null}replaceAll(B,e){return this.replaceAllFunc(B,()=>e,2*B.length+1)}replaceFirst(B,e){return this.replaceAllFunc(B,()=>e,1)}replaceAllFunc(B,e,t){let i=0,r=0,s="",C=x.fromUTF16(B),o=0;for(;r<=B.length;){let u=this.executeEngine(C,r,D.UNANCHORED,2);if(u===null||u.length===0)break;s+=B.substring(i,u[0]),(u[1]>i||u[0]===0)&&(s+=e(B.substring(u[0],u[1])),o++),i=u[1];let c=C.step(r)&7;if(r+c>u[1]?r+=c:r+1>u[1]?r++:r=u[1],o>=t)break}return s+=B.substring(i),s}pad(B){if(B===null)return null;let e=(1+this.numSubexp)*2;if(B.length<e){let t=new Array(e).fill(-1);for(let i=0;i<B.length;i++)t[i]=B[i];B=t;}return B}allMatches(B,e,t=i=>i){let i=[],r=B.endPos();e<0&&(e=r+1);let s=0,C=0,o=-1;for(;C<e&&s<=r;){let u=this.executeEngine(B,s,D.UNANCHORED,this.prog.numCap);if(u===null||u.length===0)break;let c=true;if(u[1]===s){u[0]===o&&(c=false);let p=B.step(s);p<0?s=r+1:s+=p&7;}else s=u[1];o=u[1],c&&(i.push(t(this.pad(u))),C++);}return i}findUTF8(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,2);return e===null?null:B.slice(e[0],e[1])}findUTF8Index(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,2);return e===null?null:e.slice(0,2)}find(B){let e=this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,2);return e===null?"":B.substring(e[0],e[1])}findIndex(B){return this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,2)}findUTF8Submatch(B){let e=this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,this.prog.numCap);if(e===null)return null;let t=new Array(1+this.numSubexp).fill(null);for(let i=0;i<t.length;i++)2*i<e.length&&e[2*i]>=0&&(t[i]=B.slice(e[2*i],e[2*i+1]));return t}findUTF8SubmatchIndex(B){return this.pad(this.executeEngine(x.fromUTF8(B),0,D.UNANCHORED,this.prog.numCap))}findSubmatch(B){let e=this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,this.prog.numCap);if(e===null)return null;let t=new Array(1+this.numSubexp).fill(null);for(let i=0;i<t.length;i++)2*i<e.length&&e[2*i]>=0&&(t[i]=B.substring(e[2*i],e[2*i+1]));return t}findSubmatchIndex(B){return this.pad(this.executeEngine(x.fromUTF16(B),0,D.UNANCHORED,this.prog.numCap))}findAllUTF8(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>B.slice(i[0],i[1]));return t.length===0?null:t}findAllUTF8Index(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>i.slice(0,2));return t.length===0?null:t}findAll(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>B.substring(i[0],i[1]));return t.length===0?null:t}findAllIndex(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>i.slice(0,2));return t.length===0?null:t}findAllUTF8Submatch(B,e){let t=this.allMatches(x.fromUTF8(B),e,i=>{let r=new Array(i.length/2|0).fill(null);for(let s=0;s<r.length;s++)i[2*s]>=0&&(r[s]=B.slice(i[2*s],i[2*s+1]));return r});return t.length===0?null:t}findAllUTF8SubmatchIndex(B,e){let t=this.allMatches(x.fromUTF8(B),e);return t.length===0?null:t}findAllSubmatch(B,e){let t=this.allMatches(x.fromUTF16(B),e,i=>{let r=new Array(i.length/2|0).fill(null);for(let s=0;s<r.length;s++)i[2*s]>=0&&(r[s]=B.substring(i[2*s],i[2*s+1]));return r});return t.length===0?null:t}findAllSubmatchIndex(B,e){let t=this.allMatches(x.fromUTF16(B),e);return t.length===0?null:t}},Li=class hB{static isHexadecimal(B){return "0"<=B&&B<="9"||"A"<=B&&B<="F"||"a"<=B&&B<="f"}static translate(B){let e="";if(B instanceof RegExp&&(B.ignoreCase&&(e+="i"),B.multiline&&(e+="m"),B.dotAll&&(e+="s"),B=B.source),typeof B!="string")return B;let t="",i=false,r=B.length;r===0&&(t="(?:)",i=true);let s=false,C=0;for(;C<r;){let u=B[C];if(u==="\\"){if(C+1<r)switch(u=B[C+1],u){case "\\":t+="\\\\",C+=2;continue;case "c":if(C+2<r){let g=B[C+2].charCodeAt(0);if(g>=65&&g<=90||g>=97&&g<=122){let d=g%32;t+="\\x",t+=(d>>4).toString(16).toUpperCase(),t+=(d&15).toString(16).toUpperCase(),C+=3,i=true;continue}}t+="c",C+=2,i=true;continue;case "u":if(C+2<r){if(B[C+2]==="{"){let g=C+3,d=false,O=false;for(;g<r;){let S=B[g];if(S==="}"){O=true;break}if(!hB.isHexadecimal(S))break;d=true,g++;}if(O&&d){t+="\\x",C+=2,i=true;continue}}else if(C+5<r){let g=true;for(let d=0;d<4;d++)if(!hB.isHexadecimal(B[C+2+d])){g=false;break}if(g){t+="\\x{"+B.substring(C+2,C+6)+"}",C+=6,i=true;continue}}}t+="u",C+=2,i=true;continue;case "x":{let g=false;if(C+2<r&&B[C+2]==="{"){let d=C+3,O=false,S=false;for(;d<r;){let L=B[d];if(L==="}"){S=true;break}if(!hB.isHexadecimal(L))break;O=true,d++;}S&&O&&(g=true);}else C+3<r&&hB.isHexadecimal(B[C+2])&&hB.isHexadecimal(B[C+3])&&(g=true);g?(t+="\\x",C+=2):(t+="x",C+=2,i=true);continue}case "n":case "r":case "t":case "a":case "f":case "v":case "d":case "D":case "s":case "S":case "w":case "W":case "b":case "B":case "p":case "P":case "A":case "z":case "Q":case "E":case "0":case "1":case "2":case "3":case "4":case "5":case "6":case "7":t+="\\"+u,C+=2;continue;default:{let g=B.codePointAt(C+1);if(g>=48&&g<=57||g>=65&&g<=90||g>=97&&g<=122){let d=F.charCount(g);t+=B.substring(C+1,C+1+d),C+=d+1,i=true;}else {t+="\\";let d=F.charCount(g);t+=B.substring(C+1,C+1+d),C+=d+1;}continue}}}else if(u==="/"){t+="\\/",C+=1,i=true;continue}else if(u==="[")s=true;else if(u==="]")s=false;else if(!s&&u==="("&&C+2<r&&B[C+1]==="?"&&B[C+2]==="<"&&C+3<r&&!"=!>)".includes(B[C+3])){t+="(?P<",C+=3,i=true;continue}let c=B.codePointAt(C),p=F.charCount(c);t+=B.substring(C,C+p),C+=p;}let o=i?t:B;return e.length>0?`(?${e})${o}`:o}},Ut=class P{static CASE_INSENSITIVE=X.CASE_INSENSITIVE;static DOTALL=X.DOTALL;static MULTILINE=X.MULTILINE;static DISABLE_UNICODE_GROUPS=X.DISABLE_UNICODE_GROUPS;static LONGEST_MATCH=X.LONGEST_MATCH;static LOOKBEHINDS=X.LOOKBEHINDS;static quote(B){return F.quoteMeta(B)}static quoteReplacement(B,e=false){return it.quoteReplacement(B,e)}static translateRegExp(B){return Li.translate(B)}static compile(B,e=0){let t=B;if((e&P.CASE_INSENSITIVE)!==0&&(t=`(?i)${t}`),(e&P.DOTALL)!==0&&(t=`(?s)${t}`),(e&P.MULTILINE)!==0&&(t=`(?m)${t}`),(e&-544)!==0)throw new ui("Flags should only be a combination of MULTILINE, DOTALL, CASE_INSENSITIVE, DISABLE_UNICODE_GROUPS, LONGEST_MATCH, LOOKBEHINDS");let i=D.PERL;(e&P.DISABLE_UNICODE_GROUPS)!==0&&(i&=-129),(e&P.LOOKBEHINDS)!==0&&(i|=D.LOOKBEHIND);let r=new P(B,e);return r.re2Input=Ti.compileImpl(t,i,(e&P.LONGEST_MATCH)!==0),r}static matches(B,e){return P.compile(B).testExact(e)}static initTest(B,e,t){if(B==null)throw new Error("pattern is null");if(t==null)throw new Error("re2 is null");let i=new P(B,e);return i.re2Input=t,i}constructor(B,e){this.patternInput=B,this.flagsInput=e,this.re2Input=null;}reset(){this.re2Input.reset();}flags(){return this.flagsInput}pattern(){return this.patternInput}re2(){return this.re2Input}matches(B){return this.testExact(B)}matcher(B){return F.isByteArray(B)&&(B=IB.utf8(B)),new it(this,B)}test(B){return F.isByteArray(B)?this.re2Input.matchUTF8(B):this.re2Input.match(B)}testExact(B){let e=F.isByteArray(B)?x.fromUTF8(B):x.fromUTF16(B);return this.re2Input.executeEngine(e,0,D.ANCHOR_BOTH,0)!==null}split(B,e=0){let t=this.matcher(B),i=[],r=0,s=0;for(;t.find();){if(s===0&&t.end()===0){s=t.end();continue}if(e>0&&i.length===e-1)break;if(s===t.start()){if(e===0){r+=1,s=t.end();continue}}else for(;r>0;)i.push(""),r-=1;i.push(t.substring(s,t.start())),s=t.end();}if(e===0&&s!==t.inputLength()){for(;r>0;)i.push(""),r-=1;i.push(t.substring(s,t.inputLength()));}return (e!==0||i.length===0)&&i.push(t.substring(s,t.inputLength())),i}*matchAll(B){let e=this.matcher(B);for(;e.find();){let t=[e.group(0)];for(let r=1;r<=e.groupCount();r++){let s=e.group(r);t.push(s===null?void 0:s);}t.index=e.start(0),t.input=B;let i=this.namedGroups();if(Object.keys(i).length>0){let r=e.getNamedGroups();for(let s in r)r[s]===null&&(r[s]=void 0);t.groups=r;}else t.groups=void 0;yield t;}}toString(){return this.patternInput}programSize(){return this.re2Input.numberOfInstructions()}groupCount(){return this.re2Input.numberOfCapturingGroups()}namedGroups(){return this.re2Input.namedGroups}equals(B){return this===B?true:B===null||this.constructor!==B.constructor?false:this.flagsInput===B.flagsInput&&this.patternInput===B.patternInput}};var pe=["number","string","boolean","wref","array"],wi=new Set(pe),Z=new Set([...pe,...pe.map(n=>`${n}?`)]);function V(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}var SB=new Set(["minLength","maxLength","pattern","enum"]),AB=new Set(["minimum","maximum","integer"]),NB=new Set(["shape"]),RB=new Set(["items","minItems","maxItems"]),vt=new Set(["type","description"]),VB=new Set([...vt,...SB,...AB,...NB,...RB]),bi={string:SB,number:AB,wref:NB,array:RB,boolean:new Set};function M(n){if(!V(n)||!("type"in n)||typeof n.type!="string"||!Z.has(n.type))return false;let B=n.type.endsWith("?")?n.type.slice(0,-1):n.type,e=bi[B]??new Set;return !(!Object.keys(n).every(t=>vt.has(t)||e.has(t))||"minLength"in n&&typeof n.minLength!="number"||"maxLength"in n&&typeof n.maxLength!="number"||"pattern"in n&&typeof n.pattern!="string"||"pattern"in n&&typeof n.pattern=="string"&&Z.has(n.pattern)&&B!=="string"||"enum"in n&&!Array.isArray(n.enum)||"minimum"in n&&typeof n.minimum!="number"||"maximum"in n&&typeof n.maximum!="number"||"integer"in n&&typeof n.integer!="boolean"||"shape"in n&&typeof n.shape!="string"||"shape"in n&&typeof n.shape=="string"&&Z.has(n.shape)&&B!=="wref"||"items"in n&&typeof n.items=="number"||"items"in n&&typeof n.items=="boolean"||"minItems"in n&&typeof n.minItems!="number"||"maxItems"in n&&typeof n.maxItems!="number")}function yi(n){return typeof n=="string"&&Z.has(n)?n:M(n)?n.type:null}function Kt(n){let B=yi(n);if(!B)return null;let e=B.endsWith("?")?B.slice(0,-1):B;return wi.has(e)?e:null}var Q=64*1024,TB=256,LB=256,xi="uses unsupported regex syntax",Ee=`WarmHub content fields are limited to ${Q} bytes. WarmHub is not a document store; store large documents in S3, Box, Drive, or another document system and reference them from WarmHub instead.`,Hi=new TextEncoder;function lB(n){return Hi.encode(n).byteLength}function fe(n,B){if(B.length*3<=Q)return null;let e=lB(B);return e<=Q?null:`Field "${n}" is ${e} bytes; ${Ee}`}function wB(n,B,e){let t=fe(n,B);t&&e.push(t);}function jB(n){try{return new RegExp(n),!1}catch{return true}}function _i(n){let B="",e=false;for(let t=0;t<n.length;t++){let i=n[t];if(i==="\\"){let r=n[t+1];if(e&&r==="b"){B+="\\x08",t++;continue}B+=i,r!==void 0&&(B+=r,t++);continue}i==="["?e=true:i==="]"&&(e=false),B+=i;}return B}function De(n){try{return Ut.compile(_i(n))}catch{return}}function Vt(n){return De(n)?void 0:xi}function $(n){return typeof n=="string"&&n.endsWith("?")?{spec:n.slice(0,-1),optionalByType:true}:M(n)&&typeof n.type=="string"&&n.type.endsWith("?")?{spec:{...n,type:n.type.slice(0,-1)},optionalByType:true}:{spec:n,optionalByType:false}}function YB(n,B){return n?.endsWith("?")||$(B).optionalByType}var jt=["org:read","org:configure","org:admin","org:action-callback"];function Gi(n){return jt.includes(n)}var Pi="003e7e6c-2f1e-53ea-9dfa-627edd04a8cc",Mi=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;function Yt(n){if(!Mi.test(n))throw new Error("Operation-event submission ID must be a canonical UUID");let B=n.toLowerCase().replaceAll("-","");return Uint8Array.from({length:16},(e,t)=>Number.parseInt(B.slice(t*2,t*2+2),16))}function ge(n,B){return (n<<B|n>>>32-B)>>>0}function ki(n){let B=n.length*8,e=Math.ceil((n.length+9)/64)*64,t=new Uint8Array(e);t.set(n),t[n.length]=128;let i=new DataView(t.buffer);i.setUint32(e-8,Math.floor(B/4294967296)),i.setUint32(e-4,B>>>0);let r=1732584193,s=4023233417,C=2562383102,o=271733878,u=3285377520,c=new Uint32Array(80);for(let d=0;d<e;d+=64){for(let y=0;y<16;y+=1)c[y]=i.getUint32(d+y*4);for(let y=16;y<80;y+=1)c[y]=ge((c[y-3]??0)^(c[y-8]??0)^(c[y-14]??0)^(c[y-16]??0),1);let O=r,S=s,L=C,R=o,J=u;for(let y=0;y<80;y+=1){let W,q;y<20?(W=S&L|~S&R,q=1518500249):y<40?(W=S^L^R,q=1859775393):y<60?(W=S&L|S&R|L&R,q=2400959708):(W=S^L^R,q=3395469782);let xn=ge(O,5)+W+J+q+(c[y]??0)>>>0;J=R,R=L,L=ge(S,30),S=O,O=xn;}r=r+O>>>0,s=s+S>>>0,C=C+L>>>0,o=o+R>>>0,u=u+J>>>0;}let p=new Uint8Array(20),g=new DataView(p.buffer);for(let[d,O]of [r,s,C,o,u].entries())g.setUint32(d*4,O);return p}function Ji(n){let B=Array.from(n,e=>e.toString(16).padStart(2,"0")).join("").slice(0,32);return `${B.slice(0,8)}-${B.slice(8,12)}-${B.slice(12,16)}-${B.slice(16,20)}-${B.slice(20)}`}function Ui(n,B){if(!Number.isInteger(B)||B<0||B>2147483647)throw new Error("Stream chunk ordinal must be an integer from 0 through 2147483647");Yt(n);let e=n.toLowerCase(),t=Yt(Pi),i=new TextEncoder().encode(`${e}:${B}`),r=ki(Uint8Array.from([...t,...i])).slice(0,16);return r[6]=(r[6]??0)&15|80,r[8]=(r[8]??0)&63|128,Ji(r)}var de=new Set([8203,8204,8205,8288,8294,8295,8296,8297,8234,8235,8236,8237,8238,8232,8233]);function me(n){return n<=31||n===127||n>=128&&n<=159}function vi(n){return n<=65535?`\\u${n.toString(16).padStart(4,"0")}`:`\\u{${n.toString(16)}}`}function Ki(n){for(let B of n){let e=B.codePointAt(0);if(e!==void 0&&(me(e)||de.has(e)||e===34))return true}return false}function Vi(n){return n.length<=120?n:`${n.slice(0,120)}...<truncated>`}function Qt(n){if(!Ki(n))return n;let B=JSON.stringify(n).slice(1,-1),e="";for(let t of B){let i=t.codePointAt(0);i!==void 0&&(e+=me(i)||de.has(i)?vi(i):t);}return e}function _(n){return Vi(Qt(n))}function ji(n){return Qt(n)}function bB(n){if(n.length===0)return {unsafe:true,reason:"empty field name"};if(n!==n.trim())return {unsafe:true,reason:"leading or trailing whitespace"};for(let B of n){let e=B.codePointAt(0);if(e!==void 0){if(me(e))return {unsafe:true,reason:`control character (U+${e.toString(16).padStart(4,"0").toUpperCase()})`};if(de.has(e))return {unsafe:true,reason:`format or separator character (U+${e.toString(16).padStart(4,"0").toUpperCase()})`}}}return {unsafe:false}}function yB(n){return n.endsWith("?")?n.slice(0,-1):n}function tB(...n){return Wt(_,n)}function xB(...n){return Wt(ji,n)}function Wt(n,B){return B.map(e=>typeof e=="number"?`[${e}]`:n(e)).join(".").replace(/\.\[/g,"[")}function fB(n,B,e,t){let i=Yi(B);if(typeof n=="string"){if(i.length>0)return;wB(t??"<value>",n,e);return}if(Array.isArray(n)){let s=i.filter(Wi);if(i.length>0&&s.length===0)return;let C=QB(s.map(Qi));for(let o=0;o<n.length;o++)fB(n[o],C,e,`${t??"<value>"}[${o}]`);return}if(!V(n))return;let r=QB(i.map(qi));if(!(i.length>0&&r.length===0))for(let[s,C]of Object.entries(n)){let o=t?tB(t,s):_(s);wB(o,s,e),fB(C,QB(r.map(u=>u.get(s))),e,o);}}function Yi(n){return QB(n.map(B=>$(B).spec))}function QB(n){return n.filter(B=>B!==void 0)}function Qi(n){if(Array.isArray(n))return n[0];if(M(n)&&n.type==="array")return n.items}function Wi(n){return n==="array"||Array.isArray(n)?true:M(n)&&n.type==="array"}function qi(n){if(!V(n)||M(n))return;let B=new Map;for(let[e,t]of Object.entries(n))B.set(e.endsWith("?")?e.slice(0,-1):e,t);return B}var WB=500;function zt(n){let B=new Set;for(let e of Object.keys(n))B.add(e.endsWith("?")?e.slice(0,-1):e);return B}function Xt(n,B){let e=[],t=0;for(let i of Object.keys(n))B.has(i)||(t++,e.length<WB&&e.push(i));if(t!==0)return t>WB?{undeclaredFields:e,undeclaredFieldsTruncated:true,totalUndeclared:t}:{undeclaredFields:e}}function $t(n){let B=Zt(n);return (e,t)=>{for(let i of B){let r=e[i.fieldName];if(r==null){i.isOptional||t.push(`Missing required field: "${i.displayName}"`);continue}i.validate(i.displayName,r,t);}}}function Zt(n){return Object.entries(n).map(([B,e])=>{let t=B.endsWith("?")?B.slice(0,-1):B,i=$(e);return {fieldName:t,displayName:_(t),isOptional:YB(B,e),validate:Oe(i.spec)}})}function Oe(n){if(typeof n=="string")return (B,e,t)=>qt(B,e,n,t);if(Array.isArray(n)){let B=n.length>0?Oe($(n[0]).spec):void 0;return (e,t,i)=>{if(!Array.isArray(t))i.push(`Field "${e}" expected array, got ${typeof t}`);else if(B)for(let r=0;r<t.length;r++)B(`${e}[${r}]`,t[r],i);}}if(M(n)){if((n.type.endsWith("?")?n.type.slice(0,-1):n.type)==="array"){let t="items"in n&&n.items!=null?Oe($(n.items).spec):void 0;return (i,r,s)=>{if(!Array.isArray(r)){s.push(`Field "${i}" expected array, got ${typeof r}`);return}if(typeof n.minItems=="number"&&r.length<n.minItems&&s.push(`Field "${i}" has ${r.length} items, minimum is ${n.minItems}`),typeof n.maxItems=="number"&&r.length>n.maxItems&&s.push(`Field "${i}" has ${r.length} items, maximum is ${n.maxItems}`),t)for(let C=0;C<r.length;C++)t(`${i}[${C}]`,r[C],s);}}let e=zi(n);return (t,i,r)=>{qt(t,i,n.type,r),e(t,i,r);}}if(V(n)){let B=Zt(n);return (e,t,i)=>{if(typeof t!="object"||t===null||Array.isArray(t)){i.push(`Field "${e}" expected object, got ${typeof t}`);return}let r=t;for(let s of B){let C=r[s.fieldName],o=tB(e,s.fieldName);if(C==null){s.isOptional||i.push(`Missing required field: "${o}"`);continue}s.validate(o,C,i);}}}return ()=>{}}function zi(n){let B=typeof n.pattern=="string"?n.pattern:void 0,e=B===void 0?void 0:Xi(B);return (t,i,r)=>{if(typeof i=="string"){if(typeof n.minLength=="number"&&i.length<n.minLength&&r.push(`Field "${t}" length ${i.length} is below minimum ${n.minLength}`),typeof n.maxLength=="number"&&i.length>n.maxLength&&r.push(`Field "${t}" length ${i.length} exceeds maximum ${n.maxLength}`),B!==void 0){let s=_(B);e?.kind==="unsupported"?r.push(`Field "${t}" has unsupported pattern "${s}"`):e?.kind==="invalid"?r.push(`Field "${t}" has invalid pattern "${s}" \u2014 skipping regex check`):e?.kind==="compiled"&&!e.regex.test(i)&&r.push(`Field "${t}" does not match pattern "${s}"`);}Array.isArray(n.enum)&&!n.enum.includes(i)&&r.push(`Field "${t}" value "${_(String(i))}" is not in allowed values: ${n.enum.map(s=>_(String(s))).join(", ")}`);}typeof i=="number"&&(typeof n.minimum=="number"&&i<n.minimum&&r.push(`Field "${t}" value ${i} is below minimum ${n.minimum}`),typeof n.maximum=="number"&&i>n.maximum&&r.push(`Field "${t}" value ${i} exceeds maximum ${n.maximum}`),n.integer===true&&!Number.isInteger(i)&&r.push(`Field "${t}" must be an integer, got ${i}`));}}function Xi(n){if(jB(n))return {kind:"invalid"};let B=De(n);return B?{kind:"compiled",regex:B}:{kind:"unsupported"}}function qt(n,B,e,t){switch(e){case "number":typeof B!="number"&&t.push(`Field "${n}" expected number, got ${typeof B}`);break;case "string":typeof B!="string"?t.push(`Field "${n}" expected string, got ${typeof B}`):wB(n,B,t);break;case "wref":typeof B!="string"&&t.push(`Field "${n}" expected string, got ${typeof B}`);break;case "boolean":typeof B!="boolean"&&t.push(`Field "${n}" expected boolean, got ${typeof B}`);break;case "array":Array.isArray(B)||t.push(`Field "${n}" expected array, got ${typeof B}`);break;}}function Ie(n){let B=n.map(i=>$t(i.fields)),e=new Set;for(let i of n)for(let r of zt(i.fields))e.add(r);let t=n.map(i=>i.fields);return i=>{if(typeof i!="object"||i===null||Array.isArray(i))return {valid:false,errors:["Data must be a plain object"]};let r=i,s=[];for(let o of B)o(r,s);fB(r,t,s);let C=Xt(r,e);return s.length>0?C?{valid:false,errors:s,warnings:C}:{valid:false,errors:s}:C?{valid:true,warnings:C}:{valid:true}}}function Bn(n,B){return Fe(B)(n)}function Fe(n){return Ie([{name:"",fields:n}])}function Se(n){return (n.endsWith("?")?n.slice(0,-1):n).toLowerCase()}function en(n){return n.split(".").map(B=>Se(B)).join(".")}function $i(n,B){return n.allowUnsafeFieldNamePaths.has(B)}function HB(n,B,e,t,i){if(typeof e=="string"){Z.has(e)||t.push(`Invalid type at "${n}": "${_(e)}" (expected number|string|boolean|wref|array, optionally with ? suffix)`);return}if(Array.isArray(e)){if(e.length!==1){t.push(`Invalid array type at "${n}": array type spec must have exactly 1 element`);return}HB(`${n}[]`,`${B}[]`,e[0],t,i);return}if(V(e)){if(M(e)){Zi(n,B,e,t,i);return}if("type"in e&&typeof e.type=="string"&&Z.has(e.type)&&Object.keys(e).every(r=>VB.has(r))){let r=e.type.endsWith("?")?e.type.slice(0,-1):e.type,C=r==="string"?SB:r==="number"?AB:r==="wref"?NB:r==="array"?RB:new Set,o=Object.keys(e).filter(c=>c!=="type"&&c!=="description"&&!C.has(c));if(o.length>0&&o.some(p=>{let g=e[p];return typeof g!="string"&&!Array.isArray(g)&&!V(g)})){for(let p of o)t.push(`Constraint "${_(p)}" at "${n}" is not valid for type "${r}"`);return}if(o.length===0){let c=[];for(let[p,g]of Object.entries(e))p==="type"||p==="description"||C.has(p)&&((p==="minLength"||p==="maxLength"||p==="minimum"||p==="maximum"||p==="minItems"||p==="maxItems")&&typeof g!="number"?c.push(`Constraint "${p}" at "${n}" must be a number, got ${typeof g}`):p==="integer"&&typeof g!="boolean"?c.push(`Constraint "${p}" at "${n}" must be a boolean, got ${typeof g}`):p==="pattern"&&typeof g!="string"?c.push(`Constraint "${p}" at "${n}" must be a string, got ${typeof g}`):p==="enum"&&!Array.isArray(g)?c.push(`Constraint "${p}" at "${n}" must be an array, got ${typeof g}`):p==="shape"&&typeof g!="string"&&c.push(`Constraint "${p}" at "${n}" must be a string, got ${typeof g}`));if(c.length>0){t.push(...c);return}}if(Object.entries(e).some(([c,p])=>!(c==="type"||c==="description"||typeof p=="string"||Array.isArray(p)||V(p)))){t.push(`Object at "${n}" looks like a typed field object (type: "${_(String(e.type))}") but has constraint values with invalid types. Check that constraint values match their expected types (e.g., minLength must be a number, not a string).`);return}}for(let[r,s]of Object.entries(e)){let C=yB(r),o=bB(C),u=tB(n,r),c=xB(B,r);if(o.unsafe&&!$i(i,c)){t.push(`Invalid field name at "${u}": ${o.reason}`);continue}HB(u,c,s,t,i);}return}t.push(`Invalid type at "${n}": expected string, array, or object, got ${typeof e}`);}function Zi(n,B,e,t,i){let r=e.type;if(typeof r!="string"){t.push(`Invalid typed field object at "${n}": "type" must be a string`);return}if(!Z.has(r)){t.push(`Invalid type at "${n}.type": "${_(r)}" (expected number|string|boolean|wref|array, optionally with ? suffix)`);return}"description"in e&&typeof e.description!="string"&&t.push(`Invalid typed field object at "${n}": "description" must be a string`);let s=r.endsWith("?")?r.slice(0,-1):r;for(let C of Object.keys(e)){if(C==="type"||C==="description")continue;let o=_(C);s==="string"?SB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "string"`):s==="number"?AB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "number"`):s==="wref"?NB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "wref"`):s==="array"?RB.has(C)||t.push(`Constraint "${o}" at "${n}" is not valid for type "array"`):t.push(`Constraint "${o}" at "${n}" is not valid for type "${s}"`);}if("minLength"in e&&(typeof e.minLength!="number"||!Number.isFinite(e.minLength)||e.minLength<0||!Number.isInteger(e.minLength))&&t.push(`"minLength" at "${n}" must be a non-negative finite integer`),"maxLength"in e&&(typeof e.maxLength!="number"||!Number.isFinite(e.maxLength)||e.maxLength<0||!Number.isInteger(e.maxLength))&&t.push(`"maxLength" at "${n}" must be a non-negative finite integer`),"minLength"in e&&"maxLength"in e&&typeof e.minLength=="number"&&typeof e.maxLength=="number"&&e.minLength>e.maxLength&&t.push(`"minLength" at "${n}" cannot exceed "maxLength"`),s==="string"&&typeof e.minLength=="number"&&Number.isFinite(e.minLength)&&Number.isInteger(e.minLength)&&e.minLength>Q&&t.push(`"minLength" at "${n}" cannot exceed ${Q}`),s==="string"&&typeof e.maxLength=="number"&&Number.isFinite(e.maxLength)&&Number.isInteger(e.maxLength)&&e.maxLength>Q&&t.push(`"maxLength" at "${n}" cannot exceed ${Q}`),"pattern"in e&&typeof e.pattern!="string"&&t.push(`"pattern" at "${n}" must be a string`),"pattern"in e&&typeof e.pattern=="string")if(jB(e.pattern))t.push(`"pattern" at "${n}" is not a valid regular expression`);else {let C=Vt(e.pattern);C&&t.push(`"pattern" at "${n}" ${C}`);}if("enum"in e){if(!Array.isArray(e.enum)||e.enum.length===0||!e.enum.every(C=>typeof C=="string"))t.push(`"enum" at "${n}" must be a non-empty array of strings`);else if(s==="string")for(let C of e.enum){let o=lB(C);if(o>Q){t.push(`"enum" value at "${n}" is ${o} bytes; string enum values cannot exceed ${Q} bytes`);break}}}"minimum"in e&&(typeof e.minimum!="number"||!Number.isFinite(e.minimum))&&t.push(`"minimum" at "${n}" must be a finite number`),"maximum"in e&&(typeof e.maximum!="number"||!Number.isFinite(e.maximum))&&t.push(`"maximum" at "${n}" must be a finite number`),"minimum"in e&&"maximum"in e&&typeof e.minimum=="number"&&typeof e.maximum=="number"&&e.minimum>e.maximum&&t.push(`"minimum" at "${n}" cannot exceed "maximum"`),"integer"in e&&typeof e.integer!="boolean"&&t.push(`"integer" at "${n}" must be a boolean`),"shape"in e&&(typeof e.shape!="string"?t.push(`"shape" at "${n}" must be a string (shape name)`):e.shape===""&&t.push(`"shape" at "${n}" must not be empty`)),"minItems"in e&&(typeof e.minItems!="number"||!Number.isFinite(e.minItems)||e.minItems<0||!Number.isInteger(e.minItems))&&t.push(`"minItems" at "${n}" must be a non-negative finite integer`),"maxItems"in e&&(typeof e.maxItems!="number"||!Number.isFinite(e.maxItems)||e.maxItems<0||!Number.isInteger(e.maxItems))&&t.push(`"maxItems" at "${n}" must be a non-negative finite integer`),"minItems"in e&&"maxItems"in e&&typeof e.minItems=="number"&&typeof e.maxItems=="number"&&e.minItems>e.maxItems&&t.push(`"minItems" at "${n}" cannot exceed "maxItems"`),s==="array"&&("items"in e?HB(`${n}.items`,`${B}.items`,e.items,t,i):t.push(`Typed array at "${n}" must have an "items" key specifying the element type`));}function Br(n={}){return {allowUnsafeFieldNamePaths:new Set(n.allowUnsafeFieldNamePaths??[])}}function er(n,B){return n.allowUnsafeFieldNamePaths.has(B)}var tr=new Set(["fields","description"]);function qB(n,B=""){let e=[];for(let[t,i]of Object.entries(n)){let r=t.endsWith("?")?t.slice(0,-1):t,s=B?`${B}.${r}`:r,C=Kt(i);if(C==="string"||C==="wref"||C==="number"||C==="boolean"){e.push(s);continue}M(i)||V(i)&&e.push(...qB(i,s));}return e}function Ne(n){return !(!V(n)||Array.isArray(n)||M(n)||"type"in n&&typeof n.type=="string"&&Z.has(n.type)&&Object.keys(n).every(B=>VB.has(B)))}function tn(n,B,e,t,i=B){let r=new Map;for(let[s,C]of Object.entries(n)){let o=yB(s),u=bB(o),c=tB(B,s),p=xB(i,s);if(u.unsafe&&!er(t,p)){e.push(`Invalid field name at "${c}": ${u.reason}`);continue}let g=Se(s),d=r.get(g);if(d!==void 0){e.push(`${tB(B,s)}: duplicate field name. Shape already declares "${_(d)}" (case-insensitive match).`);continue}r.set(g,s),Ne(C)?tn(C,c,e,t,p):HB(c,p,C,e,t);}}function Ae(n,B,e){if(Array.isArray(B)){B.length===1&&Ae(`${n}[]`,B[0],e);return}if(M(B)){let t=$(B).spec;M(t)&&typeof t.type=="string"&&t.type==="array"&&"items"in t&&Ae(`${n}.items`,t.items,e);return}Ne(B)&&Re(B,n,e);}function Re(n,B,e){for(let[t,i]of Object.entries(n)){let r=xB(B,t);bB(yB(t)).unsafe&&e.push(r),Ne(i)?Re(i,r,e):Ae(r,i,e);}}function nn(n){if(typeof n!="object"||n===null||Array.isArray(n))return [];let B=n.fields;if(typeof B!="object"||B===null||Array.isArray(B))return [];let e=[];return Re(B,"fields",e),e}function rn(n,B={}){if(typeof n!="object"||n===null||Array.isArray(n))return {valid:false,errors:["Shape definition must be a plain object"]};let e=n,t=[];for(let c of Object.keys(e))tr.has(c)||t.push(`Unsupported shape definition key "${_(c)}"`);if(!("fields"in e))return {valid:false,errors:['Shape definition must have a "fields" property']};let i=e.fields;if(typeof i!="object"||i===null||Array.isArray(i))return {valid:false,errors:['"fields" must be a plain object mapping field names to types']};let r=Br(B);tn(i,"fields",t,r);let s=qB(i),C=s.length,o=new Set,u=new Set;for(let c of s){let p=lB(c);p>LB&&t.push(`Indexable field path "${_(c)}" is ${p} bytes; maximum is ${LB}`);let g=en(c);if(o.has(g)){u.add(g);continue}o.add(g);}for(let c of u)t.push(`Shape declares ambiguous indexable field path "${_(c)}"; dotted field names, optional-key suffixes, and case-insensitive folded paths must not collide with another indexable path`);return C>TB&&t.push(`Shape declares ${C} indexable scalar fields; maximum is ${TB}`),"description"in e&&typeof e.description!="string"&&t.push('"description" must be a string'),fB(e,[],t),t.length>0?{valid:false,errors:t}:{valid:true}}function uB(n){if(!n||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(e=>uB(e)).join(",")}]`;let B=n;return `{${Object.keys(B).sort().map(e=>`${JSON.stringify(e)}:${uB(B[e])}`).join(",")}}`}var Te=["Arc","Bond","Pair","Set","List"],sn=["Triple"],ir=[...Te,...sn];function Cn(n){return Te.includes(n)}function zB(n){return sn.includes(n)}function XB(n){return ir.includes(n)}var rr=["Content"];var sr=["Readme","Agents"],Cr=["LlmsTxt"],on=n=>n==="Content";var an=n=>sr.includes(n),ln=n=>Cr.includes(n);var un=["View"],or=n=>un.includes(n),cn=["LicenseSubject","LicenseDeclaration"],ar=n=>cn.includes(n);function hn(n){return XB(n)||or(n)||ar(n)}function $B(n){return Te.includes(n)||rr.includes(n)||un.includes(n)||cn.includes(n)}function pn(n,B){let e=[];return Dr(n,e,B?.checkAddAdd??true,B),e}function Er(n,B){return B?.sourceOperationIndexes?.[n]??n}function fr(n){return n.name}function Dr(n,B,e,t){let i=new Map;for(let r=0;r<n.length;r++){let s=n[r];if(!s)continue;let C=fr(s);if(!C)continue;let u=re({...s,name:C})==="shape"?`shape:${C}`:`thing:${C}`,c=i.get(u)??[];c.push({operation:s.operation,index:Er(r,t)}),i.set(u,c);}for(let[r,s]of i)if(!(s.length<2))for(let C=1;C<s.length;C++){let o=s[C-1],u=s[C];if(!o||!u)continue;let c=`${o.operation}+${u.operation}`;e&&c==="add+add"&&B.push({code:"ILLEGAL_OP_SEQUENCE",operationIndex:u.index,message:`Cannot add "${r}" twice in the same commit`}),c==="revise+add"&&B.push({code:"ILLEGAL_OP_SEQUENCE",operationIndex:u.index,message:`Cannot revise then add "${r}" in the same commit`});}}var gr=["arc","bond","set","list","pair"],dr=["arc","bond","set","list"],mr=["add","revise"],Le="Collection create requires a name. Collections are ordinary named things (ADR 0004).",we='about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';function Or(n){return gr.find(B=>B===n)??null}function Ir(n){return mr.find(B=>B===n)??null}function En(n,B){let e=[];return e.push(...Fr(n,B)),e.push(...Sr(n,B)),e.push(...Ar(n,B)),e.push(...Nr(n,B)),e.push(...Rr(n,B)),e}function Fr(n,B){let e=[],t=n.name,i=n.operation==="rename"&&(n.kind==="shape"||n.name!==void 0&&!CB(n.name)),r=i&&t!==void 0&&hn(t)&&n.newName!==void 0&&!XB(n.newName)&&!$B(n.newName);if(t&&zB(t)&&!r&&e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${t}" is a retired collection shape and cannot be written manually`}),n.operation==="rename"&&(n.kind==="shape"||n.name!==void 0&&!CB(n.name))&&n.newName&&zB(n.newName))e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${n.newName}" is a retired collection shape and cannot be written manually`});else {let s=t&&$B(t)&&!r?t:i&&n.newName&&$B(n.newName)?n.newName:void 0;if(s&&(i||n.operation!=="retract"&&n.kind==="shape")){let C=n.operation==="add"?"created":n.operation==="rename"?"renamed":"revised";e.push({code:"RESERVED_NAME",operationIndex:B,message:`Shape "${s}" is a built-in shape and cannot be ${C} manually`});}}if(t){let s=CB(t);if(s&&zB(s.shapePrefix))e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Cannot ${n.operation} under retired collection shape "${s.shapePrefix}". Triple is read-only and retired for new collection writes.`});else if(n.kind==="thing"&&s&&Cn(s.shapePrefix)){let C=n.operation==="add"?`Cannot add kind="thing" under built-in shape "${s.shapePrefix}". Use kind="collection" instead.`:`Cannot revise kind="thing" under built-in shape "${s.shapePrefix}". Use kind="collection" to revise a collection.`;e.push({code:"VALIDATION_ERROR",operationIndex:B,message:C});}}return e}function Sr(n,B){if(n.kind!=="thing"||!n.name)return [];let e=CB(n.name);if(!e||!on(e.shapePrefix))return [];let t=e.bareName;return ln(t)?[{code:"READ_ONLY_BUILTIN_CONTENT",operationIndex:B,message:`${e.shapePrefix}/${t} is synthesized; writes are not allowed`}]:an(t)?[]:[{code:"UNKNOWN_CONTENT_NAME",operationIndex:B,message:`${e.shapePrefix}/${t} is not a recognized well-known content name`}]}function Ar(n,B){let e=[],t=n.name;if(n.newName?.includes("+"))return e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${n.newName}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`}),e;if(t?.includes("+")){if(n.kind==="collection"&&n.operation==="add")return e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${t}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`}),e;if(n.kind==="collection")return e;let i=CB(t);if(i&&XB(i.shapePrefix))return e;e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Name "${t}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`});}return e}function Nr(n,B){let e=[];return !n.about||typeof n.about=="string"||e.push({code:"VALIDATION_ERROR",operationIndex:B,message:we}),e}function Rr(n,B){let e=[];if(n.kind!=="collection"||Ir(n.operation)===null)return e;n.operation==="add"&&!n.name&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:Le});let t=Or(n.type);if(t===null&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Collection "type" is invalid. Use one of: ${dr.join(", ")}. Got: "${n.type??""}"`}),!n.members||!Array.isArray(n.members))e.push({code:"VALIDATION_ERROR",operationIndex:B,message:'Collection requires a "members" array'});else for(let i=0;i<n.members.length;i++)typeof n.members[i]!="string"&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:`Collection member at index ${i} must be a string`});if(t!==null&&n.members){let i=Tr(t,n.members);i&&e.push({code:"VALIDATION_ERROR",operationIndex:B,message:i});}return e}function Tr(n,B){switch(n){case "arc":return B.length!==2?`Arc requires exactly 2 members, got ${B.length}`:null;case "bond":return B.length!==2?`Bond requires exactly 2 members, got ${B.length}`:null;case "pair":return B.length!==2?`Pair requires exactly 2 members, got ${B.length}`:null;case "set":case "list":return B.length<1?`${n==="set"?"Set":"List"} requires at least 1 member, got 0`:null;default:return n}}function Lr(n,B){return En(n,B)}function wr(n,B){return pn(n,B)}var br=new TextEncoder;async function ZB(n){let B=new Uint8Array(await crypto.subtle.digest("SHA-256",Uint8Array.from(n)));return Array.from(B,e=>e.toString(16).padStart(2,"0")).join("")}function _B(n){return nB(n),br.encode(n)}function nB(n){for(let B=0;B<n.length;B+=1){let e=n.charCodeAt(B);if(e>=55296&&e<=56319){let t=n.charCodeAt(B+1);if(!(t>=56320&&t<=57343))throw new RangeError("Checkpoint text must be valid Unicode");B+=1;}else if(e>=56320&&e<=57343)throw new RangeError("Checkpoint text must be valid Unicode")}}function iB(n,B){nB(n),nB(B);let e=0,t=0;for(;e<n.length&&t<B.length;){let i=n.codePointAt(e),r=B.codePointAt(t);if(i===void 0||r===void 0)break;let s=i-r;if(s!==0)return s;e+=i>65535?2:1,t+=r>65535?2:1;}return e===n.length&&t===B.length?0:e===n.length?-1:1}var He=67108864,Be=10,fn="warmhub-repository-checkpoint",Dn=2,yr="repository-checkpoint.json";var _e=z$1.string().regex(/^[0-9a-f]{64}$/),ye=z$1.number().int().nonnegative().safe(),xe=z$1.number().int().positive().safe(),xr=z$1.number().finite().refine(n=>!Number.isInteger(n)||Number.isSafeInteger(n),"JSON integers must be safe integers"),DB=z$1.lazy(()=>z$1.union([z$1.null(),z$1.boolean(),xr,z$1.string(),z$1.array(DB),z$1.record(z$1.string(),DB)])),be=z$1.object({wref:z$1.string().min(1),durableId:z$1.string().min(1),version:z$1.number().int().positive().safe(),active:z$1.literal(true),data:DB}),gn=z$1.string().regex(/^[^\r\n]+@v[1-9]\d*$/,"Checkpoint wref must be pinned with @vN"),Hr=z$1.array(gn).superRefine((n,B)=>{for(let e=1;e<n.length;e+=1){let t=n[e-1],i=n[e];t!==void 0&&i!==void 0&&iB(t,i)>=0&&B.addIssue({code:"custom",path:[e],message:"Affirmed wrefs must be unique and strictly increasing"});}}),Ge=z$1.discriminatedUnion("kind",[be.extend({kind:z$1.literal("shape")}).strict(),be.extend({kind:z$1.enum(["thing","collection"]),shapeName:z$1.string().min(1)}).strict(),be.extend({kind:z$1.literal("assertion"),shapeName:z$1.string().min(1),aboutWref:gn,affirmedWrefs:Hr}).strict()]),dn=z$1.object({part:ye,path:z$1.string().min(1),recordCount:xe,byteLength:xe,sha256:_e}).strict(),mn=z$1.object({shapeName:z$1.string().min(1),recordCount:xe,chunks:z$1.array(dn).min(1)}).strict(),_r={format:z$1.literal(fn),formatVersion:z$1.literal(Dn),checkpointId:z$1.string().uuid(),repository:z$1.object({id:z$1.string().uuid(),org:z$1.string().min(1),repo:z$1.string().min(1)}).strict(),repoSeq:ye,complete:z$1.literal(true),recordCount:ye,streams:z$1.array(mn)},Pe=z$1.object(_r).strict(),ee=Pe.extend({contentSha256:_e}).strict();new TextEncoder;var Gr=new TextDecoder("utf-8",{fatal:true});function Me(n,B){if(n.length===0||n.at(-1)!==10)throw new Error(`${B} must end with one LF`);if(n.length>=3&&n[0]===239&&n[1]===187&&n[2]===191)throw new Error(`${B} must not contain a UTF-8 BOM`);for(let e=0;e<n.length-1;e+=1)if(n[e]===10||n[e]===13)throw new Error(`${B} must contain exactly one LF and no CR`)}function gB(n,B,e){Me(n,e);let t=Gr.decode(n),i=B.parse(JSON.parse(t.slice(0,-1)));if(t!==`${uB(i)}
|
|
21
21
|
`)throw new Error(`${e} bytes are not canonical`);return i}var On=10**Be-1;async function Pr(n){if(n.length===0)throw new RangeError("Checkpoint Shape name must not be empty");return ZB(_B(n))}async function Mr(n,B){return kr(B),`records/${await Pr(n)}/part-${B.toString().padStart(Be,"0")}.jsonl`}async function In(n,B,e){let t=await Mr(B,e);if(n!==t)throw new Error("Checkpoint chunk path does not match its Shape and part")}function kr(n){if(!Number.isSafeInteger(n)||n<0||n>On)throw new RangeError(`Checkpoint chunk part must be an integer from 0 through ${On}`)}var Jr=new TextDecoder("utf-8",{fatal:true});async function ke(n){let B=ee.parse(n),{contentSha256:e,...t}=B;await Kr(t);let i=await vr(t);if(e!==i)throw new Error("Checkpoint manifest content digest does not match");return B}async function Sn(n){let B=await ke(n);return _B(`${uB(B)}
|
|
22
22
|
`)}async function Ur(n){Me(n,"Checkpoint manifest");let B=Jr.decode(n),e=await ke(ee.parse(JSON.parse(B.slice(0,-1)))),t=await Sn(e);if(!Vr(n,t))throw new Error("Checkpoint manifest bytes are not canonical");return e}async function vr(n){return ZB(_B(uB(n)))}async function Kr(n){let B,e=0;for(let t of n.streams){if(B!==void 0&&iB(B,t.shapeName)>=0)throw new Error("Checkpoint manifest streams must be strictly increasing by Shape name");B=t.shapeName;let i=0;for(let[r,s]of t.chunks.entries()){if(s.part!==r)throw new Error("Checkpoint manifest chunk parts must be contiguous and zero-based");if(await In(s.path,t.shapeName,s.part),s.byteLength>He&&s.recordCount!==1)throw new Error("An oversized checkpoint chunk must contain exactly one row");i=Fn(i,s.recordCount);}if(t.recordCount!==i)throw new Error("Checkpoint manifest stream record count does not match");e=Fn(e,t.recordCount);}if(n.recordCount!==e)throw new Error("Checkpoint manifest record count does not match")}function Fn(n,B){let e=n+B;if(!Number.isSafeInteger(e))throw new RangeError("Checkpoint manifest count sum must be a safe integer");return e}function Vr(n,B){return n.length!==B.length?false:n.every((e,t)=>e===B[t])}function Yr(n){return gB(n,Ge,"Checkpoint row")}function Qr(n){if(n.length===0)throw new Error("Checkpoint stream Shape name must not be empty");return nB(n),{shapeName:n,recordCount:0,hasShapeDefinition:false}}function Wr(n,B){let e=B;if(nB(e.wref),nB(e.durableId),e.kind==="assertion"&&nB(e.aboutWref),(e.kind==="shape"?e.wref:e.shapeName)!==n.shapeName)throw new Error("Checkpoint row is grouped under the wrong Shape stream");if(e.kind!=="shape"){let i=`${e.shapeName}/`;if(!e.wref.startsWith(i)||e.wref.length===i.length)throw new Error("Checkpoint row wref does not belong to its declared Shape")}if(n.previousWref!==void 0&&iB(n.previousWref,e.wref)>=0)throw new Error("Checkpoint stream rows must be strictly increasing by wref");return e.kind==="shape"&&(n.hasShapeDefinition=true),n.previousWref=e.wref,n.recordCount=zr(n.recordCount),e}function qr(n){if(!n.hasShapeDefinition)throw new Error("Checkpoint stream must contain its matching Shape definition");return n.recordCount}function zr(n){let B=n+1;if(!Number.isSafeInteger(B))throw new RangeError("Checkpoint stream record count must be a safe integer");return B}var Nn=3,Xr="application/x-ndjson",Rn=z$1.string().regex(/^[0-9a-f]{64}$/),te=z$1.number().int().nonnegative(),Ue=z$1.number().int().positive(),Tn=["shape","thing","collection","assertion"],Ln=["heads","ops"],wn=["captured","migration-stamped","reconstructed"],ve=z$1.object({name:z$1.string().min(1),v:Ue,durableId:z$1.string().min(1),provenance:z$1.enum(wn),declared:z$1.boolean()}).strict(),Ke=z$1.object({wref:z$1.string().min(1),v:Ue.optional(),durableId:z$1.string().min(1)}).strict();function bn(n,B,e,t){let i;n.forEach((r,s)=>{let C=B(r);i!==void 0&&iB(i,C)>=0&&t.addIssue({code:"custom",path:[s],message:e}),i=C;});}var An=z$1.array(ve).superRefine((n,B)=>{bn(n,e=>e.durableId,"Shape certificates must be unique and strictly increasing by durableId",B);}),$r=z$1.array(Ke).superRefine((n,B)=>{bn(n,e=>e.wref,"Affirmed references must be unique and strictly increasing",B);}),yn={wref:z$1.string().min(1),durableId:z$1.string().min(1),version:Ue},Je={...yn,active:z$1.literal(true),data:z$1.record(z$1.string(),DB)},Zr=z$1.discriminatedUnion("kind",[z$1.object({...Je,kind:z$1.literal("shape"),shapes:z$1.array(ve).max(0)}).strict(),z$1.object({...Je,kind:z$1.enum(["thing","collection"]),shapes:An}).strict(),z$1.object({...Je,kind:z$1.literal("assertion"),shapes:An,about:Ke,affirmed:$r}).strict()]),Bs=z$1.object({...yn,kind:z$1.enum(Tn),active:z$1.literal(false)}).strict(),Ve=z$1.union([Zr,Bs]),je=z$1.object({kind:z$1.literal("header"),formatVersion:z$1.literal(Nn),repo:z$1.string().regex(/^[^/\s]+\/[^/\s]+$/,'repo must be "<org>/<repo>"'),mode:z$1.enum(Ln),sinceRepoSeq:te,atRepoSeq:te}).strict().refine(n=>n.atRepoSeq>=n.sinceRepoSeq,"atRepoSeq must not precede sinceRepoSeq"),Ye=z$1.object({kind:z$1.literal("trailer"),recordCount:te,contentSha256:Rn,atRepoSeq:te}).strict();function es(n){return n.sinceRepoSeq>0}function ts(n){return gB(n,Ve,"Repository export row")}function ns(n){return gB(n,je,"Repository export header")}function is(n){return gB(n,Ye,"Repository export trailer")}var rs=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ss=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),dB=64;function BB(n,B){return (n>>>B|n<<32-B)>>>0}var ne=class{#e=Uint32Array.from(ss);#t=new Uint32Array(64);#n=new Uint8Array(dB);#B=0;#i=0;#r=false;update(B){if(this.#r)throw new Error("SHA-256 hasher is already finalized");if(this.#i+=B.length,!Number.isSafeInteger(this.#i))throw new RangeError("SHA-256 input length must be a safe integer");let e=0;if(this.#B>0){let t=Math.min(dB-this.#B,B.length);if(this.#n.set(B.subarray(0,t),this.#B),this.#B+=t,e=t,this.#B<dB)return;this.#s(this.#n,0),this.#B=0;}for(;e+dB<=B.length;)this.#s(B,e),e+=dB;e<B.length&&(this.#n.set(B.subarray(e),0),this.#B=B.length-e);}digestHex(){if(this.#r)throw new Error("SHA-256 hasher is already finalized");this.#r=true;let B=new Uint8Array(this.#B<56?64:128);B.set(this.#n.subarray(0,this.#B),0),B[this.#B]=128;let e=new DataView(B.buffer);e.setUint32(B.length-8,Math.floor(this.#i/536870912)),e.setUint32(B.length-4,this.#i<<3>>>0);for(let t=0;t<B.length;t+=dB)this.#s(B,t);return Array.from(this.#e,t=>t.toString(16).padStart(8,"0")).join("")}#s(B,e){let t=this.#t;for(let d=0;d<16;d+=1){let O=e+d*4;t[d]=(B[O]<<24|B[O+1]<<16|B[O+2]<<8|B[O+3])>>>0;}for(let d=16;d<64;d+=1){let O=t[d-15],S=t[d-2],L=(BB(O,7)^BB(O,18)^O>>>3)>>>0,R=(BB(S,17)^BB(S,19)^S>>>10)>>>0;t[d]=t[d-16]+L+t[d-7]+R>>>0;}let i=this.#e,r=i[0],s=i[1],C=i[2],o=i[3],u=i[4],c=i[5],p=i[6],g=i[7];for(let d=0;d<64;d+=1){let O=(BB(u,6)^BB(u,11)^BB(u,25))>>>0,S=(u&c^~u&p)>>>0,L=g+O+S+rs[d]+t[d]>>>0,R=(BB(r,2)^BB(r,13)^BB(r,22))>>>0,J=(r&s^r&C^s&C)>>>0,y=R+J>>>0;g=p,p=c,c=u,u=o+L>>>0,o=C,C=s,s=r,r=L+y>>>0;}i[0]=r+i[0]>>>0,i[1]=s+i[1]>>>0,i[2]=C+i[2]>>>0,i[3]=o+i[3]>>>0,i[4]=u+i[4]>>>0,i[5]=c+i[5]>>>0,i[6]=p+i[6]>>>0,i[7]=g+i[7]>>>0;}};var ie=class{#e=new ne;#t=0;get rowCount(){return this.#t}update(B){this.#e.update(B),this.#t+=1;}finalize(){return this.#e.digestHex()}};function Cs(){return new ie}/*! Bundled license information:
|
|
23
23
|
|
|
@@ -32,5 +32,5 @@ re2js/build/index.js:
|
|
|
32
32
|
* @repository github:le0pard/re2js
|
|
33
33
|
* @license MIT
|
|
34
34
|
*)
|
|
35
|
-
*/export{jt as A,Gi as B,Ui as C,we as D,Lr as E,wr as F,iB as G,He as H,Be as I,yr as J,_e as K,Ur as L,Yr as M,Qr as N,Wr as O,qr as P,Nn as Q,Xr as R,es as S,ts as T,ns as U,is as V,Cs as W,nn as X,rn as Y,Bn as Z,Hn as a,_n as b,Pn as c,Mn as d,kn as e,Jn as f,Un as g,vn as h,Kn as i,Vn as j,jn as k,CB as l,re as m,Yn as n,Qn as o,Wn as p,Xn as q,ei as r,Ze as s,ni as t,ii as u,si as v,V as w,Q as x,Ee as y,fe as z};//# sourceMappingURL=chunk-
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
*/export{jt as A,Gi as B,Ui as C,we as D,Lr as E,wr as F,iB as G,He as H,Be as I,yr as J,_e as K,Ur as L,Yr as M,Qr as N,Wr as O,qr as P,Nn as Q,Xr as R,es as S,ts as T,ns as U,is as V,Cs as W,nn as X,rn as Y,Bn as Z,Hn as a,_n as b,Pn as c,Mn as d,kn as e,Jn as f,Un as g,vn as h,Kn as i,Vn as j,jn as k,CB as l,re as m,Yn as n,Qn as o,Wn as p,Xn as q,ei as r,Ze as s,ni as t,ii as u,si as v,V as w,Q as x,Ee as y,fe as z};//# sourceMappingURL=chunk-R6BZ46ZK.js.map
|
|
36
|
+
//# sourceMappingURL=chunk-R6BZ46ZK.js.map
|