wicked-studio 0.16.16 → 0.16.17

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
@@ -89,11 +89,13 @@ reasoning in a scrollback you'll never read. wicked-studio flips that:
89
89
 
90
90
  - **Run governed agents on your repos** — register a local path or clone a URL; studio builds the
91
91
  code graph, then you launch runs (ask / balanced / autonomous), pick which agent seats join, and
92
- bind a repo with optional PR delivery. On a crew with **power mode**, it is on by default when you
93
- launch a preset or a composed plan on a repository, unless Settings says otherwise (a switch on
94
- New job and beside the job's name); a chat's own run and a phase-based workflow run phased. The
95
- code-writing build step then runs as one orchestrator's checkpointed turns (other required steps
96
- can run separately): the job page shows its rigor (with ↑ when it rose since intake), its
92
+ bind a repo with optional PR delivery. On a crew with **power mode**, a job runs in power mode by
93
+ default unless Settings says otherwise, and you can turn it off where you start it: a **Review
94
+ plan** switch beside a chat's Start, or New job's **Power mode** switch when New job opens on a named
95
+ workflow (not offered for Draft epics or Demo video), and a Power mode switch sits beside the job's name. Crew runs power mode only for a preset
96
+ or a composed plan on a repository: any other workflow runs phased even with power on. In power
97
+ mode, the code-writing build step runs as one orchestrator's checkpointed turns (other required
98
+ steps can run separately): the job page shows its rigor (with ↑ when it rose since intake), its
97
99
  checkpoints, and, when the change grows past its plan, a pause that offers to split it into lanes,
98
100
  switch to phased, continue at high rigor or stop.
99
101
  - **Steer runs live** — the Desk (the one shell) puts what needs you first; every run or chat
@@ -118,7 +120,7 @@ reasoning in a scrollback you'll never read. wicked-studio flips that:
118
120
  independent sources) or **unconfirmed** with why (rows from an older build, or outside the
119
121
  count, may carry no verdict). A row the share does not count (a type shape, code that is not
120
122
  product code, or a file the code index skipped) carries a **not counted** mark with why, and a line
121
- under the coverage says how many stated rules and placeholders sit on type shapes. The Config &
123
+ under the coverage says how many stated rules and placeholders are not counted, for any of those reasons. The Config &
122
124
  data filter is hidden when crew reports no config and data rows. When the list is an older graph build than the header's numbers, it says
123
125
  so. A repo with no requirements graph yet offers **Generate it** (or **Keep mapping** once some real
124
126
  requirements are mapped), which opens New job filled in with the generating workflow; while a mapping job
@@ -129,8 +131,12 @@ reasoning in a scrollback you'll never read. wicked-studio flips that:
129
131
  searchable. Choose up to 40 requirements and **Draft epics** opens New job on the Draft epics
130
132
  workflow with them. The old Product address (`/product?project=<id>`) opens that project's page
131
133
  at its Requirements section. Publishing the drafted epics is not offered yet.
132
- - **Ask several seats at once** — a chat can hold more than one warm CLI seat; each answers in the
133
- thread, and the daemon checks every path, `path:line` and commit a reply cites against the repo.
134
+ - **Ask a team** — in a chat, one helper answers (your pick, or picked at random), a second
135
+ signed-in helper reviews when there is one, and the answering helper can ask other helpers
136
+ mid-answer (an Understand analysis chat uses one helper and no reviewer). The chat's Helpers tab
137
+ names who answers, who reviews and who helped; the Watchtower says when another helper takes over,
138
+ when no reviewer could join, or when a helper's question went unanswered. The daemon checks every
139
+ path, `path:line` and commit a reply cites against the repo.
134
140
  - **Govern the work** — author steering rules and policies (or import a markdown rule doc; a
135
141
  refused entry shows crew's reason), browse the decisions ledger, and review what the platform has
136
142
  learned about your repos. **Evaluate** runs your rules against example behaviours: it recommends
@@ -200,8 +206,9 @@ reasoning in a scrollback you'll never read. wicked-studio flips that:
200
206
  - **See your knowledge** — Understand's **Knowledge map** draws your data sources and their tables
201
207
  beside your repositories and code, with the approved data shapes (what joins what, and which code
202
208
  describes a table) and the tracker links. **Profile this source** on a Postgres source's sheet
203
- finds shapes from counts alone, never a value, and each one waits on the map for your Approve or
204
- Reject.
209
+ finds shapes from counts alone, never a value, and writes them straight into knowledge, since you
210
+ started it; profiling again replaces them. A shape an agent proposes waits on the map for your
211
+ Approve or Reject.
205
212
 
206
213
  These need wicked-crew 0.17.0 or later, which bundles this release. Against an older daemon studio
207
214
  hides most of them or says the daemon doesn't offer them; Apps shows two sample apps, marked as samples,
@@ -296,8 +303,10 @@ any `localhost` / `127.0.0.1` origin, so a standalone studio drives a local daem
296
303
 
297
304
  ### Plugins
298
305
 
299
- Artifact editors are plugins: one self-contained HTML file per editor, run in a sandboxed frame with no network
300
- and talking to studio's plugin host over one MessagePort (the `wicked.editor` envelope, protocols 1 to 3,
306
+ Artifact editors are plugins: one self-contained HTML file per editor, run in a sandboxed frame whose scripts
307
+ can't connect anywhere (no fetch, XHR, WebSocket or beacon). A built-in editor holding `network.media` may load
308
+ images and fonts over https; the Page and Document editors hold it by default, and a third-party editor never
309
+ gets it. Each editor talks to studio's plugin host over one MessagePort (the `wicked.editor` envelope, protocols 1 to 3,
301
310
  `src/editors/`). A **run plugin** uses the same sandbox on protocol 3: the host sends it the job's events on the
302
311
  topics it was granted (`events.batch`), and it draws a section of the job's Details panel; the built-in Phase
303
312
  report is one. The **Plugins** page (`/plugins`, under Build & settings) shows every plugin as a card with what
