openclaw-brokerkit 0.3.1 → 0.3.2
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/README.md
CHANGED
|
@@ -187,9 +187,12 @@ Because the packaged UI has an opaque origin under the required scripts-only
|
|
|
187
187
|
sandbox, a delegated host must accept only the expected `Origin: null`,
|
|
188
188
|
return `Access-Control-Allow-Origin: null`, allow `BrokerKit-Session` and
|
|
189
189
|
`Content-Type` in preflight responses, allow only its fixed route methods,
|
|
190
|
-
and set `Vary: Origin` plus
|
|
191
|
-
`
|
|
192
|
-
|
|
190
|
+
set `Access-Control-Allow-Credentials: true`, and set `Vary: Origin` plus
|
|
191
|
+
`Cache-Control: no-store`. Delegated API requests use `credentials: "include"`
|
|
192
|
+
so a private hosting edge can receive its own access cookie. The host must not
|
|
193
|
+
treat that cookie as BrokerKit authorization: every delegated route still
|
|
194
|
+
requires and validates the short-lived `BrokerKit-Session`. Direct mode keeps
|
|
195
|
+
using `credentials: "omit"`.
|
|
193
196
|
|
|
194
197
|
### Parent session bridge
|
|
195
198
|
|
|
@@ -146,4 +146,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${i.do
|
|
|
146
146
|
*
|
|
147
147
|
* This source code is licensed under the ISC license.
|
|
148
148
|
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/const qv=Ra("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Gu={},So;function Uv(){return So||(So=1,(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.formatNames=u.fastFormats=u.fullFormats=void 0;function i(G,ae){return{validate:G,compare:ae}}u.fullFormats={date:i(v,_),time:i(E(!0),m),"date-time":i(T(!0),L),"iso-time":i(E(),O),"iso-date-time":i(T(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:le,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:te,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:k,int32:{type:"number",validate:he},int64:{type:"number",validate:re},float:{type:"number",validate:ve},double:{type:"number",validate:ve},password:!0,binary:!0},u.fastFormats={...u.fullFormats,date:i(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,_),time:i(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"date-time":i(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,L),"iso-time":i(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,O),"iso-date-time":i(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},u.formatNames=Object.keys(u.fullFormats);function f(G){return G%4===0&&(G%100!==0||G%400===0)}const c=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,h=[0,31,28,31,30,31,30,31,31,30,31,30,31];function v(G){const ae=c.exec(G);if(!ae)return!1;const Re=+ae[1],pe=+ae[2],Ae=+ae[3];return pe>=1&&pe<=12&&Ae>=1&&Ae<=(pe===2&&f(Re)?29:h[pe])}function _(G,ae){if(G&&ae)return G>ae?1:G<ae?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function E(G){return function(Re){const pe=o.exec(Re);if(!pe)return!1;const Ae=+pe[1],M=+pe[2],X=+pe[3],W=pe[4],Ee=pe[5]==="-"?-1:1,g=+(pe[6]||0),B=+(pe[7]||0);if(g>23||B>59||G&&!W)return!1;if(Ae<=23&&M<=59&&X<60)return!0;const V=M-B*Ee,Z=Ae-g*Ee-(V<0?1:0);return(Z===23||Z===-1)&&(V===59||V===-1)&&X<61}}function m(G,ae){if(!(G&&ae))return;const Re=new Date("2020-01-01T"+G).valueOf(),pe=new Date("2020-01-01T"+ae).valueOf();if(Re&&pe)return Re-pe}function O(G,ae){if(!(G&&ae))return;const Re=o.exec(G),pe=o.exec(ae);if(Re&&pe)return G=Re[1]+Re[2]+Re[3],ae=pe[1]+pe[2]+pe[3],G>ae?1:G<ae?-1:0}const S=/t|\s/i;function T(G){const ae=E(G);return function(pe){const Ae=pe.split(S);return Ae.length===2&&v(Ae[0])&&ae(Ae[1])}}function L(G,ae){if(!(G&&ae))return;const Re=new Date(G).valueOf(),pe=new Date(ae).valueOf();if(Re&&pe)return Re-pe}function A(G,ae){if(!(G&&ae))return;const[Re,pe]=G.split(S),[Ae,M]=ae.split(S),X=_(Re,Ae);if(X!==void 0)return X||m(pe,M)}const y=/\/|:/,H=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function le(G){return y.test(G)&&H.test(G)}const K=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k(G){return K.lastIndex=0,K.test(G)}const Y=-2147483648,Q=2**31-1;function he(G){return Number.isInteger(G)&&G<=Q&&G>=Y}function re(G){return Number.isInteger(G)}function ve(){return!0}const Ue=/[^\\]\\Z/;function te(G){if(Ue.test(G))return!1;try{return new RegExp(G),!0}catch{return!1}}})(Gu)),Gu}var Cv=Uv();const jv=kl(Cv);var tr={},Xu,Eo;function Lv(){return Eo||(Eo=1,Xu=function u(i,f){if(i===f)return!0;if(i&&f&&typeof i=="object"&&typeof f=="object"){if(i.constructor!==f.constructor)return!1;var c,h,v;if(Array.isArray(i)){if(c=i.length,c!=f.length)return!1;for(h=c;h--!==0;)if(!u(i[h],f[h]))return!1;return!0}if(i.constructor===RegExp)return i.source===f.source&&i.flags===f.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===f.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===f.toString();if(v=Object.keys(i),c=v.length,c!==Object.keys(f).length)return!1;for(h=c;h--!==0;)if(!Object.prototype.hasOwnProperty.call(f,v[h]))return!1;for(h=c;h--!==0;){var _=v[h];if(!u(i[_],f[_]))return!1}return!0}return i!==i&&f!==f}),Xu}var xo;function Hv(){if(xo)return tr;xo=1,Object.defineProperty(tr,"__esModule",{value:!0});const u=Lv();return u.code='require("ajv/dist/runtime/equal").default',tr.default=u,tr}var Bv=Hv();const kv=kl(Bv);var ar={},To;function Yv(){if(To)return ar;To=1,Object.defineProperty(ar,"__esModule",{value:!0});function u(i){const f=i.length;let c=0,h=0,v;for(;h<f;)c++,v=i.charCodeAt(h++),v>=55296&&v<=56319&&h<f&&(v=i.charCodeAt(h),(v&64512)===56320&&h++);return c}return ar.default=u,u.code='require("ajv/dist/runtime/ucs2length").default',ar}var Gv=Yv();const Xv=kl(Gv),Qv=jv.fullFormats,ie=Xv,Qu={properties:{id:{type:"string",minLength:1,maxLength:128},revision:{type:"integer",minimum:1},requester:{type:"string",minLength:1,maxLength:80},operation:{type:"string",minLength:1,maxLength:500},status:{$ref:"#/$defs/Status"},requested_at:{type:"string",format:"date-time"},pending_expires_at:{type:"string",format:"date-time"},active_expires_at:{type:"string",format:"date-time"},requested_duration_seconds:{type:"integer",minimum:1},requested_max_uses:{type:["integer","null"],minimum:1},granted_max_uses:{type:["integer","null"],minimum:1},used_count:{type:"integer",minimum:0},request_reason:{type:"string",maxLength:2e3},decided_at:{type:"string",format:"date-time"},decided_by:{type:"string",maxLength:200},decided_on_behalf_of:{type:"string",maxLength:200},presentation:{$ref:"#/$defs/Presentation"},presentation_unavailable:{type:"boolean"},allowed_actions:{type:"array",uniqueItems:!0,items:{$ref:"#/$defs/Action"}},approval_bounds:{$ref:"#/$defs/ApprovalBounds"}}},Zv={enum:["pending","active","denied","canceled","expired","consumed","revoked"]},Vv={enum:["approve","deny","revoke"]},Kv={properties:{max_uses:{type:["integer","null"]}}},Jv=Object.prototype.hasOwnProperty,$v=kv,el=Qv["date-time"],Ao={enum:["unknown","low","medium","high","critical"]};function lt(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=lt.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.severity===void 0&&(O="severity")||u.text===void 0&&(O="text"))return lt.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;for(const S in u)if(!(S==="severity"||S==="text"))return lt.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;{if(u.severity!==void 0){let S=u.severity;const T=o;if(typeof S!="string")return lt.errors=[{instancePath:i+"/severity",schemaPath:"#/$defs/PresentationRisk/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(S==="unknown"||S==="low"||S==="medium"||S==="high"||S==="critical"))return lt.errors=[{instancePath:i+"/severity",schemaPath:"#/$defs/PresentationRisk/enum",keyword:"enum",params:{allowedValues:Ao.enum},message:"must be equal to one of the allowed values"}],!1;var m=T===o}else var m=!0;if(m)if(u.text!==void 0){let S=u.text;const T=o;if(typeof S=="string"){if(ie(S)>500)return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(S)<1)return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=T===o}else var m=!0}}else return lt.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return lt.errors=_,o===0}lt.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ye(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=ye.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let L;if(u.risk===void 0&&(L="risk")||u.title===void 0&&(L="title")||u.target===void 0&&(L="target"))return ye.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"}],!1;{const A=o;for(const y in u)if(!(y==="risk"||y==="title"||y==="summary"||y==="target"||y==="facts"||y==="warnings"||y==="plan_hash"))return ye.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;if(A===o){if(u.risk!==void 0){let y=u.risk;const H=o;if(typeof y!="string")return ye.errors=[{instancePath:i+"/risk",schemaPath:"#/$defs/PresentationRisk/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(y==="unknown"||y==="low"||y==="medium"||y==="high"||y==="critical"))return ye.errors=[{instancePath:i+"/risk",schemaPath:"#/$defs/PresentationRisk/enum",keyword:"enum",params:{allowedValues:Ao.enum},message:"must be equal to one of the allowed values"}],!1;var m=H===o}else var m=!0;if(m){if(u.title!==void 0){let y=u.title;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>200)return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(y)<1)return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.summary!==void 0){let y=u.summary;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>2e3)return ye.errors=[{instancePath:i+"/summary",schemaPath:"#/properties/summary/maxLength",keyword:"maxLength",params:{limit:2e3},message:"must NOT have more than 2000 characters"}],!1}else return ye.errors=[{instancePath:i+"/summary",schemaPath:"#/properties/summary/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.target!==void 0){let y=u.target;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>500)return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(y)<1)return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.facts!==void 0){let y=u.facts;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>20)return ye.errors=[{instancePath:i+"/facts",schemaPath:"#/properties/facts/maxItems",keyword:"maxItems",params:{limit:20},message:"must NOT have more than 20 items"}],!1;{var O=!0;const K=y.length;for(let k=0;k<K;k++){let Y=y[k];const Q=o;if(o===o)if(Y&&typeof Y=="object"&&!Array.isArray(Y)){let ve;if(Y.label===void 0&&(ve="label")||Y.value===void 0&&(ve="value"))return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/required",keyword:"required",params:{missingProperty:ve},message:"must have required property '"+ve+"'"}],!1;{const Ue=o;for(const te in Y)if(!(te==="label"||te==="value"))return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:te},message:"must NOT have additional properties"}],!1;if(Ue===o){if(Y.label!==void 0){let te=Y.label;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>80)return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/maxLength",keyword:"maxLength",params:{limit:80},message:"must NOT have more than 80 characters"}],!1;if(ie(te)<1)return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S)if(Y.value!==void 0){let te=Y.value;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>500)return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(te)<1)return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0}}}else return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var O=Q===o;if(!O)break}}}else return ye.errors=[{instancePath:i+"/facts",schemaPath:"#/properties/facts/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m){if(u.warnings!==void 0){let y=u.warnings;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>10)return ye.errors=[{instancePath:i+"/warnings",schemaPath:"#/properties/warnings/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"}],!1;{var T=!0;const K=y.length;for(let k=0;k<K;k++){const Y=o;lt(y[k],{instancePath:i+"/warnings/"+k,parentData:y,parentDataProperty:k,rootData:h,dynamicAnchors:v})||(_=_===null?lt.errors:_.concat(lt.errors),o=_.length);var T=Y===o;if(!T)break}}}else return ye.errors=[{instancePath:i+"/warnings",schemaPath:"#/properties/warnings/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m)if(u.plan_hash!==void 0){let y=u.plan_hash;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>128)return ye.errors=[{instancePath:i+"/plan_hash",schemaPath:"#/properties/plan_hash/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1}else return ye.errors=[{instancePath:i+"/plan_hash",schemaPath:"#/properties/plan_hash/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0}}}}}}}}else return ye.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ye.errors=_,o===0}ye.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function $(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=$.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let T;if(u.id===void 0&&(T="id")||u.revision===void 0&&(T="revision")||u.requester===void 0&&(T="requester")||u.operation===void 0&&(T="operation")||u.status===void 0&&(T="status")||u.requested_at===void 0&&(T="requested_at")||u.requested_duration_seconds===void 0&&(T="requested_duration_seconds")||u.requested_max_uses===void 0&&(T="requested_max_uses")||u.granted_max_uses===void 0&&(T="granted_max_uses")||u.used_count===void 0&&(T="used_count")||u.presentation===void 0&&(T="presentation")||u.allowed_actions===void 0&&(T="allowed_actions"))return $.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:T},message:"must have required property '"+T+"'"}],!1;{const L=o;for(const A in u)if(!Jv.call(Qu.properties,A))return $.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:A},message:"must NOT have additional properties"}],!1;if(L===o){if(u.id!==void 0){let A=u.id;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>128)return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.revision!==void 0){let A=u.revision;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/revision",schemaPath:"#/properties/revision/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/revision",schemaPath:"#/properties/revision/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.requester!==void 0){let A=u.requester;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>80)return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/maxLength",keyword:"maxLength",params:{limit:80},message:"must NOT have more than 80 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.operation!==void 0){let A=u.operation;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>500)return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.status!==void 0){let A=u.status;const y=o;if(typeof A!="string")return $.errors=[{instancePath:i+"/status",schemaPath:"#/$defs/Status/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(A==="pending"||A==="active"||A==="denied"||A==="canceled"||A==="expired"||A==="consumed"||A==="revoked"))return $.errors=[{instancePath:i+"/status",schemaPath:"#/$defs/Status/enum",keyword:"enum",params:{allowedValues:Zv.enum},message:"must be equal to one of the allowed values"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_at!==void 0){let A=u.requested_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/requested_at",schemaPath:"#/properties/requested_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/requested_at",schemaPath:"#/properties/requested_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.pending_expires_at!==void 0){let A=u.pending_expires_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/pending_expires_at",schemaPath:"#/properties/pending_expires_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/pending_expires_at",schemaPath:"#/properties/pending_expires_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.active_expires_at!==void 0){let A=u.active_expires_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/active_expires_at",schemaPath:"#/properties/active_expires_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/active_expires_at",schemaPath:"#/properties/active_expires_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_duration_seconds!==void 0){let A=u.requested_duration_seconds;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/requested_duration_seconds",schemaPath:"#/properties/requested_duration_seconds/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/requested_duration_seconds",schemaPath:"#/properties/requested_duration_seconds/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_max_uses!==void 0){let A=u.requested_max_uses;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A))&&A!==null)return $.errors=[{instancePath:i+"/requested_max_uses",schemaPath:"#/properties/requested_max_uses/type",keyword:"type",params:{type:Qu.properties.requested_max_uses.type},message:"must be integer,null"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/requested_max_uses",schemaPath:"#/properties/requested_max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.granted_max_uses!==void 0){let A=u.granted_max_uses;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A))&&A!==null)return $.errors=[{instancePath:i+"/granted_max_uses",schemaPath:"#/properties/granted_max_uses/type",keyword:"type",params:{type:Qu.properties.granted_max_uses.type},message:"must be integer,null"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/granted_max_uses",schemaPath:"#/properties/granted_max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.used_count!==void 0){let A=u.used_count;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/used_count",schemaPath:"#/properties/used_count/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<0||isNaN(A)))return $.errors=[{instancePath:i+"/used_count",schemaPath:"#/properties/used_count/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var m=y===o}else var m=!0;if(m){if(u.request_reason!==void 0){let A=u.request_reason;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>2e3)return $.errors=[{instancePath:i+"/request_reason",schemaPath:"#/properties/request_reason/maxLength",keyword:"maxLength",params:{limit:2e3},message:"must NOT have more than 2000 characters"}],!1}else return $.errors=[{instancePath:i+"/request_reason",schemaPath:"#/properties/request_reason/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_at!==void 0){let A=u.decided_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/decided_at",schemaPath:"#/properties/decided_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/decided_at",schemaPath:"#/properties/decided_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_by!==void 0){let A=u.decided_by;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>200)return $.errors=[{instancePath:i+"/decided_by",schemaPath:"#/properties/decided_by/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return $.errors=[{instancePath:i+"/decided_by",schemaPath:"#/properties/decided_by/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_on_behalf_of!==void 0){let A=u.decided_on_behalf_of;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>200)return $.errors=[{instancePath:i+"/decided_on_behalf_of",schemaPath:"#/properties/decided_on_behalf_of/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return $.errors=[{instancePath:i+"/decided_on_behalf_of",schemaPath:"#/properties/decided_on_behalf_of/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.presentation!==void 0){const A=o;ye(u.presentation,{instancePath:i+"/presentation",parentData:u,parentDataProperty:"presentation",rootData:h,dynamicAnchors:v})||(_=_===null?ye.errors:_.concat(ye.errors),o=_.length);var m=A===o}else var m=!0;if(m){if(u.presentation_unavailable!==void 0){const A=o;if(typeof u.presentation_unavailable!="boolean")return $.errors=[{instancePath:i+"/presentation_unavailable",schemaPath:"#/properties/presentation_unavailable/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=A===o}else var m=!0;if(m){if(u.allowed_actions!==void 0){let A=u.allowed_actions;const y=o;if(o===y)if(Array.isArray(A)){var O=!0;const le=A.length;for(let K=0;K<le;K++){let k=A[K];const Y=o;if(typeof k!="string")return $.errors=[{instancePath:i+"/allowed_actions/"+K,schemaPath:"#/$defs/Action/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(k==="approve"||k==="deny"||k==="revoke"))return $.errors=[{instancePath:i+"/allowed_actions/"+K,schemaPath:"#/$defs/Action/enum",keyword:"enum",params:{allowedValues:Vv.enum},message:"must be equal to one of the allowed values"}],!1;var O=Y===o;if(!O)break}if(O){let K=A.length,k;if(K>1){for(;K--;)for(k=K;k--;)if($v(A[K],A[k]))return $.errors=[{instancePath:i+"/allowed_actions",schemaPath:"#/properties/allowed_actions/uniqueItems",keyword:"uniqueItems",params:{i:K,j:k},message:"must NOT have duplicate items (items ## "+k+" and "+K+" are identical)"}],!1}}}else return $.errors=[{instancePath:i+"/allowed_actions",schemaPath:"#/properties/allowed_actions/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=y===o}else var m=!0;if(m)if(u.approval_bounds!==void 0){let A=u.approval_bounds;const y=o;if(o===o)if(A&&typeof A=="object"&&!Array.isArray(A)){let K;if(A.max_duration_seconds===void 0&&(K="max_duration_seconds")||A.max_uses===void 0&&(K="max_uses"))return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/required",keyword:"required",params:{missingProperty:K},message:"must have required property '"+K+"'"}],!1;{const k=o;for(const Y in A)if(!(Y==="max_duration_seconds"||Y==="max_uses"))return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:Y},message:"must NOT have additional properties"}],!1;if(k===o){if(A.max_duration_seconds!==void 0){let Y=A.max_duration_seconds;const Q=o;if(!(typeof Y=="number"&&!(Y%1)&&!isNaN(Y)&&isFinite(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_duration_seconds",schemaPath:"#/$defs/ApprovalBounds/properties/max_duration_seconds/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===Q&&typeof Y=="number"&&isFinite(Y)&&(Y<1||isNaN(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_duration_seconds",schemaPath:"#/$defs/ApprovalBounds/properties/max_duration_seconds/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var S=Q===o}else var S=!0;if(S)if(A.max_uses!==void 0){let Y=A.max_uses;const Q=o;if(!(typeof Y=="number"&&!(Y%1)&&!isNaN(Y)&&isFinite(Y))&&Y!==null)return $.errors=[{instancePath:i+"/approval_bounds/max_uses",schemaPath:"#/$defs/ApprovalBounds/properties/max_uses/type",keyword:"type",params:{type:Kv.properties.max_uses.type},message:"must be integer,null"}],!1;if(o===Q&&typeof Y=="number"&&isFinite(Y)&&(Y<1||isNaN(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_uses",schemaPath:"#/$defs/ApprovalBounds/properties/max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var S=Q===o}else var S=!0}}}else return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=y===o}else var m=!0}}}}}}}}}}}}}}}}}}}}}else return $.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return $.errors=_,o===0}$.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Pv=lr,Oo=new RegExp("^[A-Za-z0-9_-]+$","u");function Ge(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=Ge.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.source_id===void 0&&(O="source_id")||u.source_label===void 0&&(O="source_label")||u.handle===void 0&&(O="handle")||u.request===void 0&&(O="request"))return Ge.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;{const S=o;for(const T in u)if(!(T==="source_id"||T==="source_label"||T==="handle"||T==="request"))return Ge.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;if(S===o){if(u.source_id!==void 0){let T=u.source_id;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>128)return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(T)<1)return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.source_label!==void 0){let T=u.source_label;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>200)return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(T)<1)return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.handle!==void 0){let T=u.handle;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>256)return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/maxLength",keyword:"maxLength",params:{limit:256},message:"must NOT have more than 256 characters"}],!1;if(ie(T)<22)return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/minLength",keyword:"minLength",params:{limit:22},message:"must NOT have fewer than 22 characters"}],!1;if(!Oo.test(T))return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m)if(u.request!==void 0){const T=o;$(u.request,{instancePath:i+"/request",parentData:u,parentDataProperty:"request",rootData:h,dynamicAnchors:v})||(_=_===null?$.errors:_.concat($.errors),o=_.length);var m=T===o}else var m=!0}}}}}else return Ge.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ge.errors=_,o===0}Ge.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function me(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=me.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let L;if(u.api_version===void 0&&(L="api_version")||u.cursor===void 0&&(L="cursor")||u.synchronized_at===void 0&&(L="synchronized_at")||u.sources===void 0&&(L="sources")||u.requests===void 0&&(L="requests"))return me.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"}],!1;{const A=o;for(const y in u)if(!(y==="api_version"||y==="cursor"||y==="synchronized_at"||y==="sources"||y==="requests"||y==="delivery_failures"))return me.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;if(A===o){if(u.api_version!==void 0){let y=u.api_version;const H=o;if(typeof y!="string")return me.errors=[{instancePath:i+"/api_version",schemaPath:"#/properties/api_version/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(y!=="brokerkit.io/operator-ui/v1")return me.errors=[{instancePath:i+"/api_version",schemaPath:"#/properties/api_version/const",keyword:"const",params:{allowedValue:"brokerkit.io/operator-ui/v1"},message:"must be equal to constant"}],!1;var m=H===o}else var m=!0;if(m){if(u.cursor!==void 0){let y=u.cursor;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>128)return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(y)<1)return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.synchronized_at!==void 0){let y=u.synchronized_at;const H=o;if(o===H&&o===H)if(typeof y=="string"){if(!el.validate(y))return me.errors=[{instancePath:i+"/synchronized_at",schemaPath:"#/properties/synchronized_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return me.errors=[{instancePath:i+"/synchronized_at",schemaPath:"#/properties/synchronized_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.sources!==void 0){let y=u.sources;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>100)return me.errors=[{instancePath:i+"/sources",schemaPath:"#/properties/sources/maxItems",keyword:"maxItems",params:{limit:100},message:"must NOT have more than 100 items"}],!1;{var O=!0;const K=y.length;for(let k=0;k<K;k++){let Y=y[k];const Q=o;if(o===o)if(Y&&typeof Y=="object"&&!Array.isArray(Y)){let ve;if(Y.id===void 0&&(ve="id")||Y.label===void 0&&(ve="label")||Y.healthy===void 0&&(ve="healthy"))return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/required",keyword:"required",params:{missingProperty:ve},message:"must have required property '"+ve+"'"}],!1;{const Ue=o;for(const te in Y)if(!(te==="id"||te==="label"||te==="healthy"||te==="last_sync_at"||te==="error"))return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:te},message:"must NOT have additional properties"}],!1;if(Ue===o){if(Y.id!==void 0){let te=Y.id;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>128)return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(te)<1)return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S){if(Y.label!==void 0){let te=Y.label;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>200)return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(te)<1)return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S){if(Y.healthy!==void 0){const te=o;if(typeof Y.healthy!="boolean")return me.errors=[{instancePath:i+"/sources/"+k+"/healthy",schemaPath:"#/$defs/UISourceHealth/properties/healthy/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var S=te===o}else var S=!0;if(S){if(Y.last_sync_at!==void 0){let te=Y.last_sync_at;const G=o;if(o===G&&o===G)if(typeof te=="string"){if(!el.validate(te))return me.errors=[{instancePath:i+"/sources/"+k+"/last_sync_at",schemaPath:"#/$defs/UISourceHealth/properties/last_sync_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/last_sync_at",schemaPath:"#/$defs/UISourceHealth/properties/last_sync_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S)if(Y.error!==void 0){let te=Y.error;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>200)return me.errors=[{instancePath:i+"/sources/"+k+"/error",schemaPath:"#/$defs/UISourceHealth/properties/error/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/error",schemaPath:"#/$defs/UISourceHealth/properties/error/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0}}}}}}else return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var O=Q===o;if(!O)break}}}else return me.errors=[{instancePath:i+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m){if(u.requests!==void 0){let y=u.requests;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>1e3)return me.errors=[{instancePath:i+"/requests",schemaPath:"#/properties/requests/maxItems",keyword:"maxItems",params:{limit:1e3},message:"must NOT have more than 1000 items"}],!1;{var T=!0;const K=y.length;for(let k=0;k<K;k++){const Y=o;Ge(y[k],{instancePath:i+"/requests/"+k,parentData:y,parentDataProperty:k,rootData:h,dynamicAnchors:v})||(_=_===null?Ge.errors:_.concat(Ge.errors),o=_.length);var T=Y===o;if(!T)break}}}else return me.errors=[{instancePath:i+"/requests",schemaPath:"#/properties/requests/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m)if(u.delivery_failures!==void 0){let y=u.delivery_failures;const H=o;if(!(typeof y=="number"&&!(y%1)&&!isNaN(y)&&isFinite(y)))return me.errors=[{instancePath:i+"/delivery_failures",schemaPath:"#/properties/delivery_failures/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===H&&typeof y=="number"&&isFinite(y)&&(y<0||isNaN(y)))return me.errors=[{instancePath:i+"/delivery_failures",schemaPath:"#/properties/delivery_failures/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var m=H===o}else var m=!0}}}}}}}else return me.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return me.errors=_,o===0}me.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function lr(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=lr.evaluated;return E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),me(u,{instancePath:i,parentData:f,parentDataProperty:c,rootData:h,dynamicAnchors:v})||(_=_===null?me.errors:_.concat(me.errors),o=_.length),lr.errors=_,o===0}lr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Wv=ct;function ct(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=ct.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.api_version===void 0&&(O="api_version")||u.cursor===void 0&&(O="cursor")||u.changed===void 0&&(O="changed"))return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;for(const S in u)if(!(S==="api_version"||S==="cursor"||S==="changed"))return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;{if(u.api_version!==void 0){let S=u.api_version;const T=o;if(typeof S!="string")return ct.errors=[{instancePath:i+"/api_version",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/api_version/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(S!=="brokerkit.io/operator-ui/v1")return ct.errors=[{instancePath:i+"/api_version",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/api_version/const",keyword:"const",params:{allowedValue:"brokerkit.io/operator-ui/v1"},message:"must be equal to constant"}],!1;var m=T===o}else var m=!0;if(m){if(u.cursor!==void 0){let S=u.cursor;const T=o;if(typeof S=="string"){if(ie(S)>128)return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(S)<1)return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=T===o}else var m=!0;if(m)if(u.changed!==void 0){const S=o;if(typeof u.changed!="boolean")return ct.errors=[{instancePath:i+"/changed",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/changed/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=S===o}else var m=!0}}}else return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ct.errors=_,o===0}ct.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Fv=nr;function Xe(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=Xe.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.source_id===void 0&&(O="source_id")||u.source_label===void 0&&(O="source_label")||u.handle===void 0&&(O="handle")||u.request===void 0&&(O="request"))return Xe.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;{const S=o;for(const T in u)if(!(T==="source_id"||T==="source_label"||T==="handle"||T==="request"))return Xe.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;if(S===o){if(u.source_id!==void 0){let T=u.source_id;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>128)return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(T)<1)return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.source_label!==void 0){let T=u.source_label;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>200)return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(T)<1)return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.handle!==void 0){let T=u.handle;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>256)return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/maxLength",keyword:"maxLength",params:{limit:256},message:"must NOT have more than 256 characters"}],!1;if(ie(T)<22)return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/minLength",keyword:"minLength",params:{limit:22},message:"must NOT have fewer than 22 characters"}],!1;if(!Oo.test(T))return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m)if(u.request!==void 0){const T=o;$(u.request,{instancePath:i+"/request",parentData:u,parentDataProperty:"request",rootData:h,dynamicAnchors:v})||(_=_===null?$.errors:_.concat($.errors),o=_.length);var m=T===o}else var m=!0}}}}}else return Xe.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Xe.errors=_,o===0}Xe.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function nr(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=nr.evaluated;return E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),Xe(u,{instancePath:i,parentData:f,parentDataProperty:c,rootData:h,dynamicAnchors:v})||(_=_===null?Xe.errors:_.concat(Xe.errors),o=_.length),nr.errors=_,o===0}nr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function zo(u){return Zu(Fv,u)}function Iv(u){return Zu(Pv,u)}function e0(u){return Zu(Wv,u)}function Zu(u,i){if(!u(i))throw new Error("Operator V1 response is invalid");return i}const No="BrokerKit-Session",t0=4096;function Vu(u){return u.length>=32&&u.length<=t0&&/^[\x21-\x2B\x2D-\x7E]+$/u.test(u)}const a0="brokerkit.delegated-web.session.request",l0="brokerkit.delegated-web.session.response",n0="brokerkit.delegated-web.rebootstrap",r0="brokerkit-delegated-session";class u0{constructor(i){this.bootstrap=i}delegatedSession;delegatedRefresh;delegatedRebootstrapRequested=!1;snapshot(i){return this.request("/snapshot",i?{signal:i}:{}).then(Iv)}events(i,f){return this.request(`/events?cursor=${encodeURIComponent(i)}&wait_seconds=25`,{signal:f}).then(e0)}canDecide(){return this.bootstrap.mode==="direct"||this.delegatedSession?.access==="decide"}detail(i){return this.request(`/requests/${encodeURIComponent(i)}`).then(zo)}decide(i,f,c={}){return this.request(`/requests/${encodeURIComponent(i.handle)}/${f}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({expectedRevision:i.request.revision,...c})}).then(zo)}async request(i,f={}){const c=await this.authorization(),h=this.bootstrap.mode==="direct"?"/plugins/brokerkit/api/v1":this.bootstrap.basePath,v=await fetch(`${h}${i}`,{...f,credentials:"omit",cache:"no-store",redirect:"error",headers:Do(f.headers,c.token)});if(!v.ok)throw await Ro(v);return JSON.parse(await Ju(v,2e6))}async authorization(){if(this.bootstrap.mode==="direct")return{token:this.bootstrap.capability,expiresAtMs:Number.POSITIVE_INFINITY,access:"decide",renewalTransport:"direct"};if(this.delegatedSession&&this.delegatedSession.expiresAtMs>Date.now()+3e4)return this.delegatedSession;if(this.delegatedRefresh)return this.delegatedRefresh;this.delegatedRefresh=this.refreshDelegatedAuthorization();try{return await this.delegatedRefresh}finally{this.delegatedRefresh=void 0}}async refreshDelegatedAuthorization(){if(this.bootstrap.mode!=="delegated-web")throw new Error("Delegated approval session is invalid");let i;try{i=await i0(this.bootstrap.basePath,this.delegatedSession)}catch(h){throw this.delegatedSession&&Ku()&&f0(h)==="not_authorized"&&this.requestDelegatedRebootstrap(),h}const f=Date.parse(typeof i.expires_at=="string"?i.expires_at:"");if(Object.keys(i).sort().join(",")!=="access,api_version,expires_at,renewal_transport,token"||i.api_version!=="brokerkit.io/delegated-web/v1"||typeof i.token!="string"||!Vu(i.token)||i.access!=="read"&&i.access!=="decide"||i.renewal_transport!=="direct"&&i.renewal_transport!=="parent"||!Number.isFinite(f)||f<=Date.now()||f>Date.now()+5*6e4)throw new Error("Delegated approval session is invalid");return this.delegatedSession={token:i.token,expiresAtMs:f,access:i.access,renewalTransport:i.renewal_transport},this.delegatedSession}requestDelegatedRebootstrap(){this.delegatedRebootstrapRequested||(this.delegatedRebootstrapRequested=!0,window.parent.postMessage({type:n0,version:1},"*"))}}async function i0(u,i){const f=s0();if(f)return f;if(i&&(i.renewalTransport==="direct"||!Ku())){const c=await fetch(`${u}/session`,{method:"POST",credentials:"omit",cache:"no-store",redirect:"error",headers:Do(void 0,i.token)});if(!c.ok)throw await Ro(c);return JSON.parse(await Ju(c,16384))}if(i)return wo();if(!Ku())throw new Error("Approval authorization expired");return wo()}function Do(u,i){if(!Vu(i))throw new Error("Approval authorization expired");const f=new Headers(u);return f.delete("authorization"),f.delete(No),f.set(No,i),f}function s0(){if(typeof document>"u")return;const u=document.querySelector(`meta[name="${r0}"]`);if(!u)return;const i=u.getAttribute("content")??"";if(u.remove(),!i||i.length>8192)return{};try{const f=i.replace(/-/gu,"+").replace(/_/gu,"/"),c=f.padEnd(Math.ceil(f.length/4)*4,"="),h=JSON.parse(atob(c));return Zl(h)?h:{}}catch{return{}}}function Ku(){return typeof window<"u"&&window.parent!==window}function wo(){const u=c0();return new Promise((i,f)=>{const c=window.setTimeout(()=>{v(),f(new Error("Approval authorization expired"))},1e4),h=_=>{if(!(_.source!==window.parent||!Zl(_.data))&&!(_.data.type!==l0||_.data.nonce!==u)){if(v(),!Zl(_.data.session)){f(new Error("Approval authorization expired"));return}i(_.data.session)}},v=()=>{window.clearTimeout(c),window.removeEventListener("message",h)};window.addEventListener("message",h),window.parent.postMessage({type:a0,version:1,nonce:u},"*")})}function c0(){const u=new Uint8Array(16);return crypto.getRandomValues(u),[...u].map(i=>i.toString(16).padStart(2,"0")).join("")}function o0(u){if(!u||u.length>2048)throw new Error("Approval UI bootstrap is invalid");let i;try{const c=u.replace(/-/gu,"+").replace(/_/gu,"/"),h=c.padEnd(Math.ceil(c.length/4)*4,"=");i=JSON.parse(atob(h))}catch{throw new Error("Approval UI bootstrap is invalid")}if(!Zl(i)||i.version!==1||typeof i.mode!="string")throw new Error("Approval UI bootstrap is invalid");const f=Object.keys(i).sort().join(",");if(i.mode==="direct"&&f==="capability,mode,version"&&typeof i.capability=="string"&&Vu(i.capability)&&i.capability.length>=32&&i.capability.length<=256)return{version:1,mode:"direct",capability:i.capability};if(i.mode==="delegated-web"&&f==="basePath,mode,version"&&typeof i.basePath=="string"&&d0(i.basePath))return{version:1,mode:"delegated-web",basePath:i.basePath};throw new Error("Approval UI bootstrap is invalid")}function Zl(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}function f0(u){return u instanceof Error&&"code"in u?String(u.code):void 0}function d0(u){return u.length>=2&&u.length<=256&&u.startsWith("/")&&!u.startsWith("//")&&!u.endsWith("/")&&!/[?#\\]/u.test(u)&&!m0(u)&&!u.includes("..")&&u.split("/").every((i,f)=>f===0||/^[A-Za-z0-9._~-]+$/u.test(i))}function m0(u){return[...u].some(i=>{const f=i.codePointAt(0)??0;return f<32||f===127})}async function Ro(u){try{const i=JSON.parse(await Ju(u,64e3)),f=Zl(i.error)?i.error:void 0;if(f&&typeof f.code=="string")return Object.assign(new Error(h0(f.code)),{code:f.code})}catch{}return new Error(u.status===401||u.status===403?"Approval authorization expired":"Approvals are unavailable")}function h0(u){return u==="revision_stale"?"This request changed; refresh and review it again":u==="request_terminal"?"This request is already settled":u==="not_authorized"?"Approval authorization expired":u==="source_unavailable"?"The approval source is unavailable":u==="cursor_expired"?"Approval updates expired":"The approval request could not be completed"}async function Ju(u,i){if(!u.body)return"";const f=u.body.getReader(),c=[];let h=0;for(;;){const{done:o,value:E}=await f.read();if(o)break;if(h+=E.byteLength,h>i)throw await f.cancel(),new Error("Approvals are unavailable");c.push(E)}const v=new Uint8Array(h);let _=0;for(const o of c)v.set(o,_),_+=o.byteLength;return new TextDecoder("utf-8",{fatal:!0}).decode(v)}const p0="brokerkit.operator-ui.invalidate";function v0(u){const[i,f]=D.useState(),[c,h]=D.useState(!1),[v,_]=D.useState(""),o=D.useRef(void 0),E=D.useRef(void 0),m=D.useRef(void 0),O=D.useRef(void 0),S=D.useRef(0),T=D.useCallback(()=>{if(O.current?.abort(),E.current)return E.current;const L=++S.current,A=new AbortController;m.current=A;const y=u.snapshot(A.signal).then(H=>(L===S.current&&(o.current=H,f(H),h(u.canDecide()),_("")),H)).catch(H=>{throw $u(H)||_(Mo(H)),H}).finally(()=>{E.current===y&&(E.current=void 0),m.current===A&&(m.current=void 0)});return E.current=y,y},[u]);return D.useEffect(()=>{let L=!1;const A=new AbortController;let y=250;const H=async()=>{for(;!L;)try{const Q=o.current??await T();if(L)return;const he=new AbortController;O.current=he;const re=await u.events(Q.cursor,he.signal);O.current===he&&(O.current=void 0),_(""),re.changed&&!L&&await T(),y=250}catch(Q){if(L)return;if($u(Q))continue;if(y0(Q)==="cursor_expired")try{await T(),y=250;continue}catch{}_(Mo(Q));try{await g0(y,A.signal)}catch(he){if(L||$u(he))return;throw he}y=Math.min(y*2,3e4)}},le=()=>void T().catch(()=>{}),K=()=>{document.visibilityState==="visible"&&le()},k=Q=>{Q.source!==window.parent||!b0(Q.data)||Object.keys(Q.data).sort().join(",")!=="type,version"||Q.data.type!==p0||Q.data.version!==1||le()},Y=window.setInterval(le,5*6e4);return window.addEventListener("focus",le),window.addEventListener("message",k),document.addEventListener("visibilitychange",K),H(),()=>{L=!0,A.abort(),O.current?.abort(),m.current?.abort(),window.clearInterval(Y),window.removeEventListener("focus",le),window.removeEventListener("message",k),document.removeEventListener("visibilitychange",K)}},[u,T]),{snapshot:i,canDecide:c,error:v,setError:_,reconcile:T}}function y0(u){return u instanceof Error&&"code"in u?String(u.code):void 0}function Mo(u){return u instanceof Error?u.message:"Approvals are unavailable"}function $u(u){return u instanceof Error&&u.name==="AbortError"}function g0(u,i){const f=Math.floor(Math.random()*Math.max(1,u/4));return new Promise((c,h)=>{const v=window.setTimeout(o,u+f),_=()=>{window.clearTimeout(v),i.removeEventListener("abort",_),h(new DOMException("The operation was aborted","AbortError"))};function o(){i.removeEventListener("abort",_),c()}i.addEventListener("abort",_,{once:!0})})}function b0(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}const _0=o0(location.hash.slice(1)),qo=new u0(_0);history.replaceState(null,"",location.pathname);function S0(){const{snapshot:u,canDecide:i,error:f,setError:c,reconcile:h}=v0(qo),[v,_]=D.useState(""),[o,E]=D.useState(),m=async(S,T,L)=>{_(S.handle);try{await qo.decide(S,T,L),E(void 0),await h()}catch(A){c(A instanceof Error?A.message:"Decision failed")}finally{_("")}},O=D.useMemo(()=>u?.requests.filter(S=>S.request.allowed_actions.length>0)??[],[u]);return C.jsxs("main",{children:[C.jsxs("header",{children:[C.jsxs("div",{children:[C.jsxs("p",{className:"eyebrow",children:[C.jsx(_o,{size:15})," BrokerKit"]}),C.jsx("h1",{children:"Approvals"}),C.jsxs("p",{className:"subtle",children:[O.filter(S=>S.request.status==="pending").length," ","pending across ",u?.sources.length??0," sources"]})]}),C.jsx("button",{className:"icon",title:"Refresh",onClick:()=>void h().catch(()=>{}),children:C.jsx(Mv,{size:18})})]}),f&&C.jsxs("div",{className:"error",children:[C.jsx(Yu,{size:17}),C.jsx("span",{children:f}),C.jsx("button",{title:"Dismiss",onClick:()=>c(""),children:C.jsx(qv,{size:16})})]}),(u?.delivery_failures??0)>0&&C.jsxs("div",{className:"warning",role:"status",children:[C.jsx(Yu,{size:17}),C.jsxs("span",{children:[u?.delivery_failures," notification",u?.delivery_failures===1?"":"s"," need attention"]})]}),C.jsx("section",{className:"sources","aria-label":"Source health",children:u?.sources.map(S=>C.jsxs("div",{className:"source",children:[C.jsx("span",{className:S.healthy?"dot healthy":"dot"}),C.jsx("span",{children:S.label}),C.jsx("small",{children:S.healthy?"Connected":"Unavailable"})]},S.id))}),C.jsxs("section",{className:"requests",children:[O.map(S=>C.jsxs("article",{children:[C.jsxs("div",{className:"request-head",children:[C.jsxs("div",{children:[C.jsx("span",{className:`risk ${S.request.presentation.risk}`,children:S.request.presentation.risk}),C.jsx("span",{className:"source-label",children:S.source_label}),C.jsx("h2",{children:S.request.presentation.title})]}),C.jsx("code",{children:S.handle.slice(0,8)})]}),C.jsx(Uo,{presentation:S.request.presentation}),S.request.presentation.summary&&C.jsx("p",{children:S.request.presentation.summary}),C.jsx("dl",{children:S.request.presentation.facts?.map(T=>C.jsxs(xu.Fragment,{children:[C.jsx("dt",{children:T.label}),C.jsx("dd",{children:T.value})]},`${T.label}-${T.value}`))}),C.jsxs("div",{className:"meta",children:[C.jsx("span",{children:S.request.requester}),C.jsx("span",{children:S.request.requested_max_uses===null?"Unlimited uses":`${S.request.requested_max_uses} use${S.request.requested_max_uses===1?"":"s"}`}),C.jsxs("span",{children:[Math.round(S.request.requested_duration_seconds/60)," ","min"]})]}),C.jsxs("div",{className:"actions",children:[i&&S.request.allowed_actions.includes("revoke")&&C.jsxs("button",{className:"secondary",disabled:v===S.handle,onClick:()=>E({request:S,action:"revoke"}),children:[C.jsx(bo,{size:16}),"Revoke"]}),i&&S.request.allowed_actions.includes("deny")&&C.jsxs("button",{className:"secondary",disabled:v===S.handle,onClick:()=>E({request:S,action:"deny"}),children:[C.jsx(bo,{size:16}),"Deny"]}),i&&S.request.allowed_actions.includes("approve")&&C.jsxs("button",{className:"primary",disabled:v===S.handle,onClick:()=>E({request:S,action:"approve"}),children:[C.jsx(wv,{size:16}),"Approve"]})]})]},S.handle)),u&&O.length===0&&C.jsxs("div",{className:"empty",children:[C.jsx(_o,{size:30}),C.jsx("h2",{children:"No actionable requests"}),C.jsx("p",{children:"Approved, denied, expired, and canceled requests clear automatically."})]})]}),C.jsx(E0,{decision:o,busy:!!(o&&v===o.request.handle),onClose:()=>E(void 0),onConfirm:m})]})}function Uo({presentation:u,compact:i=!1}){return C.jsxs("div",{className:`presentation-safety${i?" compact":""}`,children:[C.jsxs("div",{className:"request-target",children:[C.jsx(Rv,{size:15,"aria-hidden":"true"}),C.jsx("span",{children:u.target})]}),u.warnings&&u.warnings.length>0&&C.jsx("ul",{className:"request-warnings","aria-label":"Request warnings",children:u.warnings.map(f=>C.jsxs("li",{className:`request-warning ${f.severity}`,children:[C.jsx(Yu,{size:15,"aria-hidden":"true"}),C.jsx("span",{children:f.text})]},`${f.severity}-${f.text}`))})]})}function E0({decision:u,busy:i,onClose:f,onConfirm:c}){const h=u?.request,v=h?.request.approval_bounds,[_,o]=D.useState(1),[E,m]=D.useState(1);if(D.useEffect(()=>{if(!h)return;o(Math.max(1,Math.min(h.request.requested_duration_seconds,v?.max_duration_seconds??h.request.requested_duration_seconds)));const T=h.request.requested_max_uses,L=v?.max_uses;m(T===null?null:L==null?T:Math.min(T,L))},[h,v]),!u||!h)return null;const O=u.action==="approve",S=`${Co(u.action)} request`;return C.jsx(gv,{open:!0,onOpenChange:T=>!T&&f(),children:C.jsxs(bv,{children:[C.jsx(_v,{className:"dialog-overlay"}),C.jsxs(Sv,{className:"dialog-content",children:[C.jsx(Ev,{children:S}),C.jsxs(xv,{children:[h.request.presentation.title," at revision"," ",h.request.revision]}),C.jsx(Uo,{presentation:h.request.presentation,compact:!0}),O&&v&&C.jsxs("div",{className:"decision-bounds",children:[C.jsxs("label",{children:["Duration (seconds)",C.jsx("input",{type:"number",min:1,max:v.max_duration_seconds,value:_,onChange:T=>o(T.currentTarget.valueAsNumber)})]}),C.jsxs("label",{children:["Maximum uses",C.jsx("input",{type:"number",min:1,max:v.max_uses??void 0,value:E??1,disabled:E===null,onChange:T=>m(T.currentTarget.valueAsNumber)})]}),v.max_uses===null&&C.jsxs("label",{children:[C.jsx("input",{type:"checkbox",checked:E===null,onChange:T=>m(T.currentTarget.checked?null:1)}),"Unlimited until expiry"]})]}),C.jsxs("div",{className:"dialog-actions",children:[C.jsx(Tv,{asChild:!0,children:C.jsx("button",{className:"secondary",disabled:i,children:"Cancel"})}),C.jsx("button",{className:O?"primary":"danger",disabled:i||!x0(O,_,E,v),onClick:()=>void c(h,u.action,{...O&&v?{constraints:{durationSeconds:_,maxUses:E}}:{}}),children:Co(u.action)})]})]})]})})}function x0(u,i,f,c){return!u||!c?!0:f===null?c.max_uses===null:Number.isSafeInteger(i)&&i>0&&i<=c.max_duration_seconds&&Number.isSafeInteger(f)&&f>0&&(c.max_uses===null||f<=c.max_uses)}function Co(u){return u.charAt(0).toUpperCase()+u.slice(1)}Hh.createRoot(document.getElementById("root")).render(C.jsx(xu.StrictMode,{children:C.jsx(S0,{})}))})();
|
|
149
|
+
*/const qv=Ra("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);var Gu={},So;function Uv(){return So||(So=1,(function(u){Object.defineProperty(u,"__esModule",{value:!0}),u.formatNames=u.fastFormats=u.fullFormats=void 0;function i(G,ae){return{validate:G,compare:ae}}u.fullFormats={date:i(v,_),time:i(E(!0),m),"date-time":i(T(!0),L),"iso-time":i(E(),O),"iso-date-time":i(T(),A),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:le,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:te,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:k,int32:{type:"number",validate:he},int64:{type:"number",validate:re},float:{type:"number",validate:ve},double:{type:"number",validate:ve},password:!0,binary:!0},u.fastFormats={...u.fullFormats,date:i(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,_),time:i(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,m),"date-time":i(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,L),"iso-time":i(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,O),"iso-date-time":i(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},u.formatNames=Object.keys(u.fullFormats);function f(G){return G%4===0&&(G%100!==0||G%400===0)}const c=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,h=[0,31,28,31,30,31,30,31,31,30,31,30,31];function v(G){const ae=c.exec(G);if(!ae)return!1;const Re=+ae[1],pe=+ae[2],Ae=+ae[3];return pe>=1&&pe<=12&&Ae>=1&&Ae<=(pe===2&&f(Re)?29:h[pe])}function _(G,ae){if(G&&ae)return G>ae?1:G<ae?-1:0}const o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function E(G){return function(Re){const pe=o.exec(Re);if(!pe)return!1;const Ae=+pe[1],M=+pe[2],X=+pe[3],W=pe[4],Ee=pe[5]==="-"?-1:1,g=+(pe[6]||0),B=+(pe[7]||0);if(g>23||B>59||G&&!W)return!1;if(Ae<=23&&M<=59&&X<60)return!0;const V=M-B*Ee,Z=Ae-g*Ee-(V<0?1:0);return(Z===23||Z===-1)&&(V===59||V===-1)&&X<61}}function m(G,ae){if(!(G&&ae))return;const Re=new Date("2020-01-01T"+G).valueOf(),pe=new Date("2020-01-01T"+ae).valueOf();if(Re&&pe)return Re-pe}function O(G,ae){if(!(G&&ae))return;const Re=o.exec(G),pe=o.exec(ae);if(Re&&pe)return G=Re[1]+Re[2]+Re[3],ae=pe[1]+pe[2]+pe[3],G>ae?1:G<ae?-1:0}const S=/t|\s/i;function T(G){const ae=E(G);return function(pe){const Ae=pe.split(S);return Ae.length===2&&v(Ae[0])&&ae(Ae[1])}}function L(G,ae){if(!(G&&ae))return;const Re=new Date(G).valueOf(),pe=new Date(ae).valueOf();if(Re&&pe)return Re-pe}function A(G,ae){if(!(G&&ae))return;const[Re,pe]=G.split(S),[Ae,M]=ae.split(S),X=_(Re,Ae);if(X!==void 0)return X||m(pe,M)}const y=/\/|:/,H=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function le(G){return y.test(G)&&H.test(G)}const K=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function k(G){return K.lastIndex=0,K.test(G)}const Y=-2147483648,Q=2**31-1;function he(G){return Number.isInteger(G)&&G<=Q&&G>=Y}function re(G){return Number.isInteger(G)}function ve(){return!0}const Ue=/[^\\]\\Z/;function te(G){if(Ue.test(G))return!1;try{return new RegExp(G),!0}catch{return!1}}})(Gu)),Gu}var Cv=Uv();const jv=kl(Cv);var tr={},Xu,Eo;function Lv(){return Eo||(Eo=1,Xu=function u(i,f){if(i===f)return!0;if(i&&f&&typeof i=="object"&&typeof f=="object"){if(i.constructor!==f.constructor)return!1;var c,h,v;if(Array.isArray(i)){if(c=i.length,c!=f.length)return!1;for(h=c;h--!==0;)if(!u(i[h],f[h]))return!1;return!0}if(i.constructor===RegExp)return i.source===f.source&&i.flags===f.flags;if(i.valueOf!==Object.prototype.valueOf)return i.valueOf()===f.valueOf();if(i.toString!==Object.prototype.toString)return i.toString()===f.toString();if(v=Object.keys(i),c=v.length,c!==Object.keys(f).length)return!1;for(h=c;h--!==0;)if(!Object.prototype.hasOwnProperty.call(f,v[h]))return!1;for(h=c;h--!==0;){var _=v[h];if(!u(i[_],f[_]))return!1}return!0}return i!==i&&f!==f}),Xu}var xo;function Hv(){if(xo)return tr;xo=1,Object.defineProperty(tr,"__esModule",{value:!0});const u=Lv();return u.code='require("ajv/dist/runtime/equal").default',tr.default=u,tr}var Bv=Hv();const kv=kl(Bv);var ar={},To;function Yv(){if(To)return ar;To=1,Object.defineProperty(ar,"__esModule",{value:!0});function u(i){const f=i.length;let c=0,h=0,v;for(;h<f;)c++,v=i.charCodeAt(h++),v>=55296&&v<=56319&&h<f&&(v=i.charCodeAt(h),(v&64512)===56320&&h++);return c}return ar.default=u,u.code='require("ajv/dist/runtime/ucs2length").default',ar}var Gv=Yv();const Xv=kl(Gv),Qv=jv.fullFormats,ie=Xv,Qu={properties:{id:{type:"string",minLength:1,maxLength:128},revision:{type:"integer",minimum:1},requester:{type:"string",minLength:1,maxLength:80},operation:{type:"string",minLength:1,maxLength:500},status:{$ref:"#/$defs/Status"},requested_at:{type:"string",format:"date-time"},pending_expires_at:{type:"string",format:"date-time"},active_expires_at:{type:"string",format:"date-time"},requested_duration_seconds:{type:"integer",minimum:1},requested_max_uses:{type:["integer","null"],minimum:1},granted_max_uses:{type:["integer","null"],minimum:1},used_count:{type:"integer",minimum:0},request_reason:{type:"string",maxLength:2e3},decided_at:{type:"string",format:"date-time"},decided_by:{type:"string",maxLength:200},decided_on_behalf_of:{type:"string",maxLength:200},presentation:{$ref:"#/$defs/Presentation"},presentation_unavailable:{type:"boolean"},allowed_actions:{type:"array",uniqueItems:!0,items:{$ref:"#/$defs/Action"}},approval_bounds:{$ref:"#/$defs/ApprovalBounds"}}},Zv={enum:["pending","active","denied","canceled","expired","consumed","revoked"]},Vv={enum:["approve","deny","revoke"]},Kv={properties:{max_uses:{type:["integer","null"]}}},Jv=Object.prototype.hasOwnProperty,$v=kv,el=Qv["date-time"],Ao={enum:["unknown","low","medium","high","critical"]};function lt(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=lt.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.severity===void 0&&(O="severity")||u.text===void 0&&(O="text"))return lt.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;for(const S in u)if(!(S==="severity"||S==="text"))return lt.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;{if(u.severity!==void 0){let S=u.severity;const T=o;if(typeof S!="string")return lt.errors=[{instancePath:i+"/severity",schemaPath:"#/$defs/PresentationRisk/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(S==="unknown"||S==="low"||S==="medium"||S==="high"||S==="critical"))return lt.errors=[{instancePath:i+"/severity",schemaPath:"#/$defs/PresentationRisk/enum",keyword:"enum",params:{allowedValues:Ao.enum},message:"must be equal to one of the allowed values"}],!1;var m=T===o}else var m=!0;if(m)if(u.text!==void 0){let S=u.text;const T=o;if(typeof S=="string"){if(ie(S)>500)return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(S)<1)return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return lt.errors=[{instancePath:i+"/text",schemaPath:"#/properties/text/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=T===o}else var m=!0}}else return lt.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return lt.errors=_,o===0}lt.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function ye(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=ye.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let L;if(u.risk===void 0&&(L="risk")||u.title===void 0&&(L="title")||u.target===void 0&&(L="target"))return ye.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"}],!1;{const A=o;for(const y in u)if(!(y==="risk"||y==="title"||y==="summary"||y==="target"||y==="facts"||y==="warnings"||y==="plan_hash"))return ye.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;if(A===o){if(u.risk!==void 0){let y=u.risk;const H=o;if(typeof y!="string")return ye.errors=[{instancePath:i+"/risk",schemaPath:"#/$defs/PresentationRisk/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(y==="unknown"||y==="low"||y==="medium"||y==="high"||y==="critical"))return ye.errors=[{instancePath:i+"/risk",schemaPath:"#/$defs/PresentationRisk/enum",keyword:"enum",params:{allowedValues:Ao.enum},message:"must be equal to one of the allowed values"}],!1;var m=H===o}else var m=!0;if(m){if(u.title!==void 0){let y=u.title;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>200)return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(y)<1)return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.summary!==void 0){let y=u.summary;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>2e3)return ye.errors=[{instancePath:i+"/summary",schemaPath:"#/properties/summary/maxLength",keyword:"maxLength",params:{limit:2e3},message:"must NOT have more than 2000 characters"}],!1}else return ye.errors=[{instancePath:i+"/summary",schemaPath:"#/properties/summary/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.target!==void 0){let y=u.target;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>500)return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(y)<1)return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/target",schemaPath:"#/properties/target/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.facts!==void 0){let y=u.facts;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>20)return ye.errors=[{instancePath:i+"/facts",schemaPath:"#/properties/facts/maxItems",keyword:"maxItems",params:{limit:20},message:"must NOT have more than 20 items"}],!1;{var O=!0;const K=y.length;for(let k=0;k<K;k++){let Y=y[k];const Q=o;if(o===o)if(Y&&typeof Y=="object"&&!Array.isArray(Y)){let ve;if(Y.label===void 0&&(ve="label")||Y.value===void 0&&(ve="value"))return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/required",keyword:"required",params:{missingProperty:ve},message:"must have required property '"+ve+"'"}],!1;{const Ue=o;for(const te in Y)if(!(te==="label"||te==="value"))return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:te},message:"must NOT have additional properties"}],!1;if(Ue===o){if(Y.label!==void 0){let te=Y.label;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>80)return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/maxLength",keyword:"maxLength",params:{limit:80},message:"must NOT have more than 80 characters"}],!1;if(ie(te)<1)return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/facts/"+k+"/label",schemaPath:"#/$defs/Fact/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S)if(Y.value!==void 0){let te=Y.value;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>500)return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(te)<1)return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ye.errors=[{instancePath:i+"/facts/"+k+"/value",schemaPath:"#/$defs/Fact/properties/value/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0}}}else return ye.errors=[{instancePath:i+"/facts/"+k,schemaPath:"#/$defs/Fact/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var O=Q===o;if(!O)break}}}else return ye.errors=[{instancePath:i+"/facts",schemaPath:"#/properties/facts/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m){if(u.warnings!==void 0){let y=u.warnings;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>10)return ye.errors=[{instancePath:i+"/warnings",schemaPath:"#/properties/warnings/maxItems",keyword:"maxItems",params:{limit:10},message:"must NOT have more than 10 items"}],!1;{var T=!0;const K=y.length;for(let k=0;k<K;k++){const Y=o;lt(y[k],{instancePath:i+"/warnings/"+k,parentData:y,parentDataProperty:k,rootData:h,dynamicAnchors:v})||(_=_===null?lt.errors:_.concat(lt.errors),o=_.length);var T=Y===o;if(!T)break}}}else return ye.errors=[{instancePath:i+"/warnings",schemaPath:"#/properties/warnings/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m)if(u.plan_hash!==void 0){let y=u.plan_hash;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>128)return ye.errors=[{instancePath:i+"/plan_hash",schemaPath:"#/properties/plan_hash/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1}else return ye.errors=[{instancePath:i+"/plan_hash",schemaPath:"#/properties/plan_hash/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0}}}}}}}}else return ye.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ye.errors=_,o===0}ye.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function $(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=$.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let T;if(u.id===void 0&&(T="id")||u.revision===void 0&&(T="revision")||u.requester===void 0&&(T="requester")||u.operation===void 0&&(T="operation")||u.status===void 0&&(T="status")||u.requested_at===void 0&&(T="requested_at")||u.requested_duration_seconds===void 0&&(T="requested_duration_seconds")||u.requested_max_uses===void 0&&(T="requested_max_uses")||u.granted_max_uses===void 0&&(T="granted_max_uses")||u.used_count===void 0&&(T="used_count")||u.presentation===void 0&&(T="presentation")||u.allowed_actions===void 0&&(T="allowed_actions"))return $.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:T},message:"must have required property '"+T+"'"}],!1;{const L=o;for(const A in u)if(!Jv.call(Qu.properties,A))return $.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:A},message:"must NOT have additional properties"}],!1;if(L===o){if(u.id!==void 0){let A=u.id;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>128)return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.revision!==void 0){let A=u.revision;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/revision",schemaPath:"#/properties/revision/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/revision",schemaPath:"#/properties/revision/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.requester!==void 0){let A=u.requester;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>80)return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/maxLength",keyword:"maxLength",params:{limit:80},message:"must NOT have more than 80 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/requester",schemaPath:"#/properties/requester/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.operation!==void 0){let A=u.operation;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>500)return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/maxLength",keyword:"maxLength",params:{limit:500},message:"must NOT have more than 500 characters"}],!1;if(ie(A)<1)return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return $.errors=[{instancePath:i+"/operation",schemaPath:"#/properties/operation/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.status!==void 0){let A=u.status;const y=o;if(typeof A!="string")return $.errors=[{instancePath:i+"/status",schemaPath:"#/$defs/Status/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(A==="pending"||A==="active"||A==="denied"||A==="canceled"||A==="expired"||A==="consumed"||A==="revoked"))return $.errors=[{instancePath:i+"/status",schemaPath:"#/$defs/Status/enum",keyword:"enum",params:{allowedValues:Zv.enum},message:"must be equal to one of the allowed values"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_at!==void 0){let A=u.requested_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/requested_at",schemaPath:"#/properties/requested_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/requested_at",schemaPath:"#/properties/requested_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.pending_expires_at!==void 0){let A=u.pending_expires_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/pending_expires_at",schemaPath:"#/properties/pending_expires_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/pending_expires_at",schemaPath:"#/properties/pending_expires_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.active_expires_at!==void 0){let A=u.active_expires_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/active_expires_at",schemaPath:"#/properties/active_expires_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/active_expires_at",schemaPath:"#/properties/active_expires_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_duration_seconds!==void 0){let A=u.requested_duration_seconds;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/requested_duration_seconds",schemaPath:"#/properties/requested_duration_seconds/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/requested_duration_seconds",schemaPath:"#/properties/requested_duration_seconds/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.requested_max_uses!==void 0){let A=u.requested_max_uses;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A))&&A!==null)return $.errors=[{instancePath:i+"/requested_max_uses",schemaPath:"#/properties/requested_max_uses/type",keyword:"type",params:{type:Qu.properties.requested_max_uses.type},message:"must be integer,null"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/requested_max_uses",schemaPath:"#/properties/requested_max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.granted_max_uses!==void 0){let A=u.granted_max_uses;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A))&&A!==null)return $.errors=[{instancePath:i+"/granted_max_uses",schemaPath:"#/properties/granted_max_uses/type",keyword:"type",params:{type:Qu.properties.granted_max_uses.type},message:"must be integer,null"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<1||isNaN(A)))return $.errors=[{instancePath:i+"/granted_max_uses",schemaPath:"#/properties/granted_max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var m=y===o}else var m=!0;if(m){if(u.used_count!==void 0){let A=u.used_count;const y=o;if(!(typeof A=="number"&&!(A%1)&&!isNaN(A)&&isFinite(A)))return $.errors=[{instancePath:i+"/used_count",schemaPath:"#/properties/used_count/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===y&&typeof A=="number"&&isFinite(A)&&(A<0||isNaN(A)))return $.errors=[{instancePath:i+"/used_count",schemaPath:"#/properties/used_count/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var m=y===o}else var m=!0;if(m){if(u.request_reason!==void 0){let A=u.request_reason;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>2e3)return $.errors=[{instancePath:i+"/request_reason",schemaPath:"#/properties/request_reason/maxLength",keyword:"maxLength",params:{limit:2e3},message:"must NOT have more than 2000 characters"}],!1}else return $.errors=[{instancePath:i+"/request_reason",schemaPath:"#/properties/request_reason/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_at!==void 0){let A=u.decided_at;const y=o;if(o===y&&o===y)if(typeof A=="string"){if(!el.validate(A))return $.errors=[{instancePath:i+"/decided_at",schemaPath:"#/properties/decided_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return $.errors=[{instancePath:i+"/decided_at",schemaPath:"#/properties/decided_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_by!==void 0){let A=u.decided_by;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>200)return $.errors=[{instancePath:i+"/decided_by",schemaPath:"#/properties/decided_by/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return $.errors=[{instancePath:i+"/decided_by",schemaPath:"#/properties/decided_by/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.decided_on_behalf_of!==void 0){let A=u.decided_on_behalf_of;const y=o;if(o===y)if(typeof A=="string"){if(ie(A)>200)return $.errors=[{instancePath:i+"/decided_on_behalf_of",schemaPath:"#/properties/decided_on_behalf_of/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return $.errors=[{instancePath:i+"/decided_on_behalf_of",schemaPath:"#/properties/decided_on_behalf_of/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=y===o}else var m=!0;if(m){if(u.presentation!==void 0){const A=o;ye(u.presentation,{instancePath:i+"/presentation",parentData:u,parentDataProperty:"presentation",rootData:h,dynamicAnchors:v})||(_=_===null?ye.errors:_.concat(ye.errors),o=_.length);var m=A===o}else var m=!0;if(m){if(u.presentation_unavailable!==void 0){const A=o;if(typeof u.presentation_unavailable!="boolean")return $.errors=[{instancePath:i+"/presentation_unavailable",schemaPath:"#/properties/presentation_unavailable/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=A===o}else var m=!0;if(m){if(u.allowed_actions!==void 0){let A=u.allowed_actions;const y=o;if(o===y)if(Array.isArray(A)){var O=!0;const le=A.length;for(let K=0;K<le;K++){let k=A[K];const Y=o;if(typeof k!="string")return $.errors=[{instancePath:i+"/allowed_actions/"+K,schemaPath:"#/$defs/Action/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(!(k==="approve"||k==="deny"||k==="revoke"))return $.errors=[{instancePath:i+"/allowed_actions/"+K,schemaPath:"#/$defs/Action/enum",keyword:"enum",params:{allowedValues:Vv.enum},message:"must be equal to one of the allowed values"}],!1;var O=Y===o;if(!O)break}if(O){let K=A.length,k;if(K>1){for(;K--;)for(k=K;k--;)if($v(A[K],A[k]))return $.errors=[{instancePath:i+"/allowed_actions",schemaPath:"#/properties/allowed_actions/uniqueItems",keyword:"uniqueItems",params:{i:K,j:k},message:"must NOT have duplicate items (items ## "+k+" and "+K+" are identical)"}],!1}}}else return $.errors=[{instancePath:i+"/allowed_actions",schemaPath:"#/properties/allowed_actions/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=y===o}else var m=!0;if(m)if(u.approval_bounds!==void 0){let A=u.approval_bounds;const y=o;if(o===o)if(A&&typeof A=="object"&&!Array.isArray(A)){let K;if(A.max_duration_seconds===void 0&&(K="max_duration_seconds")||A.max_uses===void 0&&(K="max_uses"))return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/required",keyword:"required",params:{missingProperty:K},message:"must have required property '"+K+"'"}],!1;{const k=o;for(const Y in A)if(!(Y==="max_duration_seconds"||Y==="max_uses"))return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:Y},message:"must NOT have additional properties"}],!1;if(k===o){if(A.max_duration_seconds!==void 0){let Y=A.max_duration_seconds;const Q=o;if(!(typeof Y=="number"&&!(Y%1)&&!isNaN(Y)&&isFinite(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_duration_seconds",schemaPath:"#/$defs/ApprovalBounds/properties/max_duration_seconds/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===Q&&typeof Y=="number"&&isFinite(Y)&&(Y<1||isNaN(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_duration_seconds",schemaPath:"#/$defs/ApprovalBounds/properties/max_duration_seconds/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var S=Q===o}else var S=!0;if(S)if(A.max_uses!==void 0){let Y=A.max_uses;const Q=o;if(!(typeof Y=="number"&&!(Y%1)&&!isNaN(Y)&&isFinite(Y))&&Y!==null)return $.errors=[{instancePath:i+"/approval_bounds/max_uses",schemaPath:"#/$defs/ApprovalBounds/properties/max_uses/type",keyword:"type",params:{type:Kv.properties.max_uses.type},message:"must be integer,null"}],!1;if(o===Q&&typeof Y=="number"&&isFinite(Y)&&(Y<1||isNaN(Y)))return $.errors=[{instancePath:i+"/approval_bounds/max_uses",schemaPath:"#/$defs/ApprovalBounds/properties/max_uses/minimum",keyword:"minimum",params:{comparison:">=",limit:1},message:"must be >= 1"}],!1;var S=Q===o}else var S=!0}}}else return $.errors=[{instancePath:i+"/approval_bounds",schemaPath:"#/$defs/ApprovalBounds/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=y===o}else var m=!0}}}}}}}}}}}}}}}}}}}}}else return $.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return $.errors=_,o===0}$.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Pv=lr,Oo=new RegExp("^[A-Za-z0-9_-]+$","u");function Ge(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=Ge.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.source_id===void 0&&(O="source_id")||u.source_label===void 0&&(O="source_label")||u.handle===void 0&&(O="handle")||u.request===void 0&&(O="request"))return Ge.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;{const S=o;for(const T in u)if(!(T==="source_id"||T==="source_label"||T==="handle"||T==="request"))return Ge.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;if(S===o){if(u.source_id!==void 0){let T=u.source_id;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>128)return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(T)<1)return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Ge.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.source_label!==void 0){let T=u.source_label;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>200)return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(T)<1)return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Ge.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.handle!==void 0){let T=u.handle;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>256)return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/maxLength",keyword:"maxLength",params:{limit:256},message:"must NOT have more than 256 characters"}],!1;if(ie(T)<22)return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/minLength",keyword:"minLength",params:{limit:22},message:"must NOT have fewer than 22 characters"}],!1;if(!Oo.test(T))return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Ge.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m)if(u.request!==void 0){const T=o;$(u.request,{instancePath:i+"/request",parentData:u,parentDataProperty:"request",rootData:h,dynamicAnchors:v})||(_=_===null?$.errors:_.concat($.errors),o=_.length);var m=T===o}else var m=!0}}}}}else return Ge.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Ge.errors=_,o===0}Ge.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function me(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=me.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let L;if(u.api_version===void 0&&(L="api_version")||u.cursor===void 0&&(L="cursor")||u.synchronized_at===void 0&&(L="synchronized_at")||u.sources===void 0&&(L="sources")||u.requests===void 0&&(L="requests"))return me.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"}],!1;{const A=o;for(const y in u)if(!(y==="api_version"||y==="cursor"||y==="synchronized_at"||y==="sources"||y==="requests"||y==="delivery_failures"))return me.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:y},message:"must NOT have additional properties"}],!1;if(A===o){if(u.api_version!==void 0){let y=u.api_version;const H=o;if(typeof y!="string")return me.errors=[{instancePath:i+"/api_version",schemaPath:"#/properties/api_version/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(y!=="brokerkit.io/operator-ui/v1")return me.errors=[{instancePath:i+"/api_version",schemaPath:"#/properties/api_version/const",keyword:"const",params:{allowedValue:"brokerkit.io/operator-ui/v1"},message:"must be equal to constant"}],!1;var m=H===o}else var m=!0;if(m){if(u.cursor!==void 0){let y=u.cursor;const H=o;if(o===H)if(typeof y=="string"){if(ie(y)>128)return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(y)<1)return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/cursor",schemaPath:"#/properties/cursor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.synchronized_at!==void 0){let y=u.synchronized_at;const H=o;if(o===H&&o===H)if(typeof y=="string"){if(!el.validate(y))return me.errors=[{instancePath:i+"/synchronized_at",schemaPath:"#/properties/synchronized_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return me.errors=[{instancePath:i+"/synchronized_at",schemaPath:"#/properties/synchronized_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=H===o}else var m=!0;if(m){if(u.sources!==void 0){let y=u.sources;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>100)return me.errors=[{instancePath:i+"/sources",schemaPath:"#/properties/sources/maxItems",keyword:"maxItems",params:{limit:100},message:"must NOT have more than 100 items"}],!1;{var O=!0;const K=y.length;for(let k=0;k<K;k++){let Y=y[k];const Q=o;if(o===o)if(Y&&typeof Y=="object"&&!Array.isArray(Y)){let ve;if(Y.id===void 0&&(ve="id")||Y.label===void 0&&(ve="label")||Y.healthy===void 0&&(ve="healthy"))return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/required",keyword:"required",params:{missingProperty:ve},message:"must have required property '"+ve+"'"}],!1;{const Ue=o;for(const te in Y)if(!(te==="id"||te==="label"||te==="healthy"||te==="last_sync_at"||te==="error"))return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:te},message:"must NOT have additional properties"}],!1;if(Ue===o){if(Y.id!==void 0){let te=Y.id;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>128)return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(te)<1)return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/id",schemaPath:"#/$defs/UISourceHealth/properties/id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S){if(Y.label!==void 0){let te=Y.label;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>200)return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(te)<1)return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/label",schemaPath:"#/$defs/UISourceHealth/properties/label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S){if(Y.healthy!==void 0){const te=o;if(typeof Y.healthy!="boolean")return me.errors=[{instancePath:i+"/sources/"+k+"/healthy",schemaPath:"#/$defs/UISourceHealth/properties/healthy/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var S=te===o}else var S=!0;if(S){if(Y.last_sync_at!==void 0){let te=Y.last_sync_at;const G=o;if(o===G&&o===G)if(typeof te=="string"){if(!el.validate(te))return me.errors=[{instancePath:i+"/sources/"+k+"/last_sync_at",schemaPath:"#/$defs/UISourceHealth/properties/last_sync_at/format",keyword:"format",params:{format:"date-time"},message:'must match format "date-time"'}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/last_sync_at",schemaPath:"#/$defs/UISourceHealth/properties/last_sync_at/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0;if(S)if(Y.error!==void 0){let te=Y.error;const G=o;if(o===G)if(typeof te=="string"){if(ie(te)>200)return me.errors=[{instancePath:i+"/sources/"+k+"/error",schemaPath:"#/$defs/UISourceHealth/properties/error/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1}else return me.errors=[{instancePath:i+"/sources/"+k+"/error",schemaPath:"#/$defs/UISourceHealth/properties/error/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var S=G===o}else var S=!0}}}}}}else return me.errors=[{instancePath:i+"/sources/"+k,schemaPath:"#/$defs/UISourceHealth/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var O=Q===o;if(!O)break}}}else return me.errors=[{instancePath:i+"/sources",schemaPath:"#/properties/sources/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m){if(u.requests!==void 0){let y=u.requests;const H=o;if(o===H)if(Array.isArray(y)){if(y.length>1e3)return me.errors=[{instancePath:i+"/requests",schemaPath:"#/properties/requests/maxItems",keyword:"maxItems",params:{limit:1e3},message:"must NOT have more than 1000 items"}],!1;{var T=!0;const K=y.length;for(let k=0;k<K;k++){const Y=o;Ge(y[k],{instancePath:i+"/requests/"+k,parentData:y,parentDataProperty:k,rootData:h,dynamicAnchors:v})||(_=_===null?Ge.errors:_.concat(Ge.errors),o=_.length);var T=Y===o;if(!T)break}}}else return me.errors=[{instancePath:i+"/requests",schemaPath:"#/properties/requests/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var m=H===o}else var m=!0;if(m)if(u.delivery_failures!==void 0){let y=u.delivery_failures;const H=o;if(!(typeof y=="number"&&!(y%1)&&!isNaN(y)&&isFinite(y)))return me.errors=[{instancePath:i+"/delivery_failures",schemaPath:"#/properties/delivery_failures/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===H&&typeof y=="number"&&isFinite(y)&&(y<0||isNaN(y)))return me.errors=[{instancePath:i+"/delivery_failures",schemaPath:"#/properties/delivery_failures/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var m=H===o}else var m=!0}}}}}}}else return me.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return me.errors=_,o===0}me.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function lr(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=lr.evaluated;return E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),me(u,{instancePath:i,parentData:f,parentDataProperty:c,rootData:h,dynamicAnchors:v})||(_=_===null?me.errors:_.concat(me.errors),o=_.length),lr.errors=_,o===0}lr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Wv=ct;function ct(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=ct.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.api_version===void 0&&(O="api_version")||u.cursor===void 0&&(O="cursor")||u.changed===void 0&&(O="changed"))return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;for(const S in u)if(!(S==="api_version"||S==="cursor"||S==="changed"))return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S},message:"must NOT have additional properties"}],!1;{if(u.api_version!==void 0){let S=u.api_version;const T=o;if(typeof S!="string")return ct.errors=[{instancePath:i+"/api_version",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/api_version/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;if(S!=="brokerkit.io/operator-ui/v1")return ct.errors=[{instancePath:i+"/api_version",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/api_version/const",keyword:"const",params:{allowedValue:"brokerkit.io/operator-ui/v1"},message:"must be equal to constant"}],!1;var m=T===o}else var m=!0;if(m){if(u.cursor!==void 0){let S=u.cursor;const T=o;if(typeof S=="string"){if(ie(S)>128)return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(S)<1)return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return ct.errors=[{instancePath:i+"/cursor",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/cursor/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=T===o}else var m=!0;if(m)if(u.changed!==void 0){const S=o;if(typeof u.changed!="boolean")return ct.errors=[{instancePath:i+"/changed",schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/properties/changed/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var m=S===o}else var m=!0}}}else return ct.errors=[{instancePath:i,schemaPath:"https://brokerkit.dev/schema/operator/v1/runtime/components#/$defs/UISnapshotEvent/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return ct.errors=_,o===0}ct.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};const Fv=nr;function Xe(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=Xe.evaluated;if(E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),o===0)if(u&&typeof u=="object"&&!Array.isArray(u)){let O;if(u.source_id===void 0&&(O="source_id")||u.source_label===void 0&&(O="source_label")||u.handle===void 0&&(O="handle")||u.request===void 0&&(O="request"))return Xe.errors=[{instancePath:i,schemaPath:"#/required",keyword:"required",params:{missingProperty:O},message:"must have required property '"+O+"'"}],!1;{const S=o;for(const T in u)if(!(T==="source_id"||T==="source_label"||T==="handle"||T==="request"))return Xe.errors=[{instancePath:i,schemaPath:"#/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:T},message:"must NOT have additional properties"}],!1;if(S===o){if(u.source_id!==void 0){let T=u.source_id;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>128)return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/maxLength",keyword:"maxLength",params:{limit:128},message:"must NOT have more than 128 characters"}],!1;if(ie(T)<1)return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Xe.errors=[{instancePath:i+"/source_id",schemaPath:"#/properties/source_id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.source_label!==void 0){let T=u.source_label;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>200)return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/maxLength",keyword:"maxLength",params:{limit:200},message:"must NOT have more than 200 characters"}],!1;if(ie(T)<1)return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/minLength",keyword:"minLength",params:{limit:1},message:"must NOT have fewer than 1 characters"}],!1}else return Xe.errors=[{instancePath:i+"/source_label",schemaPath:"#/properties/source_label/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m){if(u.handle!==void 0){let T=u.handle;const L=o;if(o===L)if(typeof T=="string"){if(ie(T)>256)return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/maxLength",keyword:"maxLength",params:{limit:256},message:"must NOT have more than 256 characters"}],!1;if(ie(T)<22)return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/minLength",keyword:"minLength",params:{limit:22},message:"must NOT have fewer than 22 characters"}],!1;if(!Oo.test(T))return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/pattern",keyword:"pattern",params:{pattern:"^[A-Za-z0-9_-]+$"},message:'must match pattern "^[A-Za-z0-9_-]+$"'}],!1}else return Xe.errors=[{instancePath:i+"/handle",schemaPath:"#/properties/handle/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var m=L===o}else var m=!0;if(m)if(u.request!==void 0){const T=o;$(u.request,{instancePath:i+"/request",parentData:u,parentDataProperty:"request",rootData:h,dynamicAnchors:v})||(_=_===null?$.errors:_.concat($.errors),o=_.length);var m=T===o}else var m=!0}}}}}else return Xe.errors=[{instancePath:i,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Xe.errors=_,o===0}Xe.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function nr(u,{instancePath:i="",parentData:f,parentDataProperty:c,rootData:h=u,dynamicAnchors:v={}}={}){let _=null,o=0;const E=nr.evaluated;return E.dynamicProps&&(E.props=void 0),E.dynamicItems&&(E.items=void 0),Xe(u,{instancePath:i,parentData:f,parentDataProperty:c,rootData:h,dynamicAnchors:v})||(_=_===null?Xe.errors:_.concat(Xe.errors),o=_.length),nr.errors=_,o===0}nr.evaluated={props:!0,dynamicProps:!1,dynamicItems:!1};function zo(u){return Zu(Fv,u)}function Iv(u){return Zu(Pv,u)}function e0(u){return Zu(Wv,u)}function Zu(u,i){if(!u(i))throw new Error("Operator V1 response is invalid");return i}const No="BrokerKit-Session",t0=4096;function Vu(u){return u.length>=32&&u.length<=t0&&/^[\x21-\x2B\x2D-\x7E]+$/u.test(u)}const a0="brokerkit.delegated-web.session.request",l0="brokerkit.delegated-web.session.response",n0="brokerkit.delegated-web.rebootstrap",r0="brokerkit-delegated-session";class u0{constructor(i){this.bootstrap=i}delegatedSession;delegatedRefresh;delegatedRebootstrapRequested=!1;snapshot(i){return this.request("/snapshot",i?{signal:i}:{}).then(Iv)}events(i,f){return this.request(`/events?cursor=${encodeURIComponent(i)}&wait_seconds=25`,{signal:f}).then(e0)}canDecide(){return this.bootstrap.mode==="direct"||this.delegatedSession?.access==="decide"}detail(i){return this.request(`/requests/${encodeURIComponent(i)}`).then(zo)}decide(i,f,c={}){return this.request(`/requests/${encodeURIComponent(i.handle)}/${f}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({expectedRevision:i.request.revision,...c})}).then(zo)}async request(i,f={}){const c=await this.authorization(),h=this.bootstrap.mode==="direct"?"/plugins/brokerkit/api/v1":this.bootstrap.basePath,v=await fetch(`${h}${i}`,{...f,credentials:this.bootstrap.mode==="delegated-web"?"include":"omit",cache:"no-store",redirect:"error",headers:Do(f.headers,c.token)});if(!v.ok)throw await Ro(v);return JSON.parse(await Ju(v,2e6))}async authorization(){if(this.bootstrap.mode==="direct")return{token:this.bootstrap.capability,expiresAtMs:Number.POSITIVE_INFINITY,access:"decide",renewalTransport:"direct"};if(this.delegatedSession&&this.delegatedSession.expiresAtMs>Date.now()+3e4)return this.delegatedSession;if(this.delegatedRefresh)return this.delegatedRefresh;this.delegatedRefresh=this.refreshDelegatedAuthorization();try{return await this.delegatedRefresh}finally{this.delegatedRefresh=void 0}}async refreshDelegatedAuthorization(){if(this.bootstrap.mode!=="delegated-web")throw new Error("Delegated approval session is invalid");let i;try{i=await i0(this.bootstrap.basePath,this.delegatedSession)}catch(h){throw this.delegatedSession&&Ku()&&f0(h)==="not_authorized"&&this.requestDelegatedRebootstrap(),h}const f=Date.parse(typeof i.expires_at=="string"?i.expires_at:"");if(Object.keys(i).sort().join(",")!=="access,api_version,expires_at,renewal_transport,token"||i.api_version!=="brokerkit.io/delegated-web/v1"||typeof i.token!="string"||!Vu(i.token)||i.access!=="read"&&i.access!=="decide"||i.renewal_transport!=="direct"&&i.renewal_transport!=="parent"||!Number.isFinite(f)||f<=Date.now()||f>Date.now()+5*6e4)throw new Error("Delegated approval session is invalid");return this.delegatedSession={token:i.token,expiresAtMs:f,access:i.access,renewalTransport:i.renewal_transport},this.delegatedSession}requestDelegatedRebootstrap(){this.delegatedRebootstrapRequested||(this.delegatedRebootstrapRequested=!0,window.parent.postMessage({type:n0,version:1},"*"))}}async function i0(u,i){const f=s0();if(f)return f;if(i&&(i.renewalTransport==="direct"||!Ku())){const c=await fetch(`${u}/session`,{method:"POST",credentials:"include",cache:"no-store",redirect:"error",headers:Do(void 0,i.token)});if(!c.ok)throw await Ro(c);return JSON.parse(await Ju(c,16384))}if(i)return wo();if(!Ku())throw new Error("Approval authorization expired");return wo()}function Do(u,i){if(!Vu(i))throw new Error("Approval authorization expired");const f=new Headers(u);return f.delete("authorization"),f.delete(No),f.set(No,i),f}function s0(){if(typeof document>"u")return;const u=document.querySelector(`meta[name="${r0}"]`);if(!u)return;const i=u.getAttribute("content")??"";if(u.remove(),!i||i.length>8192)return{};try{const f=i.replace(/-/gu,"+").replace(/_/gu,"/"),c=f.padEnd(Math.ceil(f.length/4)*4,"="),h=JSON.parse(atob(c));return Zl(h)?h:{}}catch{return{}}}function Ku(){return typeof window<"u"&&window.parent!==window}function wo(){const u=c0();return new Promise((i,f)=>{const c=window.setTimeout(()=>{v(),f(new Error("Approval authorization expired"))},1e4),h=_=>{if(!(_.source!==window.parent||!Zl(_.data))&&!(_.data.type!==l0||_.data.nonce!==u)){if(v(),!Zl(_.data.session)){f(new Error("Approval authorization expired"));return}i(_.data.session)}},v=()=>{window.clearTimeout(c),window.removeEventListener("message",h)};window.addEventListener("message",h),window.parent.postMessage({type:a0,version:1,nonce:u},"*")})}function c0(){const u=new Uint8Array(16);return crypto.getRandomValues(u),[...u].map(i=>i.toString(16).padStart(2,"0")).join("")}function o0(u){if(!u||u.length>2048)throw new Error("Approval UI bootstrap is invalid");let i;try{const c=u.replace(/-/gu,"+").replace(/_/gu,"/"),h=c.padEnd(Math.ceil(c.length/4)*4,"=");i=JSON.parse(atob(h))}catch{throw new Error("Approval UI bootstrap is invalid")}if(!Zl(i)||i.version!==1||typeof i.mode!="string")throw new Error("Approval UI bootstrap is invalid");const f=Object.keys(i).sort().join(",");if(i.mode==="direct"&&f==="capability,mode,version"&&typeof i.capability=="string"&&Vu(i.capability)&&i.capability.length>=32&&i.capability.length<=256)return{version:1,mode:"direct",capability:i.capability};if(i.mode==="delegated-web"&&f==="basePath,mode,version"&&typeof i.basePath=="string"&&d0(i.basePath))return{version:1,mode:"delegated-web",basePath:i.basePath};throw new Error("Approval UI bootstrap is invalid")}function Zl(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}function f0(u){return u instanceof Error&&"code"in u?String(u.code):void 0}function d0(u){return u.length>=2&&u.length<=256&&u.startsWith("/")&&!u.startsWith("//")&&!u.endsWith("/")&&!/[?#\\]/u.test(u)&&!m0(u)&&!u.includes("..")&&u.split("/").every((i,f)=>f===0||/^[A-Za-z0-9._~-]+$/u.test(i))}function m0(u){return[...u].some(i=>{const f=i.codePointAt(0)??0;return f<32||f===127})}async function Ro(u){try{const i=JSON.parse(await Ju(u,64e3)),f=Zl(i.error)?i.error:void 0;if(f&&typeof f.code=="string")return Object.assign(new Error(h0(f.code)),{code:f.code})}catch{}return new Error(u.status===401||u.status===403?"Approval authorization expired":"Approvals are unavailable")}function h0(u){return u==="revision_stale"?"This request changed; refresh and review it again":u==="request_terminal"?"This request is already settled":u==="not_authorized"?"Approval authorization expired":u==="source_unavailable"?"The approval source is unavailable":u==="cursor_expired"?"Approval updates expired":"The approval request could not be completed"}async function Ju(u,i){if(!u.body)return"";const f=u.body.getReader(),c=[];let h=0;for(;;){const{done:o,value:E}=await f.read();if(o)break;if(h+=E.byteLength,h>i)throw await f.cancel(),new Error("Approvals are unavailable");c.push(E)}const v=new Uint8Array(h);let _=0;for(const o of c)v.set(o,_),_+=o.byteLength;return new TextDecoder("utf-8",{fatal:!0}).decode(v)}const p0="brokerkit.operator-ui.invalidate";function v0(u){const[i,f]=D.useState(),[c,h]=D.useState(!1),[v,_]=D.useState(""),o=D.useRef(void 0),E=D.useRef(void 0),m=D.useRef(void 0),O=D.useRef(void 0),S=D.useRef(0),T=D.useCallback(()=>{if(O.current?.abort(),E.current)return E.current;const L=++S.current,A=new AbortController;m.current=A;const y=u.snapshot(A.signal).then(H=>(L===S.current&&(o.current=H,f(H),h(u.canDecide()),_("")),H)).catch(H=>{throw $u(H)||_(Mo(H)),H}).finally(()=>{E.current===y&&(E.current=void 0),m.current===A&&(m.current=void 0)});return E.current=y,y},[u]);return D.useEffect(()=>{let L=!1;const A=new AbortController;let y=250;const H=async()=>{for(;!L;)try{const Q=o.current??await T();if(L)return;const he=new AbortController;O.current=he;const re=await u.events(Q.cursor,he.signal);O.current===he&&(O.current=void 0),_(""),re.changed&&!L&&await T(),y=250}catch(Q){if(L)return;if($u(Q))continue;if(y0(Q)==="cursor_expired")try{await T(),y=250;continue}catch{}_(Mo(Q));try{await g0(y,A.signal)}catch(he){if(L||$u(he))return;throw he}y=Math.min(y*2,3e4)}},le=()=>void T().catch(()=>{}),K=()=>{document.visibilityState==="visible"&&le()},k=Q=>{Q.source!==window.parent||!b0(Q.data)||Object.keys(Q.data).sort().join(",")!=="type,version"||Q.data.type!==p0||Q.data.version!==1||le()},Y=window.setInterval(le,5*6e4);return window.addEventListener("focus",le),window.addEventListener("message",k),document.addEventListener("visibilitychange",K),H(),()=>{L=!0,A.abort(),O.current?.abort(),m.current?.abort(),window.clearInterval(Y),window.removeEventListener("focus",le),window.removeEventListener("message",k),document.removeEventListener("visibilitychange",K)}},[u,T]),{snapshot:i,canDecide:c,error:v,setError:_,reconcile:T}}function y0(u){return u instanceof Error&&"code"in u?String(u.code):void 0}function Mo(u){return u instanceof Error?u.message:"Approvals are unavailable"}function $u(u){return u instanceof Error&&u.name==="AbortError"}function g0(u,i){const f=Math.floor(Math.random()*Math.max(1,u/4));return new Promise((c,h)=>{const v=window.setTimeout(o,u+f),_=()=>{window.clearTimeout(v),i.removeEventListener("abort",_),h(new DOMException("The operation was aborted","AbortError"))};function o(){i.removeEventListener("abort",_),c()}i.addEventListener("abort",_,{once:!0})})}function b0(u){return!!u&&typeof u=="object"&&!Array.isArray(u)}const _0=o0(location.hash.slice(1)),qo=new u0(_0);history.replaceState(null,"",location.pathname);function S0(){const{snapshot:u,canDecide:i,error:f,setError:c,reconcile:h}=v0(qo),[v,_]=D.useState(""),[o,E]=D.useState(),m=async(S,T,L)=>{_(S.handle);try{await qo.decide(S,T,L),E(void 0),await h()}catch(A){c(A instanceof Error?A.message:"Decision failed")}finally{_("")}},O=D.useMemo(()=>u?.requests.filter(S=>S.request.allowed_actions.length>0)??[],[u]);return C.jsxs("main",{children:[C.jsxs("header",{children:[C.jsxs("div",{children:[C.jsxs("p",{className:"eyebrow",children:[C.jsx(_o,{size:15})," BrokerKit"]}),C.jsx("h1",{children:"Approvals"}),C.jsxs("p",{className:"subtle",children:[O.filter(S=>S.request.status==="pending").length," ","pending across ",u?.sources.length??0," sources"]})]}),C.jsx("button",{className:"icon",title:"Refresh",onClick:()=>void h().catch(()=>{}),children:C.jsx(Mv,{size:18})})]}),f&&C.jsxs("div",{className:"error",children:[C.jsx(Yu,{size:17}),C.jsx("span",{children:f}),C.jsx("button",{title:"Dismiss",onClick:()=>c(""),children:C.jsx(qv,{size:16})})]}),(u?.delivery_failures??0)>0&&C.jsxs("div",{className:"warning",role:"status",children:[C.jsx(Yu,{size:17}),C.jsxs("span",{children:[u?.delivery_failures," notification",u?.delivery_failures===1?"":"s"," need attention"]})]}),C.jsx("section",{className:"sources","aria-label":"Source health",children:u?.sources.map(S=>C.jsxs("div",{className:"source",children:[C.jsx("span",{className:S.healthy?"dot healthy":"dot"}),C.jsx("span",{children:S.label}),C.jsx("small",{children:S.healthy?"Connected":"Unavailable"})]},S.id))}),C.jsxs("section",{className:"requests",children:[O.map(S=>C.jsxs("article",{children:[C.jsxs("div",{className:"request-head",children:[C.jsxs("div",{children:[C.jsx("span",{className:`risk ${S.request.presentation.risk}`,children:S.request.presentation.risk}),C.jsx("span",{className:"source-label",children:S.source_label}),C.jsx("h2",{children:S.request.presentation.title})]}),C.jsx("code",{children:S.handle.slice(0,8)})]}),C.jsx(Uo,{presentation:S.request.presentation}),S.request.presentation.summary&&C.jsx("p",{children:S.request.presentation.summary}),C.jsx("dl",{children:S.request.presentation.facts?.map(T=>C.jsxs(xu.Fragment,{children:[C.jsx("dt",{children:T.label}),C.jsx("dd",{children:T.value})]},`${T.label}-${T.value}`))}),C.jsxs("div",{className:"meta",children:[C.jsx("span",{children:S.request.requester}),C.jsx("span",{children:S.request.requested_max_uses===null?"Unlimited uses":`${S.request.requested_max_uses} use${S.request.requested_max_uses===1?"":"s"}`}),C.jsxs("span",{children:[Math.round(S.request.requested_duration_seconds/60)," ","min"]})]}),C.jsxs("div",{className:"actions",children:[i&&S.request.allowed_actions.includes("revoke")&&C.jsxs("button",{className:"secondary",disabled:v===S.handle,onClick:()=>E({request:S,action:"revoke"}),children:[C.jsx(bo,{size:16}),"Revoke"]}),i&&S.request.allowed_actions.includes("deny")&&C.jsxs("button",{className:"secondary",disabled:v===S.handle,onClick:()=>E({request:S,action:"deny"}),children:[C.jsx(bo,{size:16}),"Deny"]}),i&&S.request.allowed_actions.includes("approve")&&C.jsxs("button",{className:"primary",disabled:v===S.handle,onClick:()=>E({request:S,action:"approve"}),children:[C.jsx(wv,{size:16}),"Approve"]})]})]},S.handle)),u&&O.length===0&&C.jsxs("div",{className:"empty",children:[C.jsx(_o,{size:30}),C.jsx("h2",{children:"No actionable requests"}),C.jsx("p",{children:"Approved, denied, expired, and canceled requests clear automatically."})]})]}),C.jsx(E0,{decision:o,busy:!!(o&&v===o.request.handle),onClose:()=>E(void 0),onConfirm:m})]})}function Uo({presentation:u,compact:i=!1}){return C.jsxs("div",{className:`presentation-safety${i?" compact":""}`,children:[C.jsxs("div",{className:"request-target",children:[C.jsx(Rv,{size:15,"aria-hidden":"true"}),C.jsx("span",{children:u.target})]}),u.warnings&&u.warnings.length>0&&C.jsx("ul",{className:"request-warnings","aria-label":"Request warnings",children:u.warnings.map(f=>C.jsxs("li",{className:`request-warning ${f.severity}`,children:[C.jsx(Yu,{size:15,"aria-hidden":"true"}),C.jsx("span",{children:f.text})]},`${f.severity}-${f.text}`))})]})}function E0({decision:u,busy:i,onClose:f,onConfirm:c}){const h=u?.request,v=h?.request.approval_bounds,[_,o]=D.useState(1),[E,m]=D.useState(1);if(D.useEffect(()=>{if(!h)return;o(Math.max(1,Math.min(h.request.requested_duration_seconds,v?.max_duration_seconds??h.request.requested_duration_seconds)));const T=h.request.requested_max_uses,L=v?.max_uses;m(T===null?null:L==null?T:Math.min(T,L))},[h,v]),!u||!h)return null;const O=u.action==="approve",S=`${Co(u.action)} request`;return C.jsx(gv,{open:!0,onOpenChange:T=>!T&&f(),children:C.jsxs(bv,{children:[C.jsx(_v,{className:"dialog-overlay"}),C.jsxs(Sv,{className:"dialog-content",children:[C.jsx(Ev,{children:S}),C.jsxs(xv,{children:[h.request.presentation.title," at revision"," ",h.request.revision]}),C.jsx(Uo,{presentation:h.request.presentation,compact:!0}),O&&v&&C.jsxs("div",{className:"decision-bounds",children:[C.jsxs("label",{children:["Duration (seconds)",C.jsx("input",{type:"number",min:1,max:v.max_duration_seconds,value:_,onChange:T=>o(T.currentTarget.valueAsNumber)})]}),C.jsxs("label",{children:["Maximum uses",C.jsx("input",{type:"number",min:1,max:v.max_uses??void 0,value:E??1,disabled:E===null,onChange:T=>m(T.currentTarget.valueAsNumber)})]}),v.max_uses===null&&C.jsxs("label",{children:[C.jsx("input",{type:"checkbox",checked:E===null,onChange:T=>m(T.currentTarget.checked?null:1)}),"Unlimited until expiry"]})]}),C.jsxs("div",{className:"dialog-actions",children:[C.jsx(Tv,{asChild:!0,children:C.jsx("button",{className:"secondary",disabled:i,children:"Cancel"})}),C.jsx("button",{className:O?"primary":"danger",disabled:i||!x0(O,_,E,v),onClick:()=>void c(h,u.action,{...O&&v?{constraints:{durationSeconds:_,maxUses:E}}:{}}),children:Co(u.action)})]})]})]})})}function x0(u,i,f,c){return!u||!c?!0:f===null?c.max_uses===null:Number.isSafeInteger(i)&&i>0&&i<=c.max_duration_seconds&&Number.isSafeInteger(f)&&f>0&&(c.max_uses===null||f<=c.max_uses)}function Co(u){return u.charAt(0).toUpperCase()+u.slice(1)}Hh.createRoot(document.getElementById("root")).render(C.jsx(xu.StrictMode,{children:C.jsx(S0,{})}))})();
|
package/dist/ui/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
6
|
<title>BrokerKit Approvals</title>
|
|
7
|
-
<script defer src="/plugins/brokerkit/ui/assets/index-
|
|
7
|
+
<script defer src="/plugins/brokerkit/ui/assets/index-DZMf5YR3.js"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
10
10
|
<div id="root"></div>
|