@@ -1,4 +1,4 @@
1
- var De=Object.defineProperty;var Me=(H,F,z)=>F in H?De(H,F,{enumerable:!0,configurable:!0,writable:!0,value:z}):H[F]=z;var Q=(H,F,z)=>Me(H,typeof F!="symbol"?F+"":F,z);(function(){"use strict";const H=new Set(["security_review_on_non_code_plan","writes_nothing_on_code"]);function F(e){const t=e.split(": ");for(const r of t.slice(0,-1)){const s=r.trim();if(/^[a-z][a-z0-9]*(_[a-z0-9]+)+$/.test(s))return s}return null}function z(e){return/\(rule (.+?) requires it\)/.exec(e)?.[1]??null}function Se(e){const t=F(e),r=t!==null&&H.has(t)?t:null;if(r==="security_review_on_non_code_plan"){const s=z(e);return`a security review was asked for on a run that writes no code${s!==null?` (rule ${s} requires it)`:""} — its code-evidence check could never pass`}return r==="writes_nothing_on_code"?"a step marked “writes nothing” is on a phase that changes code":null}const ie={gh_account_mismatch:"That account isn’t the one the GitHub CLI is signed in as: choose another, or check again. Nothing was saved.",gh_not_installed:"The GitHub CLI isn’t installed where crew runs. Nothing was saved.",gh_signed_out:"The GitHub CLI is signed out where crew runs. Nothing was saved.",gh_token_unavailable:"The GitHub CLI couldn’t supply a login for that account. Nothing was saved.",gh_cli_not_allowed:"This source can’t use the GitHub CLI login. Nothing was saved."};function ae(e,t,r){const s=t.trim();if(r!=null&&Object.hasOwn(ie,r)){const h=ie[r];return s===""?h:`${h} — ${s}`}if(s==="")return`the daemon refused this — it answered HTTP ${e} with no detail`;const l=Se(s);return l!==null?`the daemon refused this plan: ${l} — ${s}`:`the daemon refused this — ${s}`}class ee extends Error{constructor(r,s,l){const h=typeof l=="object"&&l!==null?l.code:void 0;super(ae(r,s,typeof h=="string"?h:null));Q(this,"status");Q(this,"wire");Q(this,"body");this.name="ApiError",this.status=r,this.wire=s,this.body=l}}function ce(e){return e instanceof ee?e.status:null}const ue=e=>{let t;const r=new Set,s=(f,g)=>{const d=typeof f=="function"?f(t):f;if(!Object.is(d,t)){const _=t;t=g??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(N=>N(t,_))}},l=()=>t,I={setState:s,getState:l,getInitialState:()=>y,subscribe:f=>(r.add(f),()=>r.delete(f))},y=t=e(s,l,I);return I},be=(e=>e?ue(e):ue);function ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var te={exports:{}},m={};/**
1
+ var Ve=Object.defineProperty;var He=(V,F,z)=>F in V?Ve(V,F,{enumerable:!0,configurable:!0,writable:!0,value:z}):V[F]=z;var ee=(V,F,z)=>He(V,typeof F!="symbol"?F+"":F,z);(function(){"use strict";const V=new Set(["security_review_on_non_code_plan","writes_nothing_on_code"]);function F(e){const t=e.split(": ");for(const o of t.slice(0,-1)){const s=o.trim();if(/^[a-z][a-z0-9]*(_[a-z0-9]+)+$/.test(s))return s}return null}function z(e){return/\(rule (.+?) requires it\)/.exec(e)?.[1]??null}function ve(e){const t=F(e),o=t!==null&&V.has(t)?t:null;if(o==="security_review_on_non_code_plan"){const s=z(e);return`a security review was asked for on a run that writes no code${s!==null?` (rule ${s} requires it)`:""} — its code-evidence check could never pass`}return o==="writes_nothing_on_code"?"a step marked “writes nothing” is on a phase that changes code":null}const ie={gh_account_mismatch:"That account isn’t the one the GitHub CLI is signed in as: choose another, or check again. Nothing was saved.",gh_not_installed:"The GitHub CLI isn’t installed where crew runs. Nothing was saved.",gh_signed_out:"The GitHub CLI is signed out where crew runs. Nothing was saved.",gh_token_unavailable:"The GitHub CLI couldn’t supply a login for that account. Nothing was saved.",gh_cli_not_allowed:"This source can’t use the GitHub CLI login. Nothing was saved."},$e="Wait for maintenance to finish, or turn off “Drain for maintenance” in Settings to admit work again.";function ae(e,t,o){const s=t.trim();if(o==="maintenance_drain")return`${s===""?"This daemon is draining for maintenance and is refusing new work.":s} ${$e}`;if(o!=null&&Object.hasOwn(ie,o)){const h=ie[o];return s===""?h:`${h} — ${s}`}if(s==="")return`the daemon refused this — it answered HTTP ${e} with no detail`;const u=ve(s);return u!==null?`the daemon refused this plan: ${u} — ${s}`:`the daemon refused this — ${s}`}class K extends Error{constructor(o,s,u){const h=typeof u=="object"&&u!==null?u.code:void 0;super(ae(o,s,typeof h=="string"?h:null));ee(this,"status");ee(this,"wire");ee(this,"body");this.name="ApiError",this.status=o,this.wire=s,this.body=u}}function ce(e){return e instanceof K?e.status:null}const ue=e=>{let t;const o=new Set,s=(p,g)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const U=t;t=g??(typeof d!="object"||d===null)?d:Object.assign({},t,d),o.forEach(A=>A(t,U))}},u=()=>t,P={setState:s,getState:u,getInitialState:()=>y,subscribe:p=>(o.add(p),()=>o.delete(p))},y=t=e(s,u,P);return P},Re=(e=>e?ue(e):ue);function Ce(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var te={exports:{}},m={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,5 +6,5 @@ var De=Object.defineProperty;var Me=(H,F,z)=>F in H?De(H,F,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var le;function $e(){if(le)return m;le=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),x=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),d=Symbol.iterator;function _(n){return n===null||typeof n!="object"?null:(n=d&&n[d]||n["@@iterator"],typeof n=="function"?n:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,L={};function q(n,i,b){this.props=n,this.context=i,this.refs=L,this.updater=b||N}q.prototype.isReactComponent={},q.prototype.setState=function(n,i){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,i,"setState")},q.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function A(){}A.prototype=q.prototype;function J(n,i,b){this.props=n,this.context=i,this.refs=L,this.updater=b||N}var v=J.prototype=new A;v.constructor=J,C(v,q.prototype),v.isPureReactComponent=!0;var a=Array.isArray,c=Object.prototype.hasOwnProperty,u={current:null},p={key:!0,ref:!0,__self:!0,__source:!0};function T(n,i,b){var R,$={},k=null,j=null;if(i!=null)for(R in i.ref!==void 0&&(j=i.ref),i.key!==void 0&&(k=""+i.key),i)c.call(i,R)&&!p.hasOwnProperty(R)&&($[R]=i[R]);var U=arguments.length-2;if(U===1)$.children=b;else if(1<U){for(var P=Array(U),M=0;M<U;M++)P[M]=arguments[M+2];$.children=P}if(n&&n.defaultProps)for(R in U=n.defaultProps,U)$[R]===void 0&&($[R]=U[R]);return{$$typeof:e,type:n,key:k,ref:j,props:$,_owner:u.current}}function w(n,i){return{$$typeof:e,type:n.type,key:i,ref:n.ref,props:n.props,_owner:n._owner}}function O(n){return typeof n=="object"&&n!==null&&n.$$typeof===e}function S(n){var i={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(b){return i[b]})}var D=/\/+/g;function Z(n,i){return typeof n=="object"&&n!==null&&n.key!=null?S(""+n.key):i.toString(36)}function V(n,i,b,R,$){var k=typeof n;(k==="undefined"||k==="boolean")&&(n=null);var j=!1;if(n===null)j=!0;else switch(k){case"string":case"number":j=!0;break;case"object":switch(n.$$typeof){case e:case t:j=!0}}if(j)return j=n,$=$(j),n=R===""?"."+Z(j,0):R,a($)?(b="",n!=null&&(b=n.replace(D,"$&/")+"/"),V($,i,b,"",function(M){return M})):$!=null&&(O($)&&($=w($,b+(!$.key||j&&j.key===$.key?"":(""+$.key).replace(D,"$&/")+"/")+n)),i.push($)),1;if(j=0,R=R===""?".":R+":",a(n))for(var U=0;U<n.length;U++){k=n[U];var P=R+Z(k,U);j+=V(k,i,b,P,$)}else if(P=_(n),typeof P=="function")for(n=P.call(n),U=0;!(k=n.next()).done;)k=k.value,P=R+Z(k,U++),j+=V(k,i,b,P,$);else if(k==="object")throw i=String(n),Error("Objects are not valid as a React child (found: "+(i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.");return j}function G(n,i,b){if(n==null)return n;var R=[],$=0;return V(n,R,"","",function(k){return i.call(b,k,$++)}),R}function B(n){if(n._status===-1){var i=n._result;i=i(),i.then(function(b){(n._status===0||n._status===-1)&&(n._status=1,n._result=b)},function(b){(n._status===0||n._status===-1)&&(n._status=2,n._result=b)}),n._status===-1&&(n._status=0,n._result=i)}if(n._status===1)return n._result.default;throw n._result}var E={current:null},W={transition:null},Je={ReactCurrentDispatcher:E,ReactCurrentBatchConfig:W,ReactCurrentOwner:u};function we(){throw Error("act(...) is not supported in production builds of React.")}return m.Children={map:G,forEach:function(n,i,b){G(n,function(){i.apply(this,arguments)},b)},count:function(n){var i=0;return G(n,function(){i++}),i},toArray:function(n){return G(n,function(i){return i})||[]},only:function(n){if(!O(n))throw Error("React.Children.only expected to receive a single React element child.");return n}},m.Component=q,m.Fragment=r,m.Profiler=l,m.PureComponent=J,m.StrictMode=s,m.Suspense=y,m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Je,m.act=we,m.cloneElement=function(n,i,b){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var R=C({},n.props),$=n.key,k=n.ref,j=n._owner;if(i!=null){if(i.ref!==void 0&&(k=i.ref,j=u.current),i.key!==void 0&&($=""+i.key),n.type&&n.type.defaultProps)var U=n.type.defaultProps;for(P in i)c.call(i,P)&&!p.hasOwnProperty(P)&&(R[P]=i[P]===void 0&&U!==void 0?U[P]:i[P])}var P=arguments.length-2;if(P===1)R.children=b;else if(1<P){U=Array(P);for(var M=0;M<P;M++)U[M]=arguments[M+2];R.children=U}return{$$typeof:e,type:n.type,key:$,ref:k,props:R,_owner:j}},m.createContext=function(n){return n={$$typeof:x,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:h,_context:n},n.Consumer=n},m.createElement=T,m.createFactory=function(n){var i=T.bind(null,n);return i.type=n,i},m.createRef=function(){return{current:null}},m.forwardRef=function(n){return{$$typeof:I,render:n}},m.isValidElement=O,m.lazy=function(n){return{$$typeof:g,_payload:{_status:-1,_result:n},_init:B}},m.memo=function(n,i){return{$$typeof:f,type:n,compare:i===void 0?null:i}},m.startTransition=function(n){var i=W.transition;W.transition={};try{n()}finally{W.transition=i}},m.unstable_act=we,m.useCallback=function(n,i){return E.current.useCallback(n,i)},m.useContext=function(n){return E.current.useContext(n)},m.useDebugValue=function(){},m.useDeferredValue=function(n){return E.current.useDeferredValue(n)},m.useEffect=function(n,i){return E.current.useEffect(n,i)},m.useId=function(){return E.current.useId()},m.useImperativeHandle=function(n,i,b){return E.current.useImperativeHandle(n,i,b)},m.useInsertionEffect=function(n,i){return E.current.useInsertionEffect(n,i)},m.useLayoutEffect=function(n,i){return E.current.useLayoutEffect(n,i)},m.useMemo=function(n,i){return E.current.useMemo(n,i)},m.useReducer=function(n,i,b){return E.current.useReducer(n,i,b)},m.useRef=function(n){return E.current.useRef(n)},m.useState=function(n){return E.current.useState(n)},m.useSyncExternalStore=function(n,i,b){return E.current.useSyncExternalStore(n,i,b)},m.useTransition=function(){return E.current.useTransition()},m.version="18.3.1",m}var de;function Re(){return de||(de=1,te.exports=$e()),te.exports}var Ce=Re();const K=ve(Ce),Oe=e=>e;function Pe(e,t=Oe){const r=K.useSyncExternalStore(e.subscribe,K.useCallback(()=>t(e.getState()),[e,t]),K.useCallback(()=>t(e.getInitialState()),[e,t]));return K.useDebugValue(r),r}const pe=e=>{const t=be(e),r=s=>Pe(t,s);return Object.assign(r,t),r},Ie=(e=>e?pe(e):pe);let ne=null;const Te=Ie((e,t)=>({loaded:!1,runChatId:!1,walkthroughRoots:!1,askPath:!1,chatIdOnLaunch:!1,deliverGate:!1,reducedAssurance:!1,launchPrimary:!1,chatList:!1,chatAttachments:!1,chatWorkflows:[],powerMode:!1,gateActions:!1,voice:!1,chatContext:!1,chatProposals:!1,chatArtifactsStub:!1,chatOnboard:!1,chatArtifactsStubOps:null,dataSources:!1,planGateNote:!1,chatJobProposals:!1,reshapeRun:!1,chatJobPower:!1,workflowCatalogV2:!1,trackerLinks:!1,load:()=>t().loaded?Promise.resolve():(ne??(ne=Promise.resolve().then(()=>Ee).then(({api:r})=>r.getHealth()).then(r=>{const s=r.capabilities??{};e({loaded:!0,runChatId:s.runChatId===!0,walkthroughRoots:s.walkthroughRoots===!0,askPath:s.askPath===!0,chatIdOnLaunch:s.chatIdOnLaunch===!0,deliverGate:s.deliverGate===!0,reducedAssurance:s.reducedAssurance===!0,launchPrimary:s.launchPrimary===!0,chatList:s.chatList===!0,chatAttachments:s.chatAttachments===!0,chatWorkflows:Array.isArray(s.chatWorkflows)?s.chatWorkflows.filter(l=>typeof l=="string"):[],powerMode:s.powerMode===!0,gateActions:s.gateActions===!0,voice:s.voice===!0,chatContext:s.chatArtifacts?.context===!0,chatProposals:s.chatArtifacts?.proposals===!0,chatArtifactsStub:s.chatArtifacts?.stub===!0,chatOnboard:s.chatArtifacts?.onboard===!0,chatArtifactsStubOps:ke(s.chatArtifacts),dataSources:s.apps?.uploads===!0,trackerLinks:s.trackerLinks===!0,planGateNote:s.planGateNote===!0,chatJobProposals:s.chatJobProposals===!0,reshapeRun:s.reshapeRun===!0,chatJobPower:s.chatJobPower===!0,workflowCatalogV2:s.workflowCatalogV2===!0})}).catch(()=>{e({loaded:!0,runChatId:!1,walkthroughRoots:!1,askPath:!1,chatIdOnLaunch:!1,deliverGate:!1,reducedAssurance:!1,launchPrimary:!1,chatList:!1,chatAttachments:!1,chatWorkflows:[],powerMode:!1,voice:!1,chatContext:!1,chatProposals:!1,chatArtifactsStub:!1,chatOnboard:!1,chatArtifactsStubOps:null,dataSources:!1,trackerLinks:!1,planGateNote:!1,chatJobProposals:!1,reshapeRun:!1,chatJobPower:!1,workflowCatalogV2:!1})}).finally(()=>{ne=null})),ne)}));function ke(e){const t=e?.stubOps;return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}const Ue={};function fe(){const e=Te.getState(),t=[...e.chatJobProposals?["job"]:[],...e.chatOnboard?["onboard"]:[]];return t.length>0?{accepts:t}:{}}function _e(){const e=Ue?.VITE_API_HOST;return typeof e=="string"&&e.length>0?e:void 0}function me(){const e=_e();return e?`http://${e}/api/v1`:`${window.location.origin}/api/v1`}const he=48*1024,oe="/workflows/catalog";async function o(e,t){const r=t?.body!==void 0&&t?.body!==null&&!(typeof FormData<"u"&&t.body instanceof FormData)?{"Content-Type":"application/json",...t?.headers}:{...t?.headers},s=await fetch(`${me()}${e}`,{...t,headers:r});if(!s.ok){const l=await s.text();let h,x;try{const I=JSON.parse(l);x=I;const y=I.error??I.message??l;h=typeof y=="string"?y:JSON.stringify(y)}catch{h=l}throw h||(h=s.statusText),new ee(s.status,h,x)}if(s.status!==204)return s.json()}const Ee=Object.freeze(Object.defineProperty({__proto__:null,ApiError:ee,KEEPALIVE_MAX_BYTES:he,WORKFLOW_CATALOG_PATH:oe,api:{search:(e,t={})=>{const r=new URLSearchParams({q:e});return t.types!==void 0&&t.types.length>0&&r.set("types",t.types.join(",")),t.limit!==void 0&&r.set("limit",String(t.limit)),t.cursor!==void 0&&t.cursor!==null&&r.set("cursor",t.cursor),o(`/search?${r.toString()}`,t.signal!==void 0?{signal:t.signal}:void 0)},listRuns:e=>o(e?"/runs?include=archived":"/runs"),listRunsForDoc:e=>o(`/runs?doc=${encodeURIComponent(e)}`),archiveRun:(e,t,r)=>o(`/runs/${encodeURIComponent(e)}/archive`,{method:"POST",body:JSON.stringify(r===void 0?{archived:t}:{archived:t,note:r})}),resolveRun:(e,t)=>o(`/runs/${encodeURIComponent(e)}/resolve`,{method:"POST",body:JSON.stringify(t)}),getRun:e=>o(`/runs/${encodeURIComponent(e)}`),getAudit:e=>o(`/audit?runId=${encodeURIComponent(e)}`),getAuditByAction:(e,t)=>o(`/audit?action=${encodeURIComponent(e)}${t!==void 0?`&limit=${Math.max(1,Math.floor(t))}`:""}`),getAuditSince:(e,t=200)=>o(`/audit?since=${Math.max(0,Math.floor(e))}&limit=${t}`),getRunEvents:(e,t)=>o(`/runs/${encodeURIComponent(e)}/events${t!==void 0&&t.length>0?`?type=${t.map(encodeURIComponent).join(",")}`:""}`),getRunAcceptance:e=>o(`/runs/${encodeURIComponent(e)}/acceptance`),getRunInventory:e=>o(`/runs/${encodeURIComponent(e)}/inventory`),launchRun:e=>o("/runs",{method:"POST",body:JSON.stringify(e)}),previewLaunchPosture:e=>o("/runs/preview",{method:"POST",body:JSON.stringify(e)}),previewLinkedIssues:e=>o("/linked-issues/preview",{method:"POST",body:JSON.stringify(e)}),deliverRun:e=>o(`/runs/${encodeURIComponent(e)}/deliver`,{method:"POST"}),runPullRequest:e=>o(`/runs/${encodeURIComponent(e)}/pr`),redeliverRun:e=>o(`/runs/${encodeURIComponent(e)}/redeliver`,{method:"POST"}),confirmGate:(e,t)=>{const r=JSON.stringify(t);return o(`/runs/${encodeURIComponent(e)}/gate`,{method:"POST",body:r,...new TextEncoder().encode(r).length<=he?{keepalive:!0}:{}})},cancelRun:(e,t)=>o(`/runs/${encodeURIComponent(e)}/cancel`,t!==void 0&&(t.reason!==void 0||t.input!==void 0)?{method:"POST",body:JSON.stringify(t)}:{method:"POST"}),putGuidance:(e,t)=>o(`/runs/${encodeURIComponent(e)}/guidance`,{method:"PUT",body:JSON.stringify({text:t})}),resumeRun:e=>o(`/runs/${encodeURIComponent(e)}/resume`,{method:"POST"}),openChat:e=>o("/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,...fe()})}),sendChatMessage:(e,t,r,s,l)=>o(`/chats/${encodeURIComponent(e)}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,...r!==void 0?{targets:r}:{},...s!==void 0&&s.length>0?{attachments:s}:{},...l!==void 0&&Object.keys(l).length>0?{context:l}:{},...fe()})}),reseatChat:(e,t)=>o(`/chats/${encodeURIComponent(e)}/seats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clis:t})}),closeChat:e=>o(`/chats/${encodeURIComponent(e)}`,{method:"DELETE"}),getChat:e=>o(`/chats/${encodeURIComponent(e)}`),listChats:()=>o("/chats"),listChatHistory:(e={})=>{const t=new URLSearchParams({limit:String(e.limit??20),status:e.status??"all"});return e.cursor!==void 0&&e.cursor!==null&&e.cursor!==""&&t.set("cursor",e.cursor),o(`/chats?${t.toString()}`)},getChatMessages:e=>o(`/chats/${encodeURIComponent(e)}/messages`),decideChatProposal:(e,t,r)=>o(`/chats/${encodeURIComponent(e)}/proposals/${encodeURIComponent(t)}`,{method:"POST",body:JSON.stringify(r)}),proposeInChat:(e,t)=>o(`/chats/${encodeURIComponent(e)}/proposals`,{method:"POST",body:JSON.stringify(t)}),reviseChatProposal:(e,t)=>o(`/chats/${encodeURIComponent(e)}/proposals`,{method:"POST",body:JSON.stringify(t)}),reshapeRun:(e,t)=>o(`/runs/${encodeURIComponent(e)}/reshape`,{method:"POST",body:JSON.stringify(t)}),endChat:e=>o(`/chats/${encodeURIComponent(e)}/close`,{method:"POST"}),uploadChatAttachments:(e,t)=>{const r=new FormData;for(const s of t)r.append("file",s,s.name);return o(`/chats/${encodeURIComponent(e)}/attachments`,{method:"POST",body:r})},getUnitOutput:(e,t)=>o(`/runs/${encodeURIComponent(e)}/units/${encodeURIComponent(t)}/output`),getGate:(e,t)=>o(`/runs/${encodeURIComponent(e)}/gate`,t!==void 0?{signal:t}:void 0),getElicitation:async e=>{try{return await o(`/runs/${encodeURIComponent(e)}/elicitation`)}catch(t){if(ce(t)===404)return null;throw t}},respondToElicitation:(e,t)=>o(`/runs/${encodeURIComponent(e)}/elicitation`,{method:"POST",body:JSON.stringify(t)}),getRoster:e=>o(e===void 0?"/roster":`/roster?refresh=${encodeURIComponent(e)}`),getWatch:(e={})=>{const t=new URLSearchParams;for(const[s,l]of Object.entries(e))l!==void 0&&l!==""&&t.set(s,String(l));const r=t.toString();return o(`/watch${r===""?"":`?${r}`}`)},getSeatRecord:(e=7,t)=>o(`/roster/record?days=${e}${t!==void 0?`&project=${encodeURIComponent(t)}`:""}`),listRepos:()=>o("/repos"),registerRepo:(e,t,r)=>o("/repos",{method:"POST",body:JSON.stringify({name:e,rootPath:t,...r!==void 0?{projectId:r}:{}})}),cloneAndRegisterRepo:(e,t,r,s)=>o("/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,...r?{rootPath:r}:{},...s!==void 0?{projectId:s}:{}})}),getOnboardRun:e=>o(`/repos/${encodeURIComponent(e)}/onboard`),rerunOnboarding:e=>o(`/repos/${encodeURIComponent(e)}/onboard`,{method:"POST"}),getHealth:()=>o("/health"),openTerminal:e=>o("/terminals",{method:"POST",body:JSON.stringify(e)}),seatLogout:(e,t)=>o(`/seats/${encodeURIComponent(e)}/logout`,{method:"POST",body:JSON.stringify(t)}),seatContainerLogin:(e,t)=>o(`/seats/${encodeURIComponent(e)}/container-login`,{method:"POST",body:JSON.stringify(t)}),closeSeatContainerLogin:e=>o(`/seats/${encodeURIComponent(e)}/container-login`,{method:"DELETE"}),seatContainerLoginOutcome:(e,t)=>o(`/seats/${encodeURIComponent(e)}/container-login`,t===void 0?void 0:{signal:t}),seatContainerLogout:e=>o(`/seats/${encodeURIComponent(e)}/container-logout`,{method:"POST"}),resizeTerminal:(e,t,r)=>o(`/terminals/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify({cols:t,rows:r})}),closeTerminal:e=>o(`/terminals/${encodeURIComponent(e)}/close`,{method:"POST"}),openPath:(e,t)=>o("/open",{method:"POST",body:JSON.stringify(t===void 0?{path:e}:{path:e,runId:t})}),getRunFile:(e,t)=>o(`/runs/${encodeURIComponent(e)}/files?path=${encodeURIComponent(t)}`),getRunDiff:(e,t,r)=>{const s=new URLSearchParams;t!==void 0&&s.set("path",t),r!==void 0&&s.set("base",r);const l=s.toString();return o(`/runs/${encodeURIComponent(e)}/diff${l===""?"":`?${l}`}`)},inspectUnit:(e,t)=>o(`/runs/${encodeURIComponent(e)}/units/${t}/inspect`,{method:"POST",body:"{}"}),getInspections:(e,t)=>o(`/runs/${encodeURIComponent(e)}/units/${t}/inspections`),injectMessage:(e,t,r,s)=>o(`/runs/${encodeURIComponent(e)}/inject`,{method:"POST",body:JSON.stringify(s?.input!==void 0?{message:t,target:r,input:s.input}:{message:t,target:r})}),listWorkflows:()=>o("/workflows"),getWorkflowCatalog:e=>o(e!=null&&e!==""?`${oe}?projectId=${encodeURIComponent(e)}`:oe).catch(t=>{if(t instanceof SyntaxError)return null;throw t}),getWorkflow:e=>o(`/workflows/${encodeURIComponent(e)}`),saveScript:(e,t,r)=>o("/scripts",{method:"POST",body:JSON.stringify({name:e,content:t,lang:r})}),listRequirements:(e,t,r={})=>{const s=new URLSearchParams;return t.q&&s.set("q",t.q),t.mismatch&&s.set("mismatch",t.mismatch),t.risk&&s.set("risk",t.risk),t.category&&s.set("category",t.category),t.domain&&s.set("domain",t.domain),s.set("offset",String(t.offset??0)),s.set("limit",String(t.limit??50)),o(`/repos/${encodeURIComponent(e)}/requirements?${s.toString()}`,r.signal!==void 0?{signal:r.signal}:void 0)},setRequirementsMinimum:(e,t)=>o(`/repos/${encodeURIComponent(e)}/requirements/minimum`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({minPct:t})}),getRequirement:(e,t)=>o(`/repos/${encodeURIComponent(e)}/requirements/${encodeURIComponent(t)}`),patchRequirement:(e,t,r)=>o(`/repos/${encodeURIComponent(e)}/requirements/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),getDomainGraph:()=>o("/domain-graph"),getRepoGraph:(e,t)=>{const r=new URLSearchParams;t?.focus&&r.set("focus",t.focus),t?.limit&&r.set("limit",String(t.limit));const s=r.size>0?`?${r.toString()}`:"";return o(`/repos/${encodeURIComponent(e)}/graph${s}`)},getBlastRadius:(e,t)=>o(`/repos/${encodeURIComponent(e)}/graph/blast-radius?name=${encodeURIComponent(t)}`),getRepoGitHistory:(e,t)=>o(`/repos/${encodeURIComponent(e)}/git-history${t===void 0?"":`?limit=${t}`}`),getDeliverTarget:async e=>{try{return await o(`/repos/${encodeURIComponent(e)}/deliver-target`)}catch{return null}},getRepoContributors:e=>o(`/repos/${encodeURIComponent(e)}/contributors`),getRepoDomainGraph:e=>o(`/repos/${encodeURIComponent(e)}/domain-graph`),listPolicies:()=>o("/governance/policies"),listConformanceRules:()=>o("/governance/rules"),getCoverageReport:()=>o("/governance/coverage"),getCoverageReportForRepo:e=>o(`/governance/coverage?repo=${encodeURIComponent(e)}`),getGraphKindsForRepo:(e,t={})=>o(`/governance/graph?repo=${encodeURIComponent(e)}`,t.signal!==void 0?{signal:t.signal}:void 0),listClaims:()=>o("/governance/claims"),upsertPolicy:e=>o("/governance/policies",{method:"POST",body:JSON.stringify(e)}),upsertConformanceRule:e=>o("/governance/rules",{method:"POST",body:JSON.stringify(e)}),retirePolicy:e=>o(`/governance/policies/${encodeURIComponent(e)}`,{method:"DELETE"}),retireConformanceRule:e=>o(`/governance/rules/${encodeURIComponent(e)}`,{method:"DELETE"}),recallRulesPreview:e=>{const t=new URLSearchParams;for(const[l,h]of Object.entries(e))h&&t.set(l,h);const r=t.toString(),s=r?`?${r}`:"";return o(`/governance/rules/preview${s}`)},getSettings:()=>o("/settings"),updateSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify(e)}),getAppearanceSettings:()=>o("/settings"),putAppearanceSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.appearance":e})}),putNotifSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.notifications":e})}),putComposerSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.composer":e})}),putSetupSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.setup":e})}),putViewSettings:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.view":e})}),putReportShown:e=>o("/settings",{method:"PUT",body:JSON.stringify({"studio.report":{shown:e}})}),listApps:()=>o("/apps"),listProjects:e=>{const t=e?`?status=${e}`:"";return o(`/projects${t}`)},getProject:e=>o(`/projects/${encodeURIComponent(e)}`),createProject:e=>o("/projects",{method:"POST",body:JSON.stringify(e)}),updateProject:(e,t)=>o(`/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}),listProjectMembers:e=>o(`/projects/${encodeURIComponent(e)}/members`),listProjectPrompts:e=>o(`/projects/${encodeURIComponent(e)}/prompts`),attachProjectMember:(e,t)=>o(`/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(t)}),detachProjectMember:(e,t)=>o(`/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:"DELETE"}),getProjectActivity:(e,t)=>{const r=t?`?cursor=${encodeURIComponent(t)}`:"";return o(`/projects/${encodeURIComponent(e)}/activity${r}`)},reassignRun:(e,t,r,s)=>o(`/runs/${encodeURIComponent(e)}/reassign`,{method:"POST",body:JSON.stringify({...t===void 0?{}:{cli:t},...r?.trim()?{note:r.trim()}:{},...s===void 0?{}:{ord:s}})}),getProjectGraph:e=>o(`/projects/${encodeURIComponent(e)}/graph`),refreshProjectGraph:(e,t)=>o(`/projects/${encodeURIComponent(e)}/graph/refresh`,{method:"POST",body:JSON.stringify(t??{})})},apiBase:me,apiFetch:o,apiStatus:ce,translateWireError:ae},Symbol.toStringTag,{value:"Module"})),Y=e=>e==null?"null":typeof e=="string"?e:JSON.stringify(e);function je(e,t){switch(e.type){case"number":return Math.round((t+1)*13.7*10)/10;case"integer":return(t+1)*7;case"boolean":return t%2===0;case"date":return`2026-10-${String(10+t).padStart(2,"0")}`;case"datetime":return`2026-10-${String(10+t).padStart(2,"0")}T09:30:00Z`;default:return`${e.name.replace(/_/g," ")} ${t+1}`}}function Ne(e,t){const r=Object.assign(Object.create(null),structuredClone(t?.rows??{})),s=null,l="you",h=new Map;let x=0;const I=(y,f)=>y.kind==="param"?{value:f[y.name]??null,from:"from the app"}:y.kind==="literal"?{value:y.value,from:"fixed by the app"}:y.kind==="viewer"?{value:y.claim==="name"?l.split("@")[0]:l,from:"your sign-in"}:{value:y.value==="now"?new Date().toISOString():"a new uuid",from:`filled by studio: ${y.value}`};return{kind:{queries:"sample",actions:"sample"},async query(y,f,g){const d=e().queries.find(C=>C.id===f);if(d===void 0)return{error:"refused",message:`this version has no query ${f}`};Object.hasOwn(r,f)||(r[f]=[0,1,2].map(C=>d.output.map(L=>je(L,C))));let _=r[f];const N=Object.values(g).filter(C=>typeof C=="string"&&C.trim()!==""&&C!=="all");return N.length>0&&(_=_.filter(C=>N.every(L=>C.some(q=>typeof q=="string"&&q.toLowerCase().includes(L.toLowerCase()))))),{columns:d.output,rows:structuredClone(_),truncated:!1,hasMore:!1,ms:1,cachedAt:null,sample:!0}},async prepare(y,f,g){const d=e().actions.find(v=>v.id===f);if(d===void 0)return{error:"refused",message:`this version has no action ${f}`};const _=[];let N,C,L=null,q=null;if(d.kind==="row-write"){const v=Object.entries(d.set??{});for(const[u,p]of v){const T=I(p,g);_.push({label:u,value:Y(T.value),from:T.from})}L=`${Object.entries(d.key).map(([u,p])=>`${u} = ${Y(g[p.name])}`).join(", ")} (exactly 1 row)`,q="Sample: no table was checked. A real run checks a plain table (no triggers, rules, inheritance or row security) just before it writes.",N=`${d.op.toUpperCase()} ${d.table}`;const c=v.length;C=d.op==="update"?`UPDATE ONLY ${d.table} AS w SET ${v.map(([u],p)=>`${u} = $${p+1}`).join(", ")} WHERE ${Object.keys(d.key).map((u,p)=>`w.${u} = $${c+p+1}`).join(" AND ")}`:d.op==="delete"?`DELETE FROM ONLY ${d.table} AS w WHERE ${Object.keys(d.key).map((u,p)=>`w.${u} = $${p+1}`).join(" AND ")}`:`INSERT INTO ${d.table} (${v.map(([u])=>u).join(", ")}) VALUES (${v.map((u,p)=>`$${p+1}`).join(", ")})`}else{for(const[v,a]of Object.entries(d.args)){const c=I(a,g);_.push({label:v,value:Y(c.value),from:c.from})}N=d.call.kind==="tool"?d.call.tool:`mutation ${d.call.mutation.slice(0,60)}`,C=`${N}
10
- ${JSON.stringify(Object.fromEntries(_.map(v=>[v.label,v.value])),null,1)}`}x+=1;const A=`sample-${x}`,J=Date.now()+12e4;return h.set(A,{action:d,params:g,expiresAt:J}),{record:A,expiresAt:J,card:{action:d.id,kind:d.kind,source:`${d.source} (sample)`,operation:N,rows:_,key:L,checks:q,request:C,says:d.description??null,sample:!0}}},async run(y,f){const g=h.get(f);if(h.delete(f),g===void 0||g.action.id!==y)return{state:"failed",reason:"this card was not prepared here",sample:!0};if(Date.now()>g.expiresAt)return{state:"failed",reason:"the card expired; nothing was written",sample:!0};if(g.action.kind==="row-write"&&g.action.op==="update"){const _=g.action;for(const N of e().queries){const C=N.output.map(A=>A.name),L=Object.entries(_.key),q=Object.hasOwn(r,N.id)?r[N.id]:void 0;if(!(q===void 0||!L.every(([A])=>C.includes(A)))){for(const A of q)if(L.every(([J,v])=>Y(A[C.indexOf(J)])===Y(g.params[v.name])))for(const[J,v]of Object.entries(_.set??{}))C.includes(J)&&(A[C.indexOf(J)]=I(v,g.params).value)}}}return{state:"succeeded",reason:g.action.kind==="row-write"&&g.action.op==="update"?"Sample data: the sample rows in this tab changed; no source was touched":"Sample data: nothing was written and no rows changed",sample:!0}},viewer:()=>({email:s,sample:!0})}}const re="wicked.editor",se=1,Ae=/^[A-Z]{3}$/u;function xe(e,t,r){if(e==null)return"";if(typeof e=="boolean")return e?"yes":"no";const s=void 0,l=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&Number.isFinite(Number(e))?Number(e):null;try{switch(t?.kind){case"currency":if(l===null||!Ae.test(t.currency))break;return new Intl.NumberFormat(r,{style:"currency",currency:t.currency,...s!==void 0?{minimumFractionDigits:s,maximumFractionDigits:s}:{}}).format(l);case"percent":if(l===null)break;return new Intl.NumberFormat(r,{style:"percent",maximumFractionDigits:s??1}).format(l);case"number":if(l===null)break;return new Intl.NumberFormat(r,s!==void 0?{minimumFractionDigits:s,maximumFractionDigits:s}:{}).format(l);case"date":case"datetime":{const h=new Date(typeof e=="number"?e:String(e));if(Number.isNaN(h.getTime()))break;return new Intl.DateTimeFormat(r,t.kind==="date"?{dateStyle:"medium",timeZone:"UTC"}:{dateStyle:"medium",timeStyle:"short"}).format(h)}case"duration":{if(l===null)break;const h=Math.abs(Math.round(l)),x=Math.floor(h/86400),I=Math.floor(h%86400/3600),y=Math.floor(h%3600/60);return x>0?`${x}d ${I}h`:I>0?`${I}h ${y}m`:`${y}m`}default:break}}catch{}return typeof e=="number"?Number.isInteger(e)?String(e):new Intl.NumberFormat(r,{maximumFractionDigits:6}).format(e):String(e)}function qe(e,t){if(e===void 0||t===null||t===void 0)return t;if((e.type==="number"||e.type==="integer")&&typeof t=="string"&&t.trim()!==""){const r=Number(t);return Number.isFinite(r)&&(e.type==="number"||Number.isInteger(r))?r:t}return e.type==="boolean"&&typeof t=="string"&&(t==="true"||t==="false")?t==="true":e.type==="string"&&(typeof t=="number"||typeof t=="boolean")?String(t):t}const X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ge=()=>new Promise(e=>requestAnimationFrame(()=>e()));async function ye(e,t,r){const s=Object.entries(r).sort(([f],[g])=>f.localeCompare(g)),l=JSON.stringify([t,s]);let h=0;for(const f of l)h=Math.imul(h,31)+f.charCodeAt(0)>>>0;const x=e.queries.find(f=>f.id===t),I=s.map(([,f])=>f).filter(f=>typeof f=="string").join(" "),y=[0,1,2].map(f=>(x?.output??[]).map(g=>{const d=h%1e3+f+1;switch(g.type){case"number":return d/10;case"integer":return d;case"boolean":return d%2===0;case"date":return`2026-10-${String(10+f).padStart(2,"0")}`;case"datetime":return`2026-10-${String(10+f).padStart(2,"0")}T09:30:00Z`;default:return`${I} ${g.name} ${d}`.trim()}}));return Ne(()=>e,{rows:{[t]:y}}).query(1,t,r)}async function Le(){const e=Date.parse("2026-10-15T12:00:00Z");window.Date=new Proxy(Date,{construct:(a,c)=>Reflect.construct(a,c.length===0?[e]:c),apply:a=>new a(e).toString(),get:(a,c,u)=>c==="now"?()=>e:Reflect.get(a,c,u)});let t;const r=new Map,s=new Map;let l,h=0,x=0,I=0,y=null;const f=new Map,g=a=>{const c=a instanceof Error?a.message:String(a);v.errors.includes(c)||v.errors.push(c)},d=async a=>{try{await a()}catch(c){throw g(c),c}},_=a=>{const c=t.spec.pages.find(u=>u.id===a);if(c===void 0)throw new Error(`This app has no page ${a}`);return c},N=a=>{const c=[...document.querySelectorAll("[data-component]")].find(u=>u.dataset.component===a);if(c===void 0)throw new Error(`This page has no filter ${a}`);return c},C=a=>a.filter==="search"?["fixture"]:a.filter==="date-range"?["2026-10-01/2026-10-31"]:a.options?.kind==="values"?a.options.values.map(c=>c.value):[...s.get(a.id)??[]],L=async()=>{for(const a of t.spec.pages)for(const c of a.components){if(c.type!=="filter"||c.options?.kind!=="query")continue;const u=c.options,p=t.spec.queries.find(S=>S.id===u.query.query),T={};for(const[S,D]of Object.entries(u.query.params??{})){const[Z,V,G]=D.split("."),B=Z==="filter"&&V!==void 0?r.get(V):void 0,E=typeof B=="string"?G===void 0?B:void 0:G==="from"?B?.from:G==="to"?B?.to:void 0,W=p?.params?.properties??{};E!==void 0&&E!==""&&(T[S]=qe(Object.hasOwn(W,S)?W[S]:void 0,E))}const w=await ye(t.spec,u.query.query,T);if("error"in w)throw new Error(w.message);const O=w.columns.findIndex(S=>S.name===u.value);s.set(c.id,w.rows.slice(0,200).map(S=>xe(S[O],void 0,"en")).filter(S=>S!==""))}},q=()=>new Promise((a,c)=>{const u=`fixture-${++I}`,p=setTimeout(()=>{f.delete(u),c(new Error("The runtime did not answer"))},5e3);f.set(u,()=>{clearTimeout(p),a()}),l.postMessage({p:re,v:se,type:"host.ping",id:u,payload:{}})}),A=async()=>{const a=performance.now()+5e3;let c=0;for(;c<2;){const u=h;if(await q(),await ge(),await ge(),c=x===0&&u===h?c+1:0,performance.now()>a)throw new Error("The fixture did not finish rendering")}for(const u of document.querySelectorAll(".wk-error"))u.textContent&&g(u.textContent)},J=a=>{if(!t.spec.actions.some(O=>O.id===a))throw new Error(`This app has no action ${a}`);const c=Array.isArray(t.cards)?t.cards.find(O=>O.action===a):Object.hasOwn(t.cards,a)?t.cards[a]:void 0;if(c===void 0)throw new Error(`The fixture has no card for ${a}`);y?.remove(),y=document.createElement("div"),y.className="wk-fixture-card";const u=document.createElement("section");u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-label",`Prepare ${a}`),u.setAttribute("data-testid","apps-card");const p=document.createElement("h2");p.textContent=`Prepare ${a}`;const T=document.createElement("pre");T.textContent=typeof c=="string"?c:JSON.stringify(c,null,2);const w=document.createElement("button");w.type="button",w.textContent="Close",w.addEventListener("click",()=>{v.closeCard()}),u.append(p,T,w),y.append(u),document.body.append(y),w.focus()},v={ready:!1,errors:[],pages:()=>t.spec.pages.map(a=>a.id),filters:a=>_(a).components.filter(c=>c.type==="filter").map(c=>({id:c.id,values:C(c)})),actions:a=>[...new Set(_(a).components.flatMap(c=>c.type==="button"?[c.action.action]:c.type==="form"?[c.submit.action]:c.type==="table"?(c.rowActions??[]).map(u=>u.action):[]))],show:a=>d(async()=>{const c=t.spec.pages.indexOf(_(a)),u=document.querySelectorAll(".wk-page")[c];if(u===void 0)throw new Error(`The runtime did not draw page ${a}`);u.click(),await A()}),setFilter:(a,c)=>d(async()=>{const u=t.spec.pages.find(w=>w.components.some(O=>O.id===a&&O.type==="filter"));if(u===void 0)throw new Error(`This app has no filter ${a}`);await v.show(u.id);const p=N(a),T=p.querySelector("select");if(T!==null){if(![...T.options].some(w=>w.value===c))throw new Error(`This filter has no value ${c}`);T.value=c,r.set(a,c),T.dispatchEvent(new Event("change",{bubbles:!0}))}else{const w=[...p.querySelectorAll("input")],O=w.length===2?c.split("/"):[c];if(w.length===0||O.length!==w.length)throw new Error("A date range needs from/to");for(const[S,D]of w.entries())D.value=O[S],D.dispatchEvent(new Event(D.type==="search"?"input":"change",{bubbles:!0}));r.set(a,w.length===2?{from:w[0].value,to:w[1].value}:w[0].value),w[0]?.type==="search"&&await new Promise(S=>setTimeout(S,310))}await L(),await A()}),prepare:a=>d(async()=>{J(a),await A()}),closeCard:()=>d(async()=>{y?.remove(),y=null,await A()})};window.__wkFixture=v,window.addEventListener("error",a=>g(a.message)),window.addEventListener("unhandledrejection",a=>g(a.reason));try{const a=await fetch("./fixture.json",{credentials:"omit",redirect:"error"});if(!a.ok)throw new Error("The fixture could not be read");t=await a.json();for(const u of t.spec.pages)for(const p of u.components)if(p.type==="filter")if(p.filter==="date-range"){const T=X(p.default)&&Number.isInteger(p.default.lastDays)?Math.min(3650,Math.max(1,p.default.lastDays)):30;r.set(p.id,{from:new Date(e-T*864e5).toISOString().slice(0,10),to:new Date(e).toISOString().slice(0,10)})}else r.set(p.id,typeof p.default=="string"?p.default:"");await L();const c=new MessageChannel;if(l=c.port1,l.onmessage=u=>{const p=u.data;if(!X(p)||p.p!==re||p.v!==se)return;if(typeof p.re=="string"){f.get(p.re)?.(),f.delete(p.re);return}if(typeof p.id!="string")return;const T=p.id,w=X(p.payload)?p.payload:{},O=(S,D)=>{l.postMessage({p:re,v:se,re:T,ok:D===void 0,payload:S,...D===void 0?{}:{error:D}})};switch(h+=1,p.type){case"artifact.read":O({version:1,content:{type:"app",spec:t.spec,readonly:!0}});return;case"data.query":{x+=1,ye(t.spec,String(w.query),X(w.params)?w.params:{}).then(S=>{"error"in S?(g(S.message),O({},{code:S.error,message:S.message})):O(S)}).catch(S=>{g(S),O({},{code:"unavailable",message:"The fixture query failed"})}).finally(()=>{x-=1,h+=1});return}case"data.action":try{J(String(w.action)),O({state:"cancelled"})}catch(S){g(S),O({},{code:"refused",message:String(S)})}return;default:O({},{code:"unsupported",message:"The fixture only reads and prepares"});return}},window.wickedAppsStandalone.boot(c.port2,{protocol:2,surface:"full",size:"full",grants:["artifact.read","data.read","data.write"],app:{framed:!1,mode:"preview",url:{}},prefs:{locale:"en"},theme:{}}),await A(),document.querySelector(".wk-page")===null)throw new Error("The runtime did not draw a page");v.ready=v.errors.length===0}catch(a){g(a)}}Le()})();
9
+ */var le;function Oe(){if(le)return m;le=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),x=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),d=Symbol.iterator;function U(n){return n===null||typeof n!="object"?null:(n=d&&n[d]||n["@@iterator"],typeof n=="function"?n:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,L={};function q(n,i,b){this.props=n,this.context=i,this.refs=L,this.updater=b||A}q.prototype.isReactComponent={},q.prototype.setState=function(n,i){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,i,"setState")},q.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function N(){}N.prototype=q.prototype;function J(n,i,b){this.props=n,this.context=i,this.refs=L,this.updater=b||A}var v=J.prototype=new N;v.constructor=J,C(v,q.prototype),v.isPureReactComponent=!0;var a=Array.isArray,c=Object.prototype.hasOwnProperty,l={current:null},f={key:!0,ref:!0,__self:!0,__source:!0};function k(n,i,b){var R,$={},T=null,j=null;if(i!=null)for(R in i.ref!==void 0&&(j=i.ref),i.key!==void 0&&(T=""+i.key),i)c.call(i,R)&&!f.hasOwnProperty(R)&&($[R]=i[R]);var _=arguments.length-2;if(_===1)$.children=b;else if(1<_){for(var I=Array(_),M=0;M<_;M++)I[M]=arguments[M+2];$.children=I}if(n&&n.defaultProps)for(R in _=n.defaultProps,_)$[R]===void 0&&($[R]=_[R]);return{$$typeof:e,type:n,key:T,ref:j,props:$,_owner:l.current}}function w(n,i){return{$$typeof:e,type:n.type,key:i,ref:n.ref,props:n.props,_owner:n._owner}}function O(n){return typeof n=="object"&&n!==null&&n.$$typeof===e}function S(n){var i={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(b){return i[b]})}var D=/\/+/g;function Z(n,i){return typeof n=="object"&&n!==null&&n.key!=null?S(""+n.key):i.toString(36)}function H(n,i,b,R,$){var T=typeof n;(T==="undefined"||T==="boolean")&&(n=null);var j=!1;if(n===null)j=!0;else switch(T){case"string":case"number":j=!0;break;case"object":switch(n.$$typeof){case e:case t:j=!0}}if(j)return j=n,$=$(j),n=R===""?"."+Z(j,0):R,a($)?(b="",n!=null&&(b=n.replace(D,"$&/")+"/"),H($,i,b,"",function(M){return M})):$!=null&&(O($)&&($=w($,b+(!$.key||j&&j.key===$.key?"":(""+$.key).replace(D,"$&/")+"/")+n)),i.push($)),1;if(j=0,R=R===""?".":R+":",a(n))for(var _=0;_<n.length;_++){T=n[_];var I=R+Z(T,_);j+=H(T,i,b,I,$)}else if(I=U(n),typeof I=="function")for(n=I.call(n),_=0;!(T=n.next()).done;)T=T.value,I=R+Z(T,_++),j+=H(T,i,b,I,$);else if(T==="object")throw i=String(n),Error("Objects are not valid as a React child (found: "+(i==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":i)+"). If you meant to render a collection of children, use an array instead.");return j}function G(n,i,b){if(n==null)return n;var R=[],$=0;return H(n,R,"","",function(T){return i.call(b,T,$++)}),R}function B(n){if(n._status===-1){var i=n._result;i=i(),i.then(function(b){(n._status===0||n._status===-1)&&(n._status=1,n._result=b)},function(b){(n._status===0||n._status===-1)&&(n._status=2,n._result=b)}),n._status===-1&&(n._status=0,n._result=i)}if(n._status===1)return n._result.default;throw n._result}var E={current:null},W={transition:null},Ge={ReactCurrentDispatcher:E,ReactCurrentBatchConfig:W,ReactCurrentOwner:l};function be(){throw Error("act(...) is not supported in production builds of React.")}return m.Children={map:G,forEach:function(n,i,b){G(n,function(){i.apply(this,arguments)},b)},count:function(n){var i=0;return G(n,function(){i++}),i},toArray:function(n){return G(n,function(i){return i})||[]},only:function(n){if(!O(n))throw Error("React.Children.only expected to receive a single React element child.");return n}},m.Component=q,m.Fragment=o,m.Profiler=u,m.PureComponent=J,m.StrictMode=s,m.Suspense=y,m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ge,m.act=be,m.cloneElement=function(n,i,b){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var R=C({},n.props),$=n.key,T=n.ref,j=n._owner;if(i!=null){if(i.ref!==void 0&&(T=i.ref,j=l.current),i.key!==void 0&&($=""+i.key),n.type&&n.type.defaultProps)var _=n.type.defaultProps;for(I in i)c.call(i,I)&&!f.hasOwnProperty(I)&&(R[I]=i[I]===void 0&&_!==void 0?_[I]:i[I])}var I=arguments.length-2;if(I===1)R.children=b;else if(1<I){_=Array(I);for(var M=0;M<I;M++)_[M]=arguments[M+2];R.children=_}return{$$typeof:e,type:n.type,key:$,ref:T,props:R,_owner:j}},m.createContext=function(n){return n={$$typeof:x,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:h,_context:n},n.Consumer=n},m.createElement=k,m.createFactory=function(n){var i=k.bind(null,n);return i.type=n,i},m.createRef=function(){return{current:null}},m.forwardRef=function(n){return{$$typeof:P,render:n}},m.isValidElement=O,m.lazy=function(n){return{$$typeof:g,_payload:{_status:-1,_result:n},_init:B}},m.memo=function(n,i){return{$$typeof:p,type:n,compare:i===void 0?null:i}},m.startTransition=function(n){var i=W.transition;W.transition={};try{n()}finally{W.transition=i}},m.unstable_act=be,m.useCallback=function(n,i){return E.current.useCallback(n,i)},m.useContext=function(n){return E.current.useContext(n)},m.useDebugValue=function(){},m.useDeferredValue=function(n){return E.current.useDeferredValue(n)},m.useEffect=function(n,i){return E.current.useEffect(n,i)},m.useId=function(){return E.current.useId()},m.useImperativeHandle=function(n,i,b){return E.current.useImperativeHandle(n,i,b)},m.useInsertionEffect=function(n,i){return E.current.useInsertionEffect(n,i)},m.useLayoutEffect=function(n,i){return E.current.useLayoutEffect(n,i)},m.useMemo=function(n,i){return E.current.useMemo(n,i)},m.useReducer=function(n,i,b){return E.current.useReducer(n,i,b)},m.useRef=function(n){return E.current.useRef(n)},m.useState=function(n){return E.current.useState(n)},m.useSyncExternalStore=function(n,i,b){return E.current.useSyncExternalStore(n,i,b)},m.useTransition=function(){return E.current.useTransition()},m.version="18.3.1",m}var de;function Ie(){return de||(de=1,te.exports=Oe()),te.exports}var Pe=Ie();const X=Ce(Pe),ke=e=>e;function Te(e,t=ke){const o=X.useSyncExternalStore(e.subscribe,X.useCallback(()=>t(e.getState()),[e,t]),X.useCallback(()=>t(e.getInitialState()),[e,t]));return X.useDebugValue(o),o}const fe=e=>{const t=Re(e),o=s=>Te(t,s);return Object.assign(o,t),o},_e=(e=>e?fe(e):fe);let ne=null;const Ue=3e3;function pe(e){const t=e.capabilities??{};return{loaded:!0,runChatId:t.runChatId===!0,walkthroughRoots:t.walkthroughRoots===!0,askPath:t.askPath===!0,chatIdOnLaunch:t.chatIdOnLaunch===!0,deliverGate:t.deliverGate===!0,reducedAssurance:t.reducedAssurance===!0,launchPrimary:t.launchPrimary===!0,chatList:t.chatList===!0,chatAttachments:t.chatAttachments===!0,chatWorkflows:Array.isArray(t.chatWorkflows)?t.chatWorkflows.filter(o=>typeof o=="string"):[],powerMode:t.powerMode===!0,gateActions:t.gateActions===!0,voice:t.voice===!0,chatContext:t.chatArtifacts?.context===!0,chatProposals:t.chatArtifacts?.proposals===!0,chatArtifactsStub:t.chatArtifacts?.stub===!0,chatOnboard:t.chatArtifacts?.onboard===!0,chatArtifactsStubOps:Ae(t.chatArtifacts),chatCutInView:t.chatArtifacts?.cutInView===!0,dataSources:t.apps?.uploads===!0,trackerLinks:t.trackerLinks===!0,planGateNote:t.planGateNote===!0,chatJobProposals:t.chatJobProposals===!0,reshapeRun:t.reshapeRun===!0,chatJobPower:t.chatJobPower===!0,workflowCatalogV2:t.workflowCatalogV2===!0,memoryRestore:t.memoryRestore===!0,knowledgeForget:t.knowledgeForget===!0}}const Ee={loaded:!0,gateActions:!1,runChatId:!1,walkthroughRoots:!1,askPath:!1,chatIdOnLaunch:!1,deliverGate:!1,reducedAssurance:!1,launchPrimary:!1,chatList:!1,chatAttachments:!1,chatWorkflows:[],powerMode:!1,voice:!1,chatContext:!1,chatProposals:!1,chatArtifactsStub:!1,chatOnboard:!1,chatArtifactsStubOps:null,chatCutInView:!1,dataSources:!1,trackerLinks:!1,planGateNote:!1,chatJobProposals:!1,reshapeRun:!1,chatJobPower:!1,workflowCatalogV2:!1,memoryRestore:null,knowledgeForget:!1},je=_e((e,t)=>({loaded:!1,runChatId:!1,walkthroughRoots:!1,askPath:!1,chatIdOnLaunch:!1,deliverGate:!1,reducedAssurance:!1,launchPrimary:!1,chatList:!1,chatAttachments:!1,chatWorkflows:[],powerMode:!1,gateActions:!1,voice:!1,chatContext:!1,chatProposals:!1,chatArtifactsStub:!1,chatOnboard:!1,chatArtifactsStubOps:null,chatCutInView:!1,dataSources:!1,planGateNote:!1,chatJobProposals:!1,reshapeRun:!1,chatJobPower:!1,workflowCatalogV2:!1,trackerLinks:!1,memoryRestore:null,knowledgeForget:!1,load:()=>t().loaded?Promise.resolve():(ne??(ne=Promise.resolve().then(()=>ye).then(({api:o})=>o.getHealth()).then(o=>{e(pe(o)),o.ping==="busy"&&setTimeout(()=>{Promise.resolve().then(()=>ye).then(({api:s})=>s.getHealth()).then(s=>e({chatWorkflows:pe(s).chatWorkflows}),()=>{})},Ue)}).catch(()=>{e(Ee)}).finally(()=>{ne=null})),ne)}));function Ae(e){const t=e?.stubOps;return Array.isArray(t)?t.filter(o=>typeof o=="string"):null}const Ne={};function me(){const e=je.getState(),t=[...e.chatJobProposals?["job"]:[],...e.chatOnboard?["onboard"]:[]];return t.length>0?{accepts:t}:{}}function xe(){const e=Ne?.VITE_API_HOST;return typeof e=="string"&&e.length>0?e:void 0}function he(){const e=xe();return e?`http://${e}/api/v1`:`${window.location.origin}/api/v1`}const ge=48*1024,oe="/workflows/catalog";async function r(e,t){const o=t?.body!==void 0&&t?.body!==null&&!(typeof FormData<"u"&&t.body instanceof FormData)?{"Content-Type":"application/json",...t?.headers}:{...t?.headers},s=await fetch(`${he()}${e}`,{...t,headers:o});if(!s.ok){const u=await s.text();let h,x;try{const P=JSON.parse(u);x=P;const y=P.error??P.message??u;h=typeof y=="string"?y:JSON.stringify(y)}catch{h=u}throw h||(h=s.statusText),new K(s.status,h,x)}if(s.status!==204)return s.json()}const ye=Object.freeze(Object.defineProperty({__proto__:null,ApiError:K,KEEPALIVE_MAX_BYTES:ge,WORKFLOW_CATALOG_PATH:oe,api:{search:(e,t={})=>{const o=new URLSearchParams({q:e});return t.types!==void 0&&t.types.length>0&&o.set("types",t.types.join(",")),t.limit!==void 0&&o.set("limit",String(t.limit)),t.cursor!==void 0&&t.cursor!==null&&o.set("cursor",t.cursor),r(`/search?${o.toString()}`,t.signal!==void 0?{signal:t.signal}:void 0)},listRuns:e=>r(e?"/runs?include=archived":"/runs"),listRunsForDoc:e=>r(`/runs?doc=${encodeURIComponent(e)}`),archiveRun:(e,t,o)=>r(`/runs/${encodeURIComponent(e)}/archive`,{method:"POST",body:JSON.stringify(o===void 0?{archived:t}:{archived:t,note:o})}),resolveRun:(e,t)=>r(`/runs/${encodeURIComponent(e)}/resolve`,{method:"POST",body:JSON.stringify(t)}),getRun:e=>r(`/runs/${encodeURIComponent(e)}`),getAudit:e=>r(`/audit?runId=${encodeURIComponent(e)}`),getAuditByAction:(e,t)=>r(`/audit?action=${encodeURIComponent(e)}${t!==void 0?`&limit=${Math.max(1,Math.floor(t))}`:""}`),getAuditSince:(e,t=200)=>r(`/audit?since=${Math.max(0,Math.floor(e))}&limit=${t}`),getRunEvents:(e,t)=>r(`/runs/${encodeURIComponent(e)}/events${t!==void 0&&t.length>0?`?type=${t.map(encodeURIComponent).join(",")}`:""}`),getRunAcceptance:e=>r(`/runs/${encodeURIComponent(e)}/acceptance`),getRunInventory:e=>r(`/runs/${encodeURIComponent(e)}/inventory`),launchRun:e=>r("/runs",{method:"POST",body:JSON.stringify(e)}),previewLaunchPosture:e=>r("/runs/preview",{method:"POST",body:JSON.stringify(e)}),previewLinkedIssues:e=>r("/linked-issues/preview",{method:"POST",body:JSON.stringify(e)}),deliverRun:e=>r(`/runs/${encodeURIComponent(e)}/deliver`,{method:"POST"}),runPullRequest:e=>r(`/runs/${encodeURIComponent(e)}/pr`),redeliverRun:e=>r(`/runs/${encodeURIComponent(e)}/redeliver`,{method:"POST"}),confirmGate:(e,t)=>{const o=JSON.stringify(t);return r(`/runs/${encodeURIComponent(e)}/gate`,{method:"POST",body:o,...new TextEncoder().encode(o).length<=ge?{keepalive:!0}:{}})},cancelRun:(e,t)=>r(`/runs/${encodeURIComponent(e)}/cancel`,t!==void 0&&(t.reason!==void 0||t.input!==void 0)?{method:"POST",body:JSON.stringify(t)}:{method:"POST"}),putGuidance:(e,t)=>r(`/runs/${encodeURIComponent(e)}/guidance`,{method:"PUT",body:JSON.stringify({text:t})}),resumeRun:e=>r(`/runs/${encodeURIComponent(e)}/resume`,{method:"POST"}),openChat:e=>r("/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,...me()})}),sendChatMessage:(e,t,o,s,u)=>r(`/chats/${encodeURIComponent(e)}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t,...o!==void 0?{targets:o}:{},...s!==void 0&&s.length>0?{attachments:s}:{},...u!==void 0&&Object.keys(u).length>0?{context:u}:{},...me()})}),reseatChat:(e,t)=>r(`/chats/${encodeURIComponent(e)}/seats`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clis:t})}),closeChat:e=>r(`/chats/${encodeURIComponent(e)}`,{method:"DELETE"}),getChat:e=>r(`/chats/${encodeURIComponent(e)}`),listChats:()=>r("/chats"),listChatHistory:(e={})=>{const t=new URLSearchParams({limit:String(e.limit??20),status:e.status??"all"});return e.cursor!==void 0&&e.cursor!==null&&e.cursor!==""&&t.set("cursor",e.cursor),r(`/chats?${t.toString()}`)},getChatMessages:e=>r(`/chats/${encodeURIComponent(e)}/messages`),decideChatProposal:(e,t,o)=>r(`/chats/${encodeURIComponent(e)}/proposals/${encodeURIComponent(t)}`,{method:"POST",body:JSON.stringify(o)}),proposeInChat:(e,t)=>r(`/chats/${encodeURIComponent(e)}/proposals`,{method:"POST",body:JSON.stringify(t)}),reviseChatProposal:(e,t)=>r(`/chats/${encodeURIComponent(e)}/proposals`,{method:"POST",body:JSON.stringify(t)}),reshapeRun:(e,t)=>r(`/runs/${encodeURIComponent(e)}/reshape`,{method:"POST",body:JSON.stringify(t)}),endChat:e=>r(`/chats/${encodeURIComponent(e)}/close`,{method:"POST"}),uploadChatAttachments:(e,t)=>{const o=new FormData;for(const s of t)o.append("file",s,s.name);return r(`/chats/${encodeURIComponent(e)}/attachments`,{method:"POST",body:o})},getUnitOutput:(e,t)=>r(`/runs/${encodeURIComponent(e)}/units/${encodeURIComponent(t)}/output`),getGate:(e,t)=>r(`/runs/${encodeURIComponent(e)}/gate`,t!==void 0?{signal:t}:void 0),getElicitation:async e=>{try{return await r(`/runs/${encodeURIComponent(e)}/elicitation`)}catch(t){if(ce(t)===404)return null;throw t}},respondToElicitation:(e,t)=>r(`/runs/${encodeURIComponent(e)}/elicitation`,{method:"POST",body:JSON.stringify(t)}),getRoster:e=>r(e===void 0?"/roster":`/roster?refresh=${encodeURIComponent(e)}`),getWatch:(e={})=>{const t=new URLSearchParams;for(const[s,u]of Object.entries(e))u!==void 0&&u!==""&&t.set(s,String(u));const o=t.toString();return r(`/watch${o===""?"":`?${o}`}`)},getSeatRecord:(e=7,t)=>r(`/roster/record?days=${e}${t!==void 0?`&project=${encodeURIComponent(t)}`:""}`),listRepos:()=>r("/repos"),registerRepo:(e,t,o,s)=>r("/repos",{method:"POST",body:JSON.stringify({name:e,rootPath:t,...o!==void 0?{projectId:o}:{},...s?.autoCapture===!1?{autoCapture:!1}:{}})}),cloneAndRegisterRepo:(e,t,o,s,u)=>r("/repos",{method:"POST",body:JSON.stringify({name:e,gitUrl:t,...o?{rootPath:o}:{},...s!==void 0?{projectId:s}:{},...u?.autoCapture===!1?{autoCapture:!1}:{}})}),unregisterRepo:e=>r(`/repos/${encodeURIComponent(e)}`,{method:"DELETE"}),getMaintenance:()=>r("/maintenance"),setMaintenance:e=>r("/maintenance",{method:"POST",body:JSON.stringify({drain:e})}),getOnboardRun:e=>r(`/repos/${encodeURIComponent(e)}/onboard`),rerunOnboarding:e=>r(`/repos/${encodeURIComponent(e)}/onboard`,{method:"POST"}),getHealth:()=>r("/health"),openTerminal:e=>r("/terminals",{method:"POST",body:JSON.stringify(e)}),seatLogout:(e,t)=>r(`/seats/${encodeURIComponent(e)}/logout`,{method:"POST",body:JSON.stringify(t)}),seatContainerLogin:(e,t)=>r(`/seats/${encodeURIComponent(e)}/container-login`,{method:"POST",body:JSON.stringify(t)}),closeSeatContainerLogin:e=>r(`/seats/${encodeURIComponent(e)}/container-login`,{method:"DELETE"}),seatContainerLoginOutcome:(e,t)=>r(`/seats/${encodeURIComponent(e)}/container-login`,t===void 0?void 0:{signal:t}),seatContainerLogout:e=>r(`/seats/${encodeURIComponent(e)}/container-logout`,{method:"POST"}),resizeTerminal:(e,t,o)=>r(`/terminals/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify({cols:t,rows:o})}),closeTerminal:e=>r(`/terminals/${encodeURIComponent(e)}/close`,{method:"POST"}),openPath:(e,t)=>r("/open",{method:"POST",body:JSON.stringify(t===void 0?{path:e}:{path:e,runId:t})}),getRunFile:(e,t)=>r(`/runs/${encodeURIComponent(e)}/files?path=${encodeURIComponent(t)}`),getRunDiff:(e,t,o)=>{const s=new URLSearchParams;t!==void 0&&s.set("path",t),o!==void 0&&s.set("base",o);const u=s.toString();return r(`/runs/${encodeURIComponent(e)}/diff${u===""?"":`?${u}`}`)},inspectUnit:(e,t)=>r(`/runs/${encodeURIComponent(e)}/units/${t}/inspect`,{method:"POST",body:"{}"}),getInspections:(e,t)=>r(`/runs/${encodeURIComponent(e)}/units/${t}/inspections`),injectMessage:(e,t,o,s)=>r(`/runs/${encodeURIComponent(e)}/inject`,{method:"POST",body:JSON.stringify(s?.input!==void 0?{message:t,target:o,input:s.input}:{message:t,target:o})}),listWorkflows:()=>r("/workflows"),getWorkflowCatalog:e=>r(e!=null&&e!==""?`${oe}?projectId=${encodeURIComponent(e)}`:oe).catch(t=>{if(t instanceof SyntaxError)return null;throw t}),getWorkflow:e=>r(`/workflows/${encodeURIComponent(e)}`),saveScript:(e,t,o)=>r("/scripts",{method:"POST",body:JSON.stringify({name:e,content:t,lang:o})}),listRequirements:async(e,t,o={})=>{const s=new URLSearchParams;t.q&&s.set("q",t.q),t.mismatch&&s.set("mismatch",t.mismatch),t.risk&&s.set("risk",t.risk),t.category&&s.set("category",t.category),t.domain&&s.set("domain",t.domain),s.set("offset",String(t.offset??0)),s.set("limit",String(t.limit??50));const u=await r(`/repos/${encodeURIComponent(e)}/requirements?${s.toString()}`,o.signal!==void 0?{signal:o.signal}:void 0);if(typeof u=="object"&&u!==null&&"code"in u&&u.code==="notGenerated")throw new K(404,typeof u.error=="string"?u.error:"No requirements graph yet for this repository",u);return u},setRequirementsMinimum:(e,t)=>r(`/repos/${encodeURIComponent(e)}/requirements/minimum`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({minPct:t})}),getRequirement:(e,t)=>r(`/repos/${encodeURIComponent(e)}/requirements/${encodeURIComponent(t)}`),patchRequirement:(e,t,o)=>r(`/repos/${encodeURIComponent(e)}/requirements/${encodeURIComponent(t)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),getDomainGraph:()=>r("/domain-graph"),getRepoGraph:(e,t)=>{const o=new URLSearchParams;t?.focus&&o.set("focus",t.focus),t?.limit&&o.set("limit",String(t.limit));const s=o.size>0?`?${o.toString()}`:"";return r(`/repos/${encodeURIComponent(e)}/graph${s}`)},getBlastRadius:(e,t)=>r(`/repos/${encodeURIComponent(e)}/graph/blast-radius?name=${encodeURIComponent(t)}`),getRepoGitHistory:(e,t)=>r(`/repos/${encodeURIComponent(e)}/git-history${t===void 0?"":`?limit=${t}`}`),getDeliverTarget:async e=>{try{return await r(`/repos/${encodeURIComponent(e)}/deliver-target`)}catch{return null}},getRepoContributors:e=>r(`/repos/${encodeURIComponent(e)}/contributors`),getRepoDomainGraph:e=>r(`/repos/${encodeURIComponent(e)}/domain-graph`),listPolicies:()=>r("/governance/policies"),listConformanceRules:()=>r("/governance/rules"),getCoverageReport:(e={})=>r("/governance/coverage",e.signal!==void 0?{signal:e.signal}:void 0),getCoverageReportForRepo:(e,t={})=>r(`/governance/coverage?repo=${encodeURIComponent(e)}`,t.signal!==void 0?{signal:t.signal}:void 0),getGraphKindsForRepo:(e,t={})=>r(`/governance/graph?repo=${encodeURIComponent(e)}`,t.signal!==void 0?{signal:t.signal}:void 0),listClaims:()=>r("/governance/claims"),upsertPolicy:e=>r("/governance/policies",{method:"POST",body:JSON.stringify(e)}),upsertConformanceRule:e=>r("/governance/rules",{method:"POST",body:JSON.stringify(e)}),retirePolicy:e=>r(`/governance/policies/${encodeURIComponent(e)}`,{method:"DELETE"}),retireConformanceRule:e=>r(`/governance/rules/${encodeURIComponent(e)}`,{method:"DELETE"}),recallRulesPreview:e=>{const t=new URLSearchParams;for(const[u,h]of Object.entries(e))h&&t.set(u,h);const o=t.toString(),s=o?`?${o}`:"";return r(`/governance/rules/preview${s}`)},getSettings:()=>r("/settings"),updateSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify(e)}),getAppearanceSettings:()=>r("/settings"),putAppearanceSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.appearance":e})}),putNotifSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.notifications":e})}),putComposerSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.composer":e})}),putSetupSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.setup":e})}),putViewSettings:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.view":e})}),putReportShown:e=>r("/settings",{method:"PUT",body:JSON.stringify({"studio.report":{shown:e}})}),listApps:()=>r("/apps"),listProjects:e=>{const t=e?`?status=${e}`:"";return r(`/projects${t}`)},getProject:e=>r(`/projects/${encodeURIComponent(e)}`),createProject:e=>r("/projects",{method:"POST",body:JSON.stringify(e)}),updateProject:(e,t)=>r(`/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}),listProjectMembers:e=>r(`/projects/${encodeURIComponent(e)}/members`),listProjectPrompts:e=>r(`/projects/${encodeURIComponent(e)}/prompts`),attachProjectMember:(e,t)=>r(`/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:JSON.stringify(t)}),detachProjectMember:(e,t)=>r(`/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:"DELETE"}),getProjectActivity:(e,t)=>{const o=t?`?cursor=${encodeURIComponent(t)}`:"";return r(`/projects/${encodeURIComponent(e)}/activity${o}`)},reassignRun:(e,t,o,s)=>r(`/runs/${encodeURIComponent(e)}/reassign`,{method:"POST",body:JSON.stringify({...t===void 0?{}:{cli:t},...o?.trim()?{note:o.trim()}:{},...s===void 0?{}:{ord:s}})}),getProjectGraph:e=>r(`/projects/${encodeURIComponent(e)}/graph`),refreshProjectGraph:(e,t)=>r(`/projects/${encodeURIComponent(e)}/graph/refresh`,{method:"POST",body:JSON.stringify(t??{})})},apiBase:he,apiFetch:r,apiStatus:ce,translateWireError:ae},Symbol.toStringTag,{value:"Module"})),Y=e=>e==null?"null":typeof e=="string"?e:JSON.stringify(e);function qe(e,t){switch(e.type){case"number":return Math.round((t+1)*13.7*10)/10;case"integer":return(t+1)*7;case"boolean":return t%2===0;case"date":return`2026-10-${String(10+t).padStart(2,"0")}`;case"datetime":return`2026-10-${String(10+t).padStart(2,"0")}T09:30:00Z`;default:return`${e.name.replace(/_/g," ")} ${t+1}`}}function Le(e,t){const o=Object.assign(Object.create(null),structuredClone(t?.rows??{})),s=null,u="you",h=new Map;let x=0;const P=(y,p)=>y.kind==="param"?{value:p[y.name]??null,from:"from the app"}:y.kind==="literal"?{value:y.value,from:"fixed by the app"}:y.kind==="viewer"?{value:y.claim==="name"?u.split("@")[0]:u,from:"your sign-in"}:{value:y.value==="now"?new Date().toISOString():"a new uuid",from:`filled by studio: ${y.value}`};return{kind:{queries:"sample",actions:"sample"},async query(y,p,g){const d=e().queries.find(C=>C.id===p);if(d===void 0)return{error:"refused",message:`this version has no query ${p}`};Object.hasOwn(o,p)||(o[p]=[0,1,2].map(C=>d.output.map(L=>qe(L,C))));let U=o[p];const A=Object.values(g).filter(C=>typeof C=="string"&&C.trim()!==""&&C!=="all");return A.length>0&&(U=U.filter(C=>A.every(L=>C.some(q=>typeof q=="string"&&q.toLowerCase().includes(L.toLowerCase()))))),{columns:d.output,rows:structuredClone(U),truncated:!1,hasMore:!1,ms:1,cachedAt:null,sample:!0}},async prepare(y,p,g){const d=e().actions.find(v=>v.id===p);if(d===void 0)return{error:"refused",message:`this version has no action ${p}`};const U=[];let A,C,L=null,q=null;if(d.kind==="row-write"){const v=Object.entries(d.set??{});for(const[l,f]of v){const k=P(f,g);U.push({label:l,value:Y(k.value),from:k.from})}L=`${Object.entries(d.key).map(([l,f])=>`${l} = ${Y(g[f.name])}`).join(", ")} (exactly 1 row)`,q="Sample: no table was checked. A real run checks a plain table (no triggers, rules, inheritance or row security) just before it writes.",A=`${d.op.toUpperCase()} ${d.table}`;const c=v.length;C=d.op==="update"?`UPDATE ONLY ${d.table} AS w SET ${v.map(([l],f)=>`${l} = $${f+1}`).join(", ")} WHERE ${Object.keys(d.key).map((l,f)=>`w.${l} = $${c+f+1}`).join(" AND ")}`:d.op==="delete"?`DELETE FROM ONLY ${d.table} AS w WHERE ${Object.keys(d.key).map((l,f)=>`w.${l} = $${f+1}`).join(" AND ")}`:`INSERT INTO ${d.table} (${v.map(([l])=>l).join(", ")}) VALUES (${v.map((l,f)=>`$${f+1}`).join(", ")})`}else{for(const[v,a]of Object.entries(d.args)){const c=P(a,g);U.push({label:v,value:Y(c.value),from:c.from})}A=d.call.kind==="tool"?d.call.tool:`mutation ${d.call.mutation.slice(0,60)}`,C=`${A}
10
+ ${JSON.stringify(Object.fromEntries(U.map(v=>[v.label,v.value])),null,1)}`}x+=1;const N=`sample-${x}`,J=Date.now()+12e4;return h.set(N,{action:d,params:g,expiresAt:J}),{record:N,expiresAt:J,card:{action:d.id,kind:d.kind,source:`${d.source} (sample)`,operation:A,rows:U,key:L,checks:q,request:C,says:d.description??null,sample:!0}}},async run(y,p){const g=h.get(p);if(h.delete(p),g===void 0||g.action.id!==y)return{state:"failed",reason:"this card was not prepared here",sample:!0};if(Date.now()>g.expiresAt)return{state:"failed",reason:"the card expired; nothing was written",sample:!0};if(g.action.kind==="row-write"&&g.action.op==="update"){const U=g.action;for(const A of e().queries){const C=A.output.map(N=>N.name),L=Object.entries(U.key),q=Object.hasOwn(o,A.id)?o[A.id]:void 0;if(!(q===void 0||!L.every(([N])=>C.includes(N)))){for(const N of q)if(L.every(([J,v])=>Y(N[C.indexOf(J)])===Y(g.params[v.name])))for(const[J,v]of Object.entries(U.set??{}))C.includes(J)&&(N[C.indexOf(J)]=P(v,g.params).value)}}}return{state:"succeeded",reason:g.action.kind==="row-write"&&g.action.op==="update"?"Sample data: the sample rows in this tab changed; no source was touched":"Sample data: nothing was written and no rows changed",sample:!0}},viewer:()=>({email:s,sample:!0})}}const re="wicked.editor",se=1,Je=/^[A-Z]{3}$/u;function De(e,t,o){if(e==null)return"";if(typeof e=="boolean")return e?"yes":"no";const s=void 0,u=typeof e=="number"?e:typeof e=="string"&&e.trim()!==""&&Number.isFinite(Number(e))?Number(e):null;try{switch(t?.kind){case"currency":if(u===null||!Je.test(t.currency))break;return new Intl.NumberFormat(o,{style:"currency",currency:t.currency,...s!==void 0?{minimumFractionDigits:s,maximumFractionDigits:s}:{}}).format(u);case"percent":if(u===null)break;return new Intl.NumberFormat(o,{style:"percent",maximumFractionDigits:s??1}).format(u);case"number":if(u===null)break;return new Intl.NumberFormat(o,s!==void 0?{minimumFractionDigits:s,maximumFractionDigits:s}:{}).format(u);case"date":case"datetime":{const h=new Date(typeof e=="number"?e:String(e));if(Number.isNaN(h.getTime()))break;return new Intl.DateTimeFormat(o,t.kind==="date"?{dateStyle:"medium",timeZone:"UTC"}:{dateStyle:"medium",timeStyle:"short"}).format(h)}case"duration":{if(u===null)break;const h=Math.abs(Math.round(u)),x=Math.floor(h/86400),P=Math.floor(h%86400/3600),y=Math.floor(h%3600/60);return x>0?`${x}d ${P}h`:P>0?`${P}h ${y}m`:`${y}m`}default:break}}catch{}return typeof e=="number"?Number.isInteger(e)?String(e):new Intl.NumberFormat(o,{maximumFractionDigits:6}).format(e):String(e)}function Me(e,t){if(e===void 0||t===null||t===void 0)return t;if((e.type==="number"||e.type==="integer")&&typeof t=="string"&&t.trim()!==""){const o=Number(t);return Number.isFinite(o)&&(e.type==="number"||Number.isInteger(o))?o:t}return e.type==="boolean"&&typeof t=="string"&&(t==="true"||t==="false")?t==="true":e.type==="string"&&(typeof t=="number"||typeof t=="boolean")?String(t):t}const Q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),we=()=>new Promise(e=>requestAnimationFrame(()=>e()));async function Se(e,t,o){const s=Object.entries(o).sort(([p],[g])=>p.localeCompare(g)),u=JSON.stringify([t,s]);let h=0;for(const p of u)h=Math.imul(h,31)+p.charCodeAt(0)>>>0;const x=e.queries.find(p=>p.id===t),P=s.map(([,p])=>p).filter(p=>typeof p=="string").join(" "),y=[0,1,2].map(p=>(x?.output??[]).map(g=>{const d=h%1e3+p+1;switch(g.type){case"number":return d/10;case"integer":return d;case"boolean":return d%2===0;case"date":return`2026-10-${String(10+p).padStart(2,"0")}`;case"datetime":return`2026-10-${String(10+p).padStart(2,"0")}T09:30:00Z`;default:return`${P} ${g.name} ${d}`.trim()}}));return Le(()=>e,{rows:{[t]:y}}).query(1,t,o)}async function Fe(){const e=Date.parse("2026-10-15T12:00:00Z");window.Date=new Proxy(Date,{construct:(a,c)=>Reflect.construct(a,c.length===0?[e]:c),apply:a=>new a(e).toString(),get:(a,c,l)=>c==="now"?()=>e:Reflect.get(a,c,l)});let t;const o=new Map,s=new Map;let u,h=0,x=0,P=0,y=null;const p=new Map,g=a=>{const c=a instanceof Error?a.message:String(a);v.errors.includes(c)||v.errors.push(c)},d=async a=>{try{await a()}catch(c){throw g(c),c}},U=a=>{const c=t.spec.pages.find(l=>l.id===a);if(c===void 0)throw new Error(`This app has no page ${a}`);return c},A=a=>{const c=[...document.querySelectorAll("[data-component]")].find(l=>l.dataset.component===a);if(c===void 0)throw new Error(`This page has no filter ${a}`);return c},C=a=>a.filter==="search"?["fixture"]:a.filter==="date-range"?["2026-10-01/2026-10-31"]:a.options?.kind==="values"?a.options.values.map(c=>c.value):[...s.get(a.id)??[]],L=async()=>{for(const a of t.spec.pages)for(const c of a.components){if(c.type!=="filter"||c.options?.kind!=="query")continue;const l=c.options,f=t.spec.queries.find(S=>S.id===l.query.query),k={};for(const[S,D]of Object.entries(l.query.params??{})){const[Z,H,G]=D.split("."),B=Z==="filter"&&H!==void 0?o.get(H):void 0,E=typeof B=="string"?G===void 0?B:void 0:G==="from"?B?.from:G==="to"?B?.to:void 0,W=f?.params?.properties??{};E!==void 0&&E!==""&&(k[S]=Me(Object.hasOwn(W,S)?W[S]:void 0,E))}const w=await Se(t.spec,l.query.query,k);if("error"in w)throw new Error(w.message);const O=w.columns.findIndex(S=>S.name===l.value);s.set(c.id,w.rows.slice(0,200).map(S=>De(S[O],void 0,"en")).filter(S=>S!==""))}},q=()=>new Promise((a,c)=>{const l=`fixture-${++P}`,f=setTimeout(()=>{p.delete(l),c(new Error("The runtime did not answer"))},5e3);p.set(l,()=>{clearTimeout(f),a()}),u.postMessage({p:re,v:se,type:"host.ping",id:l,payload:{}})}),N=async()=>{const a=performance.now()+5e3;let c=0;for(;c<2;){const l=h;if(await q(),await we(),await we(),c=x===0&&l===h?c+1:0,performance.now()>a)throw new Error("The fixture did not finish rendering")}for(const l of document.querySelectorAll(".wk-error"))l.textContent&&g(l.textContent)},J=a=>{if(!t.spec.actions.some(O=>O.id===a))throw new Error(`This app has no action ${a}`);const c=Array.isArray(t.cards)?t.cards.find(O=>O.action===a):Object.hasOwn(t.cards,a)?t.cards[a]:void 0;if(c===void 0)throw new Error(`The fixture has no card for ${a}`);y?.remove(),y=document.createElement("div"),y.className="wk-fixture-card";const l=document.createElement("section");l.setAttribute("role","dialog"),l.setAttribute("aria-modal","true"),l.setAttribute("aria-label",`Prepare ${a}`),l.setAttribute("data-testid","apps-card");const f=document.createElement("h2");f.textContent=`Prepare ${a}`;const k=document.createElement("pre");k.textContent=typeof c=="string"?c:JSON.stringify(c,null,2);const w=document.createElement("button");w.type="button",w.textContent="Close",w.addEventListener("click",()=>{v.closeCard()}),l.append(f,k,w),y.append(l),document.body.append(y),w.focus()},v={ready:!1,errors:[],pages:()=>t.spec.pages.map(a=>a.id),filters:a=>U(a).components.filter(c=>c.type==="filter").map(c=>({id:c.id,values:C(c)})),actions:a=>[...new Set(U(a).components.flatMap(c=>c.type==="button"?[c.action.action]:c.type==="form"?[c.submit.action]:c.type==="table"?(c.rowActions??[]).map(l=>l.action):[]))],show:a=>d(async()=>{const c=t.spec.pages.indexOf(U(a)),l=document.querySelectorAll(".wk-page")[c];if(l===void 0)throw new Error(`The runtime did not draw page ${a}`);l.click(),await N()}),setFilter:(a,c)=>d(async()=>{const l=t.spec.pages.find(w=>w.components.some(O=>O.id===a&&O.type==="filter"));if(l===void 0)throw new Error(`This app has no filter ${a}`);await v.show(l.id);const f=A(a),k=f.querySelector("select");if(k!==null){if(![...k.options].some(w=>w.value===c))throw new Error(`This filter has no value ${c}`);k.value=c,o.set(a,c),k.dispatchEvent(new Event("change",{bubbles:!0}))}else{const w=[...f.querySelectorAll("input")],O=w.length===2?c.split("/"):[c];if(w.length===0||O.length!==w.length)throw new Error("A date range needs from/to");for(const[S,D]of w.entries())D.value=O[S],D.dispatchEvent(new Event(D.type==="search"?"input":"change",{bubbles:!0}));o.set(a,w.length===2?{from:w[0].value,to:w[1].value}:w[0].value),w[0]?.type==="search"&&await new Promise(S=>setTimeout(S,310))}await L(),await N()}),prepare:a=>d(async()=>{J(a),await N()}),closeCard:()=>d(async()=>{y?.remove(),y=null,await N()})};window.__wkFixture=v,window.addEventListener("error",a=>g(a.message)),window.addEventListener("unhandledrejection",a=>g(a.reason));try{const a=await fetch("./fixture.json",{credentials:"omit",redirect:"error"});if(!a.ok)throw new Error("The fixture could not be read");t=await a.json();for(const l of t.spec.pages)for(const f of l.components)if(f.type==="filter")if(f.filter==="date-range"){const k=Q(f.default)&&Number.isInteger(f.default.lastDays)?Math.min(3650,Math.max(1,f.default.lastDays)):30;o.set(f.id,{from:new Date(e-k*864e5).toISOString().slice(0,10),to:new Date(e).toISOString().slice(0,10)})}else o.set(f.id,typeof f.default=="string"?f.default:"");await L();const c=new MessageChannel;if(u=c.port1,u.onmessage=l=>{const f=l.data;if(!Q(f)||f.p!==re||f.v!==se)return;if(typeof f.re=="string"){p.get(f.re)?.(),p.delete(f.re);return}if(typeof f.id!="string")return;const k=f.id,w=Q(f.payload)?f.payload:{},O=(S,D)=>{u.postMessage({p:re,v:se,re:k,ok:D===void 0,payload:S,...D===void 0?{}:{error:D}})};switch(h+=1,f.type){case"artifact.read":O({version:1,content:{type:"app",spec:t.spec,readonly:!0}});return;case"data.query":{x+=1,Se(t.spec,String(w.query),Q(w.params)?w.params:{}).then(S=>{"error"in S?(g(S.message),O({},{code:S.error,message:S.message})):O(S)}).catch(S=>{g(S),O({},{code:"unavailable",message:"The fixture query failed"})}).finally(()=>{x-=1,h+=1});return}case"data.action":try{J(String(w.action)),O({state:"cancelled"})}catch(S){g(S),O({},{code:"refused",message:String(S)})}return;default:O({},{code:"unsupported",message:"The fixture only reads and prepares"});return}},window.wickedAppsStandalone.boot(c.port2,{protocol:2,surface:"full",size:"full",grants:["artifact.read","data.read","data.write"],app:{framed:!1,mode:"preview",url:{}},prefs:{locale:"en"},theme:{}}),await N(),document.querySelector(".wk-page")===null)throw new Error("The runtime did not draw a page");v.ready=v.errors.length===0}catch(a){g(a)}}Fe()})();
@@ -1 +1 @@
1
- import{r as c,a as t,c as k,j as y,f as m}from"./index-Bame65hj.js";k.use(m);const w={source:"--status-gate",table:"--accent-dim",shape:"--accent",code:"--status-run",repo:"--ink-muted",knowledge:"--ink-muted",tracker:"--ink-high",project:"--kn-project",issue:"--kn-issue",run:"--kn-run",pr:"--kn-pr"},b={source:"round-rectangle",table:"rectangle",shape:"diamond",code:"ellipse",repo:"hexagon",knowledge:"triangle",tracker:"tag",project:"barrel",issue:"round-pentagon",run:"cut-rectangle",pr:"rhomboid"},f={source:34,table:24,shape:26,code:22,repo:30,knowledge:18,tracker:30,project:36,issue:22,run:24,pr:24},p=new Set(["describes","joins","governed_by","measures","tracked_in","addresses","closes"]);function E({nodes:l,edges:i,onSelect:d}){const n=c.useRef(null),a=c.useRef(d);return a.current=d,c.useEffect(()=>{if(n.current===null)return;const s=new Map(l.map((e,r)=>[e.key,`n${r}`])),u=t("--ink-high"),g=t("--ink-dim"),h=[...l.map(e=>({group:"nodes",data:{id:s.get(e.key),label:e.label,color:t(w[e.kind]),shape:b[e.kind],size:f[e.kind],kind:e.kind,raw:e}})),...i.filter(e=>s.has(e.from)&&s.has(e.to)).map((e,r)=>({group:"edges",data:{id:`e${r}`,source:s.get(e.from),target:s.get(e.to),rel:e.rel,label:p.has(e.rel)?e.rel.replace("_"," "):""},classes:p.has(e.rel)?`typed rel-${e.rel}`:"quiet"}))],o=k({container:n.current,elements:h,style:[{selector:"node",style:{"background-color":"data(color)",shape:"data(shape)",width:"data(size)",height:"data(size)",label:"data(label)","font-size":11,"font-family":"ui-sans-serif, system-ui, sans-serif",color:u,"text-valign":"bottom","text-halign":"center","text-margin-y":4,"text-max-width":"140px","text-wrap":"ellipsis","text-background-color":t("--surface-base"),"text-background-opacity":.85,"text-background-padding":"2px"}},{selector:"node:selected",style:{"border-width":3,"border-color":t("--accent")}},{selector:"edge",style:{width:1,"curve-style":"bezier","line-color":g,"target-arrow-color":g,"target-arrow-shape":"none",opacity:.45}},{selector:"edge.typed",style:{width:2,opacity:.95,"target-arrow-shape":"triangle","arrow-scale":.8,label:"data(label)","font-size":10,color:u,"text-rotation":"autorotate","text-background-color":t("--surface-base"),"text-background-opacity":.9,"text-background-padding":"2px"}},{selector:"edge.rel-joins",style:{"line-color":t("--accent"),"target-arrow-color":t("--accent"),"line-style":"solid"}},{selector:"edge.rel-describes",style:{"line-color":t("--status-run"),"target-arrow-color":t("--status-run"),"line-style":"dashed"}},{selector:"edge.rel-governed_by",style:{"line-color":t("--status-gate"),"target-arrow-color":t("--status-gate"),"line-style":"dotted",width:3}},{selector:"edge.rel-tracked_in",style:{"line-color":t("--ink-muted"),"target-arrow-color":t("--ink-muted"),"line-style":"solid"}},{selector:"edge.rel-addresses, edge.rel-closes",style:{"line-color":t("--status-warn"),"target-arrow-color":t("--status-warn"),"line-style":"dashed"}}],layout:{name:"fcose",animate:!1,randomize:!0,quality:"default",idealEdgeLength:140,nodeRepulsion:2e4,numIter:2500,nodeSeparation:100},wheelSensitivity:.3,minZoom:.2,maxZoom:3});return o.on("tap","node",e=>{var r;return(r=a.current)==null?void 0:r.call(a,e.target.data("raw"))}),o.on("tap",e=>{var r;e.target===o&&((r=a.current)==null||r.call(a,null))}),o.ready(()=>{o.destroyed()||o.fit(void 0,32)}),()=>o.destroy()},[l,i]),y.jsx("div",{ref:n,className:"wk-know-graph","data-testid":"knowledge-graph-canvas",role:"img","aria-label":"The knowledge map: sources, tables, repositories, code, data shapes, and trackers with the projects and repositories they are tracked in"})}export{E as KnowledgeGraph,p as NAMED_RELS};
1
+ import{r as c,a as t,c as k,j as y,f as m}from"./index-DW53FKuT.js";k.use(m);const w={source:"--status-gate",table:"--accent-dim",shape:"--accent",code:"--status-run",repo:"--ink-muted",knowledge:"--ink-muted",tracker:"--ink-high",project:"--kn-project",issue:"--kn-issue",run:"--kn-run",pr:"--kn-pr"},b={source:"round-rectangle",table:"rectangle",shape:"diamond",code:"ellipse",repo:"hexagon",knowledge:"triangle",tracker:"tag",project:"barrel",issue:"round-pentagon",run:"cut-rectangle",pr:"rhomboid"},f={source:34,table:24,shape:26,code:22,repo:30,knowledge:18,tracker:30,project:36,issue:22,run:24,pr:24},p=new Set(["describes","joins","governed_by","measures","tracked_in","addresses","closes"]);function E({nodes:l,edges:i,onSelect:d}){const n=c.useRef(null),a=c.useRef(d);return a.current=d,c.useEffect(()=>{if(n.current===null)return;const s=new Map(l.map((e,r)=>[e.key,`n${r}`])),u=t("--ink-high"),g=t("--ink-dim"),h=[...l.map(e=>({group:"nodes",data:{id:s.get(e.key),label:e.label,color:t(w[e.kind]),shape:b[e.kind],size:f[e.kind],kind:e.kind,raw:e}})),...i.filter(e=>s.has(e.from)&&s.has(e.to)).map((e,r)=>({group:"edges",data:{id:`e${r}`,source:s.get(e.from),target:s.get(e.to),rel:e.rel,label:p.has(e.rel)?e.rel.replace("_"," "):""},classes:p.has(e.rel)?`typed rel-${e.rel}`:"quiet"}))],o=k({container:n.current,elements:h,style:[{selector:"node",style:{"background-color":"data(color)",shape:"data(shape)",width:"data(size)",height:"data(size)",label:"data(label)","font-size":11,"font-family":"ui-sans-serif, system-ui, sans-serif",color:u,"text-valign":"bottom","text-halign":"center","text-margin-y":4,"text-max-width":"140px","text-wrap":"ellipsis","text-background-color":t("--surface-base"),"text-background-opacity":.85,"text-background-padding":"2px"}},{selector:"node:selected",style:{"border-width":3,"border-color":t("--accent")}},{selector:"edge",style:{width:1,"curve-style":"bezier","line-color":g,"target-arrow-color":g,"target-arrow-shape":"none",opacity:.45}},{selector:"edge.typed",style:{width:2,opacity:.95,"target-arrow-shape":"triangle","arrow-scale":.8,label:"data(label)","font-size":10,color:u,"text-rotation":"autorotate","text-background-color":t("--surface-base"),"text-background-opacity":.9,"text-background-padding":"2px"}},{selector:"edge.rel-joins",style:{"line-color":t("--accent"),"target-arrow-color":t("--accent"),"line-style":"solid"}},{selector:"edge.rel-describes",style:{"line-color":t("--status-run"),"target-arrow-color":t("--status-run"),"line-style":"dashed"}},{selector:"edge.rel-governed_by",style:{"line-color":t("--status-gate"),"target-arrow-color":t("--status-gate"),"line-style":"dotted",width:3}},{selector:"edge.rel-tracked_in",style:{"line-color":t("--ink-muted"),"target-arrow-color":t("--ink-muted"),"line-style":"solid"}},{selector:"edge.rel-addresses, edge.rel-closes",style:{"line-color":t("--status-warn"),"target-arrow-color":t("--status-warn"),"line-style":"dashed"}}],layout:{name:"fcose",animate:!1,randomize:!0,quality:"default",idealEdgeLength:140,nodeRepulsion:2e4,numIter:2500,nodeSeparation:100},wheelSensitivity:.3,minZoom:.2,maxZoom:3});return o.on("tap","node",e=>{var r;return(r=a.current)==null?void 0:r.call(a,e.target.data("raw"))}),o.on("tap",e=>{var r;e.target===o&&((r=a.current)==null||r.call(a,null))}),o.ready(()=>{o.destroyed()||o.fit(void 0,32)}),()=>o.destroy()},[l,i]),y.jsx("div",{ref:n,className:"wk-know-graph","data-testid":"knowledge-graph-canvas",role:"img","aria-label":"The knowledge map: sources, tables, repositories, code, data shapes, and trackers with the projects and repositories they are tracked in"})}export{E as KnowledgeGraph,p as NAMED_RELS};