@kizenapps/cli 1.19.0 → 1.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,C as n,F as r,I as i,M as a,N as o,P as s,f as c,i as l,p as ee,x as u}from"./fa-core-BSqLAjHu.js";import{t as te}from"./useParams-D3awshYI.js";import{t as ne}from"./useQuery-JKMI40WO.js";import{n as d}from"./CredentialsContext-p3i8s7a6.js";import{t as re}from"./bootstrapQuery-WnoB2iya.js";import{t as f}from"./Card-Sa52PGkn.js";import{t as p}from"./useLocalStorage-wp83IS34.js";var m=e(i(),1),h=`prod`,g=r();function _(e,t,n){return`secrets-pk::${e}::${t}::${n}`}function v(e,t,n){try{return localStorage.getItem(_(e,t,n))}catch{return null}}function ie(e,t,n,r){try{localStorage.setItem(_(e,t,n),r)}catch{}}var y=()=>{let{apiName:e}=te({from:`/$apiName/secrets`}),r=d(),{apiKey:i,userId:_,businessId:y,environment:b}=r,[x,S]=(0,m.useState)(h),[C,ae]=(0,m.useState)(!1),[w,oe]=p(`kizen-encryption-mode`,`local`),[T,E]=(0,m.useState)(null),[D,O]=(0,m.useState)(!1),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(null),[se,N]=(0,m.useState)(!1),[P,ce]=(0,m.useState)(``),[F,I]=(0,m.useState)(null),[L,R]=(0,m.useState)(null),[z,B]=(0,m.useState)(!1),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(``),[G,K]=(0,m.useState)(null),[q,J]=(0,m.useState)(!1),[le,Y]=(0,m.useState)(!1),ue=!!(i&&_&&y),{isError:de,isLoading:X}=ne(re(r));(0,m.useEffect)(()=>{let e=!1;return fetch(`/api/encryption-target`).then(e=>e.json()).then(t=>{!e&&(t.target===`dev`||t.target===`prod`)&&S(t.target)}).catch(()=>{}).finally(()=>{e||ae(!0)}),()=>{e=!0}},[]),(0,m.useEffect)(()=>{if(!C)return;let t=v(e,b,x);E(t),O(t!==null)},[e,b,x,C]);let Z=()=>{I(null),R(null)},fe=e=>{oe(e),Z()},pe=e=>{S(e),Z(),fetch(`/api/encryption-target`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:e})}).catch(()=>{})},Q=async()=>{A(!0),M(null),E(null);try{let t=await fetch(`/api/wizard/get-public-key`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-api-key":i,"x-user-id":_,"x-business-id":y,"x-encryption-target":x,"x-auth-environment":b},body:JSON.stringify({api_name:e})}),n=await t.json();t.ok&&typeof n.public_key==`string`?(E(n.public_key),ie(e,b,x,n.public_key),O(!0)):M(typeof n.error==`string`?n.error:`Unexpected response (${String(t.status)})`)}catch(e){M(e.message)}finally{A(!1)}},$=async()=>{if(C&&!(!P.trim()||w===`local`&&!T)){B(!0),R(null),I(null);try{let t=w===`remote`?await fetch(`/api/wizard/encrypt`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-api-key":i,"x-user-id":_,"x-business-id":y,"x-encryption-target":x,"x-auth-environment":b},body:JSON.stringify({api_name:e,value:P})}):await fetch(`/api/local/encrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publicKeyPem:T,value:P})}),n=await t.json();t.ok&&n.encrypted===!0&&typeof n.value==`string`?I(JSON.stringify({encrypted:!0,value:n.value},null,2)):R(typeof n.error==`string`?n.error:`Unexpected response (${String(t.status)})`)}catch(e){R(e.message)}finally{B(!1)}}},me=()=>{let e=U.replace(/\s+/g,``);try{let t=JSON.parse(e);W(JSON.stringify(t,null,2))}catch{W(e)}Y(!1),K(null)},he=async()=>{if(!U.trim())return;J(!0),K(null);let e=U.trim();try{let t=JSON.parse(e);typeof t.value==`string`&&(e=t.value)}catch{}try{K(await(await fetch(`/api/local/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({value:e})})).json())}catch(e){K({valid:!1,checks:[],error:e.message})}finally{J(!1)}};return ue?X?(0,g.jsx)(f,{children:(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(s,{icon:t,className:`animate-spin text-[20px] text-neutral-300`})})}):de?(0,g.jsx)(f,{children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center`,children:[(0,g.jsx)(s,{icon:a,className:`text-[22px] text-amber-400`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-500`,children:`Authentication failed`}),(0,g.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Your credentials were rejected. Please enter valid credentials and refresh.`})]})]})}):(0,g.jsxs)(f,{children:[(0,g.jsxs)(`div`,{className:`mb-5 flex items-end justify-between gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`block text-[12px] font-medium text-neutral-600`,children:`Encryption`}),(0,g.jsx)(`p`,{className:`mt-0.5 text-[11px] text-neutral-400`,children:`Where encryption runs, and which environment's keys secrets are encrypted against.`})]}),(0,g.jsxs)(`div`,{className:`flex shrink-0 items-end gap-3`,children:[(0,g.jsxs)(`div`,{role:`group`,"aria-label":`Encryption mode`,children:[(0,g.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-neutral-500`,children:`Mode`}),(0,g.jsx)(`div`,{className:`flex overflow-hidden rounded-lg border border-black/10 text-[12px] font-medium`,children:[`local`,`remote`].map(e=>(0,g.jsx)(`button`,{type:`button`,"aria-pressed":w===e,onClick:()=>{fe(e)},className:`px-2.5 py-1.5 transition-colors ${w===e?`bg-neutral-700 text-white`:`bg-white text-neutral-500 hover:bg-neutral-100`}`,children:e===`local`?`Local`:`Remote`},e))})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`enc-target`,className:`mb-1 block text-[11px] font-medium text-neutral-500`,children:`Keys`}),(0,g.jsxs)(`select`,{id:`enc-target`,value:x,onChange:e=>{pe(e.target.value)},className:`rounded-lg border border-black/10 bg-white px-2 py-1.5 text-[12px] text-neutral-700 outline-none focus:ring-2 focus:ring-blue-400`,children:[(0,g.jsx)(`option`,{value:`prod`,children:`Prod`}),(0,g.jsx)(`option`,{value:`dev`,children:`Dev`})]})]})]})]}),x===`dev`&&(0,g.jsxs)(`div`,{className:`mb-5 flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-700`,children:[(0,g.jsx)(s,{icon:a,className:`shrink-0 text-[11px]`}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{className:`font-semibold`,children:`Dev keys selected.`}),` Be sure you know what you're doing — most apps use the production encryption service. Secrets encrypted with dev keys won't decrypt in production.`]})]}),(0,g.jsx)(`hr`,{className:`mb-6 border-black/8`}),w===`local`&&(0,g.jsxs)(g.Fragment,{children:[T!==null&&D?(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-black/8 bg-neutral-50 px-3 py-2.5`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(s,{icon:l,className:`text-[11px] text-green-600`}),(0,g.jsx)(`span`,{className:`text-[12px] font-medium text-neutral-700`,children:`Public key loaded`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>{O(!1)},className:`rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:`Show`}),(0,g.jsx)(`span`,{className:`text-neutral-300`,children:`·`}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{Q()},disabled:k,className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-neutral-500 hover:bg-neutral-100 disabled:opacity-50`,children:[k&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[10px]`}),`Refresh`]})]})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Public Key`}),T!==null&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>{O(!0)},className:`text-[11px] font-medium text-neutral-400 hover:text-neutral-600`,children:`Collapse`})]}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[`Fetch the public key for`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:e}),`. Required for encryption below.`]})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Plugin`}),(0,g.jsx)(`div`,{className:`rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 text-[13px] text-neutral-500`,children:e})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{Q()},disabled:k,className:`flex items-center justify-center gap-2 rounded-lg bg-neutral-700 px-4 py-2 text-[13px] font-medium text-white hover:bg-neutral-800 active:bg-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:[k&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),k?`Fetching…`:T===null?`Get Public Key`:`Refresh Key`]}),j!==null&&(0,g.jsx)(`p`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-600`,children:j}),T!==null&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,g.jsx)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:`Public key (PEM)`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{T&&navigator.clipboard.writeText(T).then(()=>{N(!0),setTimeout(()=>{N(!1)},2e3)})},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:c,className:`text-[10px]`}),se?`Copied!`:`Copy`]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{if(!T)return;let t=new Blob([T],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}-${b}-${x}-public-key.pem`,r.click(),URL.revokeObjectURL(n)},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:ee,className:`text-[10px]`}),`Download`]})]})]}),(0,g.jsx)(`textarea`,{readOnly:!0,value:T,rows:5,className:`w-full rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 font-mono text-[11px] text-neutral-600 outline-none`})]})]})]}),(0,g.jsx)(`hr`,{className:`my-6 border-black/8`})]}),(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Encrypt a Secret`}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[w===`remote`?`Encrypts a secret via the remote plugin-wizard API. `:`Encrypts a secret in-process using the public key. `,`Output is ready to paste into`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:`kizen.json`}),`.`]})]}),w===`local`&&T===null?(0,g.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-700`,children:[(0,g.jsx)(s,{icon:u,className:`shrink-0 text-[11px]`}),`Fetch the public key above first, or switch to Remote mode.`]}):(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`secret-value`,className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Secret value`}),(0,g.jsx)(`input`,{id:`secret-value`,type:`password`,value:P,onChange:e=>{ce(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&$()},placeholder:`Enter the plaintext secret…`,className:`w-full rounded-lg border border-black/10 px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-blue-400`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{$()},disabled:z||!P.trim()||!C,className:`flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800 disabled:cursor-not-allowed disabled:opacity-50`,children:[z&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),z?`Encrypting…`:`Encrypt`]}),L!==null&&(0,g.jsx)(`p`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-600`,children:L}),F!==null&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,g.jsx)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:`Encrypted envelope`}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{F&&navigator.clipboard.writeText(F).then(()=>{H(!0),setTimeout(()=>{H(!1)},2e3)})},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:c,className:`text-[10px]`}),V?`Copied!`:`Copy`]})]}),(0,g.jsx)(`textarea`,{readOnly:!0,value:F,rows:5,className:`w-full rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 font-mono text-[11px] text-neutral-600 outline-none`})]})]}),(0,g.jsx)(`hr`,{className:`my-6 border-black/8`}),(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Validate an Encrypted Value`}),(0,g.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Paste an encrypted envelope to verify it is well-formed.`})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`validate-input`,className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Encrypted value`}),(0,g.jsx)(`textarea`,{id:`validate-input`,value:U,onChange:e=>{let t=e.target.value;W(t),K(null),Y(/[A-Za-z0-9+/=]{4,}\s+[A-Za-z0-9+/=]{4,}/.test(t))},placeholder:`Paste the { "encrypted": true, "value": "…" } JSON, or just the raw base64 value`,rows:4,className:`w-full rounded-lg border border-black/10 px-3 py-2 font-mono text-[11px] text-neutral-700 outline-none focus:ring-2 focus:ring-blue-400`})]}),le&&(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700`,children:[(0,g.jsx)(`span`,{children:`The pasted value contains whitespace inside the base64 string — a common copy-paste artifact from line-wrapped output.`}),(0,g.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-medium text-amber-800 underline hover:no-underline`,children:`Strip whitespace`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{he()},disabled:q||!U.trim(),className:`flex items-center justify-center gap-2 rounded-lg bg-neutral-700 px-4 py-2 text-[13px] font-medium text-white hover:bg-neutral-800 active:bg-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:[q&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),q?`Validating…`:`Validate`]}),G!==null&&(0,g.jsx)(`div`,{className:`rounded-lg border px-4 py-3 ${G.valid?`border-green-200 bg-green-50`:`border-red-200 bg-red-50`}`,children:G.error===void 0?(0,g.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,g.jsx)(`p`,{className:`text-[12px] font-semibold ${G.valid?`text-green-700`:`text-red-700`}`,children:G.valid?`All checks passed`:`Validation failed`}),(0,g.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:G.checks.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(s,{icon:e.pass?l:o,className:`w-3 shrink-0 text-[10px] ${e.pass?`text-green-600`:`text-red-500`}`}),(0,g.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:e.label})]}),(0,g.jsx)(`span`,{className:`font-mono text-[11px] ${e.pass?`text-neutral-500`:`text-red-600`}`,children:e.actual})]},e.label))})]}):(0,g.jsx)(`p`,{className:`text-[12px] text-red-600`,children:G.error})})]})]}):(0,g.jsx)(f,{children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center`,children:[(0,g.jsx)(s,{icon:n,className:`text-[22px] text-neutral-300`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-500`,children:`No credentials configured`}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[`A credential profile with a valid API key, user ID, and business ID is required to use this page. Set one up in`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:`~/.kizenappbuilder/credentials.json`}),` `,`and restart the server.`]})]})]})})};export{y as SecretsPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{A as t,C as n,F as r,I as i,M as a,N as o,P as s,f as c,i as l,p as ee,x as u}from"./fa-core-BSqLAjHu.js";import{t as te}from"./useParams-D3awshYI.js";import{t as ne}from"./useQuery-JKMI40WO.js";import{n as d}from"./CredentialsContext-BMg90DV1.js";import{t as re}from"./bootstrapQuery-CCNB4wuD.js";import{t as f}from"./Card-Sa52PGkn.js";import{t as p}from"./useLocalStorage-wp83IS34.js";var m=e(i(),1),h=`prod`,g=r();function _(e,t,n){return`secrets-pk::${e}::${t}::${n}`}function v(e,t,n){try{return localStorage.getItem(_(e,t,n))}catch{return null}}function ie(e,t,n,r){try{localStorage.setItem(_(e,t,n),r)}catch{}}var y=()=>{let{apiName:e}=te({from:`/$apiName/secrets`}),r=d(),{apiKey:i,userId:_,businessId:y,environment:b}=r,[x,S]=(0,m.useState)(h),[C,ae]=(0,m.useState)(!1),[w,oe]=p(`kizen-encryption-mode`,`local`),[T,E]=(0,m.useState)(null),[D,O]=(0,m.useState)(!1),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(null),[se,N]=(0,m.useState)(!1),[P,ce]=(0,m.useState)(``),[F,I]=(0,m.useState)(null),[L,R]=(0,m.useState)(null),[z,B]=(0,m.useState)(!1),[V,H]=(0,m.useState)(!1),[U,W]=(0,m.useState)(``),[G,K]=(0,m.useState)(null),[q,J]=(0,m.useState)(!1),[le,Y]=(0,m.useState)(!1),ue=!!(i&&_&&y),{isError:de,isLoading:X}=ne(re(r));(0,m.useEffect)(()=>{let e=!1;return fetch(`/api/encryption-target`).then(e=>e.json()).then(t=>{!e&&(t.target===`dev`||t.target===`prod`)&&S(t.target)}).catch(()=>{}).finally(()=>{e||ae(!0)}),()=>{e=!0}},[]),(0,m.useEffect)(()=>{if(!C)return;let t=v(e,b,x);E(t),O(t!==null)},[e,b,x,C]);let Z=()=>{I(null),R(null)},fe=e=>{oe(e),Z()},pe=e=>{S(e),Z(),fetch(`/api/encryption-target`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:e})}).catch(()=>{})},Q=async()=>{A(!0),M(null),E(null);try{let t=await fetch(`/api/wizard/get-public-key`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-api-key":i,"x-user-id":_,"x-business-id":y,"x-encryption-target":x,"x-auth-environment":b},body:JSON.stringify({api_name:e})}),n=await t.json();t.ok&&typeof n.public_key==`string`?(E(n.public_key),ie(e,b,x,n.public_key),O(!0)):M(typeof n.error==`string`?n.error:`Unexpected response (${String(t.status)})`)}catch(e){M(e.message)}finally{A(!1)}},$=async()=>{if(C&&!(!P.trim()||w===`local`&&!T)){B(!0),R(null),I(null);try{let t=w===`remote`?await fetch(`/api/wizard/encrypt`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-api-key":i,"x-user-id":_,"x-business-id":y,"x-encryption-target":x,"x-auth-environment":b},body:JSON.stringify({api_name:e,value:P})}):await fetch(`/api/local/encrypt`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publicKeyPem:T,value:P})}),n=await t.json();t.ok&&n.encrypted===!0&&typeof n.value==`string`?I(JSON.stringify({encrypted:!0,value:n.value},null,2)):R(typeof n.error==`string`?n.error:`Unexpected response (${String(t.status)})`)}catch(e){R(e.message)}finally{B(!1)}}},me=()=>{let e=U.replace(/\s+/g,``);try{let t=JSON.parse(e);W(JSON.stringify(t,null,2))}catch{W(e)}Y(!1),K(null)},he=async()=>{if(!U.trim())return;J(!0),K(null);let e=U.trim();try{let t=JSON.parse(e);typeof t.value==`string`&&(e=t.value)}catch{}try{K(await(await fetch(`/api/local/validate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({value:e})})).json())}catch(e){K({valid:!1,checks:[],error:e.message})}finally{J(!1)}};return ue?X?(0,g.jsx)(f,{children:(0,g.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,g.jsx)(s,{icon:t,className:`animate-spin text-[20px] text-neutral-300`})})}):de?(0,g.jsx)(f,{children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center`,children:[(0,g.jsx)(s,{icon:a,className:`text-[22px] text-amber-400`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-500`,children:`Authentication failed`}),(0,g.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Your credentials were rejected. Please enter valid credentials and refresh.`})]})]})}):(0,g.jsxs)(f,{children:[(0,g.jsxs)(`div`,{className:`mb-5 flex items-end justify-between gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`span`,{className:`block text-[12px] font-medium text-neutral-600`,children:`Encryption`}),(0,g.jsx)(`p`,{className:`mt-0.5 text-[11px] text-neutral-400`,children:`Where encryption runs, and which environment's keys secrets are encrypted against.`})]}),(0,g.jsxs)(`div`,{className:`flex shrink-0 items-end gap-3`,children:[(0,g.jsxs)(`div`,{role:`group`,"aria-label":`Encryption mode`,children:[(0,g.jsx)(`span`,{className:`mb-1 block text-[11px] font-medium text-neutral-500`,children:`Mode`}),(0,g.jsx)(`div`,{className:`flex overflow-hidden rounded-lg border border-black/10 text-[12px] font-medium`,children:[`local`,`remote`].map(e=>(0,g.jsx)(`button`,{type:`button`,"aria-pressed":w===e,onClick:()=>{fe(e)},className:`px-2.5 py-1.5 transition-colors ${w===e?`bg-neutral-700 text-white`:`bg-white text-neutral-500 hover:bg-neutral-100`}`,children:e===`local`?`Local`:`Remote`},e))})]}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`enc-target`,className:`mb-1 block text-[11px] font-medium text-neutral-500`,children:`Keys`}),(0,g.jsxs)(`select`,{id:`enc-target`,value:x,onChange:e=>{pe(e.target.value)},className:`rounded-lg border border-black/10 bg-white px-2 py-1.5 text-[12px] text-neutral-700 outline-none focus:ring-2 focus:ring-blue-400`,children:[(0,g.jsx)(`option`,{value:`prod`,children:`Prod`}),(0,g.jsx)(`option`,{value:`dev`,children:`Dev`})]})]})]})]}),x===`dev`&&(0,g.jsxs)(`div`,{className:`mb-5 flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-700`,children:[(0,g.jsx)(s,{icon:a,className:`shrink-0 text-[11px]`}),(0,g.jsxs)(`span`,{children:[(0,g.jsx)(`strong`,{className:`font-semibold`,children:`Dev keys selected.`}),` Be sure you know what you're doing — most apps use the production encryption service. Secrets encrypted with dev keys won't decrypt in production.`]})]}),(0,g.jsx)(`hr`,{className:`mb-6 border-black/8`}),w===`local`&&(0,g.jsxs)(g.Fragment,{children:[T!==null&&D?(0,g.jsxs)(`div`,{className:`flex items-center justify-between rounded-lg border border-black/8 bg-neutral-50 px-3 py-2.5`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,g.jsx)(s,{icon:l,className:`text-[11px] text-green-600`}),(0,g.jsx)(`span`,{className:`text-[12px] font-medium text-neutral-700`,children:`Public key loaded`})]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`button`,{type:`button`,onClick:()=>{O(!1)},className:`rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:`Show`}),(0,g.jsx)(`span`,{className:`text-neutral-300`,children:`·`}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{Q()},disabled:k,className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-neutral-500 hover:bg-neutral-100 disabled:opacity-50`,children:[k&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[10px]`}),`Refresh`]})]})]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Public Key`}),T!==null&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>{O(!0)},className:`text-[11px] font-medium text-neutral-400 hover:text-neutral-600`,children:`Collapse`})]}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[`Fetch the public key for`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:e}),`. Required for encryption below.`]})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Plugin`}),(0,g.jsx)(`div`,{className:`rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 text-[13px] text-neutral-500`,children:e})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{Q()},disabled:k,className:`flex items-center justify-center gap-2 rounded-lg bg-neutral-700 px-4 py-2 text-[13px] font-medium text-white hover:bg-neutral-800 active:bg-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:[k&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),k?`Fetching…`:T===null?`Get Public Key`:`Refresh Key`]}),j!==null&&(0,g.jsx)(`p`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-600`,children:j}),T!==null&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,g.jsx)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:`Public key (PEM)`}),(0,g.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{T&&navigator.clipboard.writeText(T).then(()=>{N(!0),setTimeout(()=>{N(!1)},2e3)})},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:c,className:`text-[10px]`}),se?`Copied!`:`Copy`]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{if(!T)return;let t=new Blob([T],{type:`text/plain`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}-${b}-${x}-public-key.pem`,r.click(),URL.revokeObjectURL(n)},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:ee,className:`text-[10px]`}),`Download`]})]})]}),(0,g.jsx)(`textarea`,{readOnly:!0,value:T,rows:5,className:`w-full rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 font-mono text-[11px] text-neutral-600 outline-none`})]})]})]}),(0,g.jsx)(`hr`,{className:`my-6 border-black/8`})]}),(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Encrypt a Secret`}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[w===`remote`?`Encrypts a secret via the remote plugin-wizard API. `:`Encrypts a secret in-process using the public key. `,`Output is ready to paste into`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:`kizen.json`}),`.`]})]}),w===`local`&&T===null?(0,g.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2.5 text-[12px] text-amber-700`,children:[(0,g.jsx)(s,{icon:u,className:`shrink-0 text-[11px]`}),`Fetch the public key above first, or switch to Remote mode.`]}):(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`secret-value`,className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Secret value`}),(0,g.jsx)(`input`,{id:`secret-value`,type:`password`,value:P,onChange:e=>{ce(e.target.value)},onKeyDown:e=>{e.key===`Enter`&&$()},placeholder:`Enter the plaintext secret…`,className:`w-full rounded-lg border border-black/10 px-3 py-2 text-[13px] outline-none focus:ring-2 focus:ring-blue-400`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{$()},disabled:z||!P.trim()||!C,className:`flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-4 py-2 text-[13px] font-medium text-white hover:bg-blue-700 active:bg-blue-800 disabled:cursor-not-allowed disabled:opacity-50`,children:[z&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),z?`Encrypting…`:`Encrypt`]}),L!==null&&(0,g.jsx)(`p`,{className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-600`,children:L}),F!==null&&(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`div`,{className:`mb-1 flex items-center justify-between`,children:[(0,g.jsx)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:`Encrypted envelope`}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{F&&navigator.clipboard.writeText(F).then(()=>{H(!0),setTimeout(()=>{H(!1)},2e3)})},className:`flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium text-blue-600 hover:bg-blue-50`,children:[(0,g.jsx)(s,{icon:c,className:`text-[10px]`}),V?`Copied!`:`Copy`]})]}),(0,g.jsx)(`textarea`,{readOnly:!0,value:F,rows:5,className:`w-full rounded-lg border border-black/10 bg-neutral-50 px-3 py-2 font-mono text-[11px] text-neutral-600 outline-none`})]})]}),(0,g.jsx)(`hr`,{className:`my-6 border-black/8`}),(0,g.jsxs)(`div`,{className:`mb-5`,children:[(0,g.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900`,children:`Validate an Encrypted Value`}),(0,g.jsx)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:`Paste an encrypted envelope to verify it is well-formed.`})]}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`label`,{htmlFor:`validate-input`,className:`mb-1 block text-[12px] font-medium text-neutral-600`,children:`Encrypted value`}),(0,g.jsx)(`textarea`,{id:`validate-input`,value:U,onChange:e=>{let t=e.target.value;W(t),K(null),Y(/[A-Za-z0-9+/=]{4,}\s+[A-Za-z0-9+/=]{4,}/.test(t))},placeholder:`Paste the { "encrypted": true, "value": "…" } JSON, or just the raw base64 value`,rows:4,className:`w-full rounded-lg border border-black/10 px-3 py-2 font-mono text-[11px] text-neutral-700 outline-none focus:ring-2 focus:ring-blue-400`})]}),le&&(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-700`,children:[(0,g.jsx)(`span`,{children:`The pasted value contains whitespace inside the base64 string — a common copy-paste artifact from line-wrapped output.`}),(0,g.jsx)(`button`,{type:`button`,onClick:me,className:`shrink-0 rounded px-2 py-0.5 text-[11px] font-medium text-amber-800 underline hover:no-underline`,children:`Strip whitespace`})]}),(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{he()},disabled:q||!U.trim(),className:`flex items-center justify-center gap-2 rounded-lg bg-neutral-700 px-4 py-2 text-[13px] font-medium text-white hover:bg-neutral-800 active:bg-neutral-900 disabled:cursor-not-allowed disabled:opacity-50`,children:[q&&(0,g.jsx)(s,{icon:t,className:`animate-spin text-[12px]`}),q?`Validating…`:`Validate`]}),G!==null&&(0,g.jsx)(`div`,{className:`rounded-lg border px-4 py-3 ${G.valid?`border-green-200 bg-green-50`:`border-red-200 bg-red-50`}`,children:G.error===void 0?(0,g.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,g.jsx)(`p`,{className:`text-[12px] font-semibold ${G.valid?`text-green-700`:`text-red-700`}`,children:G.valid?`All checks passed`:`Validation failed`}),(0,g.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:G.checks.map(e=>(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,g.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,g.jsx)(s,{icon:e.pass?l:o,className:`w-3 shrink-0 text-[10px] ${e.pass?`text-green-600`:`text-red-500`}`}),(0,g.jsx)(`span`,{className:`text-[11px] text-neutral-600`,children:e.label})]}),(0,g.jsx)(`span`,{className:`font-mono text-[11px] ${e.pass?`text-neutral-500`:`text-red-600`}`,children:e.actual})]},e.label))})]}):(0,g.jsx)(`p`,{className:`text-[12px] text-red-600`,children:G.error})})]})]}):(0,g.jsx)(f,{children:(0,g.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8 text-center`,children:[(0,g.jsx)(s,{icon:n,className:`text-[22px] text-neutral-300`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-500`,children:`No credentials configured`}),(0,g.jsxs)(`p`,{className:`mt-1 text-[12px] text-neutral-400`,children:[`A credential profile with a valid API key, user ID, and business ID is required to use this page. Set one up in`,` `,(0,g.jsx)(`code`,{className:`rounded bg-neutral-100 px-1 py-0.5 text-[11px]`,children:`~/.kizenappbuilder/credentials.json`}),` `,`and restart the server.`]})]})]})})};export{y as SecretsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n}from"./fa-core-BSqLAjHu.js";import{s as r}from"./api-C4R44YCL.js";import{t as i}from"./Tooltip-JYkgiL8J.js";var a=e(n(),1),o=(e,t)=>{let[n,i]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e){i(null);return}let n=!1;return r(e,t).then(e=>{n||i(e)}).catch(()=>{n||i(null)}),()=>{n=!0}},[e,t]),n},s=t(),c=({when:e,whenState:t})=>{let n=o(e,t);return n===null?null:(0,s.jsx)(i,{text:e,children:(0,s.jsxs)(`span`,{className:`font-mono text-[10px] ${n?`text-green-600`:`text-amber-600`}`,children:[n?`enabled`:`disabled`,` by condition`]})})};export{o as n,c as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{F as t,I as n}from"./fa-core-BSqLAjHu.js";import{s as r}from"./api-CW7z0-aU.js";import{t as i}from"./Tooltip-JYkgiL8J.js";var a=e(n(),1),o=(e,t)=>{let[n,i]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e){i(null);return}let n=!1;return r(e,t).then(e=>{n||i(e)}).catch(()=>{n||i(null)}),()=>{n=!0}},[e,t]),n},s=t(),c=({when:e,whenState:t})=>{let n=o(e,t);return n===null?null:(0,s.jsx)(i,{text:e,children:(0,s.jsxs)(`span`,{className:`font-mono text-[10px] ${n?`text-green-600`:`text-amber-600`}`,children:[n?`enabled`:`disabled`,` by condition`]})})};export{o as n,c as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t}from"./fa-core-BSqLAjHu.js";import{n}from"./CredentialsContext-p3i8s7a6.js";var r=e(t(),1),i={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.com/api`,integration:`https://integration.kizen.dev/api`,test1:`https://test1.kizen.dev/api`},a={go:`https://go.kizen.com`,fmo:`https://fmo.kizen.com`,staging:`https://v2.staging.kizen.com`,integration:`https://v2.integration.kizen.dev`,test1:`https://test1.kizen.dev`},o=new Set([`get`,`delete`,`head`]),s=class extends Error{code;request;response;__isMock=!0;constructor({code:e,request:t,response:n}){super(`Request failed with status ${String(e)}`),this.code=e,this.request=t,this.response=n}},c=e=>typeof e==`object`&&!!e&&`__isMock`in e,l=async(e,t,n,r,i)=>{let a=r!=null,o=r instanceof FormData||r instanceof Blob,c=a&&!o?{"Content-Type":`application/json`,...i?.headers}:i?.headers,l=await e(n,{method:t,...a&&{body:o?r:JSON.stringify(r)},...c&&{headers:c}});if(!l.ok)throw new s({code:l.status,request:{method:t.toUpperCase(),url:n,body:r,headers:c},response:{data:{error:`Request failed with status ${String(l.status)}`},status:l.status}});return l.status===204||l.headers.get(`content-length`)===`0`?{}:await l.json()};function u(e){return{get:(t,n)=>l(e,`GET`,t,void 0,n),delete:(t,n)=>l(e,`DELETE`,t,void 0,n),head:(t,n)=>l(e,`HEAD`,t,void 0,n),post:(t,n,r)=>l(e,`POST`,t,n,r),put:(t,n,r)=>l(e,`PUT`,t,n,r),patch:(t,n,r)=>l(e,`PATCH`,t,n,r),request:(t,n,r,i)=>{let a=t.toLowerCase(),s=o.has(a)?r:i,c=o.has(a)?void 0:r;return l(e,t.toUpperCase(),n,c,s)}}}var d={QUERY_REQUEST:`query:request`,UI_OUTPUT:`outputui`,IFRAME_OUTPUT:`iframeoutput`,POSTFORMDATA_REQUEST:`postformdata:request`,SETSTATE:`setstate`,DONE:`done`,RUN:`run`,OPEN_WINDOW:`openwindow`,COMMUNICATE:`communicate`,HIDE:`hide`,SHOW:`show`,EXPAND:`expand`,COLLAPSE:`collapse`,HIDE_HEADER:`hideheader`,SHOW_HEADER:`showheader`,OPEN_CREATE_RECORD_MODAL_REQUEST:`opencreaterecordmodal:request`,OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:`opencreaterelatedrecordmodal:request`,SHOW_TOAST:`showtoast`,CLEAR_TOASTS:`cleartoasts`,REFRESH_TIMELINE:`refreshtimeline`,REFRESH_ENTITY:`refreshentity`,UPLOADFILE_REQUEST:`uploadfile:request`,UPDATE_SESSION_DATA:`updatesessiondata`,INSTALL_THIRD_PARTY_SCRIPT_REQUEST:`installthirdpartyscript:request`,PROMPT_REQUEST:`prompt:request`,DYNAMIC_PROMPT_REQUEST:`dynamicprompt:request`,RELEASE_BLOCKING_SCRIPT:`releaseblockingscript`,AUTHORIZE:`authorize`,COPY_TO_CLIPBOARD:`copytoclipboard`,SHOW_VIEW_IN_MODAL_REQUEST:`showviewinmodal:request`,CLOSE_MODAL_REQUEST:`closemodal:request`,CONSOLE_LOG:`consolelog`,RUN_EVENT_SCRIPT:`runeventscript`,COMPLETE_SETUP_REQUEST:`completesetup:request`},f={QUERY_RESPONSE:`query:response`,POSTFORMDATA_RESPONSE:`postformdata:response`,ERROR:`error`,UPLOADFILE_RESPONSE:`uploadfile:response`,UPLOADFILE_PROGRESS:`uploadfile:progress`,INSTALL_THIRD_PARTY_SCRIPT_RESPONSE:`installthirdpartyscript:response`,PROMPT_RESPONSE:`prompt:response`,REFRESH_ENTITY_RESPONSE:`refreshentity:response`,CREATE_RECORD_RESPONSE:`createrecord:response`,CREATE_RELATED_RECORD_RESPONSE:`createrelatedrecord:response`,COMPLETE_SETUP_RESPONSE:`completesetup:response`},p={RUN_FRAME_SCRIPT:`runframescript`,RUN_BLOCK_SCRIPT:`runblockscript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},m=`integration:route-change`,h=`kizen-route-change`,g=`kzn-integration-frame`,_=[`__plugin_engine`,`1.10.0`],v={CALENDAR_SOURCE_CALENDAR_LIST:(e,t)=>[..._,`calendar-source`,`calendar-list`,e,t],CALENDAR_SOURCE_EVENTS:(e,t,n,r)=>[..._,`calendar-source`,`events`,e,t,n,r]},y=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,b=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,x={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},S=e=>{if(y.test(e))return x.FRESHWORKS;if(b.test(e))return x.INTERCOM},C={[x.FRESHWORKS]:`FreshworksWidget`,[x.INTERCOM]:`Intercom`},w={[x.FRESHWORKS]:e=>{window.fwSettings={widget_id:e.widgetId},(function(...e){if(typeof window[C[x.FRESHWORKS]]!=`function`){let t=function(){t.q.push(...e)};t.__kizen_pending=!0,t.q=[],window[C[x.FRESHWORKS]]=t}})()},[x.INTERCOM]:()=>{(function(){if(typeof window[C[x.INTERCOM]]!=`function`){let e=window,t=function(){t.c(arguments)};t.q=[],t.c=function(e){t.q.push(e)},t.__kizen_pending=!0,e[C[x.INTERCOM]]=t}})()}},T={[x.FRESHWORKS]:()=>window[C[x.FRESHWORKS]]?.__kizen_pending!==!0,[x.INTERCOM]:()=>window[C[x.INTERCOM]]?.__kizen_pending!==!0},E=()=>({host:window.location.host,hash:window.location.hash,href:window.location.href,origin:window.location.origin,pathname:window.location.pathname,search:window.location.search,port:window.location.port,protocol:window.location.protocol}),ee=()=>{let e=new Date().getTime();return typeof performance<`u`&&typeof performance.now==`function`&&(e+=performance.now()),`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t===`x`?n:n&3|8).toString(16)})};Object.getPrototypeOf(async function(){}).constructor;var te=e=>`${e?.plugin_api_name??``}-${e?.id??``}-${e?.api_name??``}-${e?.script_id??``}`,D=e=>typeof e==`object`&&!!e&&`__kzConsole`in e,O=/^\/(.*)\/([dgimsuvy]*)$/,k=e=>{try{if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(k);if(D(e))switch(e.__kzConsole){case`undefined`:return;case`bigint`:try{return BigInt(e.value)}catch{return e.value}case`symbol`:return e.value;case`function`:return`[Function: ${e.name}]`;case`error`:{let t=Error(e.message);return t.name=e.name,e.stack&&(t.stack=e.stack),t}case`date`:return new Date(e.value);case`regexp`:{let t=O.exec(e.value);if(!t)return e.value;try{return new RegExp(t[1]??``,t[2])}catch{return e.value}}case`circular`:return`[Circular]`;case`unserializable`:return`[Unserializable: ${e.reason}]`}let t={};for(let[n,r]of Object.entries(e))t[n]=k(r);return t}catch{return`[Unserializable]`}},A=class e extends Error{proxyStatus;upstreamStatus;upstreamResponse;constructor(t,n,r,i){super(i??r?.error?.message??(n?`Request failed with status code ${String(n)}`:`Request failed with proxy status code ${String(t)}`)),this.name=`KizenRequestError`,this.proxyStatus=t,this.upstreamStatus=n,this.upstreamResponse=r,Object.setPrototypeOf(this,e.prototype)}},ne=`__kizen__action__`,re=`__kizen__actionmenu__`,j=e=>`${ne}${e}`,M=e=>`${re}${e}`,N=(e,t)=>`${M(e)}_${t}`,ie=e=>e.startsWith(re),P=e=>e.startsWith(ne),F=e=>{if(!ie(e))return{actionApiName:``,objectId:``};let t=e.slice(re.length),n=t.lastIndexOf(`_`);return n===-1?{actionApiName:``,objectId:``}:{actionApiName:t.slice(0,n),objectId:t.slice(n+1)}},I=e=>({key:j(e.api_name),type:`custom_object`,label:e.name,allow_multiple:!0}),ae=[`description`,`container`,`qr`,`image`,`link`],L=(e,t)=>{let n=(e.fields??[]).filter(e=>!ae.includes(e.type)).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>L(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...I(e),match_hint:e.hint_object_name??``}))]},oe=(e,t)=>{let n=L(e).reduce((e,t)=>({...e,[t.key]:t}),{}),r=Object.keys(t),i={};return r.forEach(e=>{let r=t[e],a=n[e];if(a?.type){switch(a.type){case`boolean`:let t=r;if(!t)return;i[e]=t.value;return;case`custom_object`:{let t=r;if(!t)return;i[e]={objectId:t.value?.id,objectName:t.value?.objectName};return}case`field`:{let t=r;if(!t?.value)return;Array.isArray(t.value)?i[e]=t.value.map(e=>({fieldId:e.value,fieldName:e.label,objectId:t.associatedObject?.id,objectName:t.associatedObject?.name})):typeof t.value==`object`&&typeof t.associatedObject==`object`&&(i[e]={fieldId:t.value.value,fieldName:t.value.label,objectId:t.associatedObject.id,objectName:t.associatedObject.name});return}case`number`:{let t=r;if(!t)return;try{let n=Number(t.value);if(!n&&n!==0)return;i[e]=n}catch{i[e]=NaN}return}case`select`:{let t=r;if(!t)return;i[e]=t.value;return}case`radio`:{let t=r;if(!t?.value)return;i[e]=t.value;return}case`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:case`qr`:case`image`:case`link`:case`api_key`:return}return r?.value}}),i},se=`plugin-assets.kizen.dev`,R=`plugin-assets.kizen.com`,ce=[se,R],le=``,ue=le!==``,de=e=>ue&&e===le||ce.some(t=>e===`https://${t}`),fe=e=>{try{return de(new URL(e).origin)}catch{return!1}},pe=e=>{let t=e.data;if(!de(e.origin))return{handled:!0,data:t};let n=t;return typeof t!=`object`||!t||n.event!==`message`?{handled:!1}:{handled:!0,data:n.data}},z=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],me=[`allow-popups`,`allow-scripts`,`allow-same-origin`],he={useDevMode:!1,__dangerouslySkipProxy:!1},B=(e,t=he,n=``)=>{let{useDevMode:r,__dangerouslySkipProxy:i}=t,a=``;if(i)a=e;else try{a=de(new URL(e).origin)?e:`${ue?le:`https://${r?se:R}`}?url=${encodeURIComponent(e)}&allow=${encodeURIComponent(n)}`}catch(t){console.warn(`Failed to parse URL: ${e}. Apps should not attempt to display invalid URLs. Error: ${t.message}`),a=``}let o=fe(a);return{url:a,isUsingProxy:o}},ge=e=>e.filter(e=>z.some(t=>e.startsWith(t))),_e=e=>e.filter(e=>me.includes(e)),ve=()=>z.map(e=>`${e} *`).join(`; `),ye=Object.create,be=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Se=Object.getOwnPropertyNames,Ce=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty,H=(e,t)=>function(){return t||(0,e[Se(e)[0]])((t={exports:{}}).exports,t),t.exports},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Se(t))!V.call(e,i)&&i!==n&&be(e,i,{get:()=>t[i],enumerable:!(r=xe(t,i))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:ye(Ce(e)),we(t||!e||!e.__esModule?be(n,`default`,{value:e,enumerable:!0}):n,e));function Ee(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function De(e){if(Array.isArray(e))return e}function Oe(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function ke(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{I as t}from"./fa-core-BSqLAjHu.js";import{n}from"./CredentialsContext-BMg90DV1.js";var r=e(t(),1),i={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.com/api`,"e2e-staging":`https://app.e2e-staging.kizen.com/api`,integration:`https://integration.kizen.dev/api`,"e2e-integration":`https://e2e-integration.kizen.dev/api`,test1:`https://app.test1.kizen.dev/api`,perf:`https://app.perf.kizen.dev/api`},a={go:`https://go.kizen.com`,fmo:`https://fmo.kizen.com`,staging:`https://v2.staging.kizen.com`,"e2e-staging":`https://e2e-staging.kizen.com`,integration:`https://v2.integration.kizen.dev`,"e2e-integration":`https://v2.e2e-integration.kizen.dev`,test1:`https://test1.kizen.dev`,perf:`https://perf.kizen.dev`},o=new Set([`get`,`delete`,`head`]),s=class extends Error{code;request;response;__isMock=!0;constructor({code:e,request:t,response:n}){super(`Request failed with status ${String(e)}`),this.code=e,this.request=t,this.response=n}},c=e=>typeof e==`object`&&!!e&&`__isMock`in e,l=async(e,t,n,r,i)=>{let a=r!=null,o=r instanceof FormData||r instanceof Blob,c=a&&!o?{"Content-Type":`application/json`,...i?.headers}:i?.headers,l=await e(n,{method:t,...a&&{body:o?r:JSON.stringify(r)},...c&&{headers:c}});if(!l.ok)throw new s({code:l.status,request:{method:t.toUpperCase(),url:n,body:r,headers:c},response:{data:{error:`Request failed with status ${String(l.status)}`},status:l.status}});return l.status===204||l.headers.get(`content-length`)===`0`?{}:await l.json()};function u(e){return{get:(t,n)=>l(e,`GET`,t,void 0,n),delete:(t,n)=>l(e,`DELETE`,t,void 0,n),head:(t,n)=>l(e,`HEAD`,t,void 0,n),post:(t,n,r)=>l(e,`POST`,t,n,r),put:(t,n,r)=>l(e,`PUT`,t,n,r),patch:(t,n,r)=>l(e,`PATCH`,t,n,r),request:(t,n,r,i)=>{let a=t.toLowerCase(),s=o.has(a)?r:i,c=o.has(a)?void 0:r;return l(e,t.toUpperCase(),n,c,s)}}}var d={QUERY_REQUEST:`query:request`,UI_OUTPUT:`outputui`,IFRAME_OUTPUT:`iframeoutput`,POSTFORMDATA_REQUEST:`postformdata:request`,SETSTATE:`setstate`,DONE:`done`,RUN:`run`,OPEN_WINDOW:`openwindow`,COMMUNICATE:`communicate`,HIDE:`hide`,SHOW:`show`,EXPAND:`expand`,COLLAPSE:`collapse`,HIDE_HEADER:`hideheader`,SHOW_HEADER:`showheader`,OPEN_CREATE_RECORD_MODAL_REQUEST:`opencreaterecordmodal:request`,OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:`opencreaterelatedrecordmodal:request`,SHOW_TOAST:`showtoast`,CLEAR_TOASTS:`cleartoasts`,REFRESH_TIMELINE:`refreshtimeline`,REFRESH_ENTITY:`refreshentity`,UPLOADFILE_REQUEST:`uploadfile:request`,UPDATE_SESSION_DATA:`updatesessiondata`,INSTALL_THIRD_PARTY_SCRIPT_REQUEST:`installthirdpartyscript:request`,PROMPT_REQUEST:`prompt:request`,DYNAMIC_PROMPT_REQUEST:`dynamicprompt:request`,RELEASE_BLOCKING_SCRIPT:`releaseblockingscript`,AUTHORIZE:`authorize`,COPY_TO_CLIPBOARD:`copytoclipboard`,SHOW_VIEW_IN_MODAL_REQUEST:`showviewinmodal:request`,CLOSE_MODAL_REQUEST:`closemodal:request`,CONSOLE_LOG:`consolelog`,RUN_EVENT_SCRIPT:`runeventscript`,COMPLETE_SETUP_REQUEST:`completesetup:request`},f={QUERY_RESPONSE:`query:response`,POSTFORMDATA_RESPONSE:`postformdata:response`,ERROR:`error`,UPLOADFILE_RESPONSE:`uploadfile:response`,UPLOADFILE_PROGRESS:`uploadfile:progress`,INSTALL_THIRD_PARTY_SCRIPT_RESPONSE:`installthirdpartyscript:response`,PROMPT_RESPONSE:`prompt:response`,REFRESH_ENTITY_RESPONSE:`refreshentity:response`,CREATE_RECORD_RESPONSE:`createrecord:response`,CREATE_RELATED_RECORD_RESPONSE:`createrelatedrecord:response`,COMPLETE_SETUP_RESPONSE:`completesetup:response`},p={RUN_FRAME_SCRIPT:`runframescript`,RUN_BLOCK_SCRIPT:`runblockscript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},m=`integration:route-change`,h=`kizen-route-change`,g=`kzn-integration-frame`,_=[`__plugin_engine`,`1.10.0`],v={CALENDAR_SOURCE_CALENDAR_LIST:(e,t)=>[..._,`calendar-source`,`calendar-list`,e,t],CALENDAR_SOURCE_EVENTS:(e,t,n,r)=>[..._,`calendar-source`,`events`,e,t,n,r]},y=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,b=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,x={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},S=e=>{if(y.test(e))return x.FRESHWORKS;if(b.test(e))return x.INTERCOM},C={[x.FRESHWORKS]:`FreshworksWidget`,[x.INTERCOM]:`Intercom`},w={[x.FRESHWORKS]:e=>{window.fwSettings={widget_id:e.widgetId},(function(...e){if(typeof window[C[x.FRESHWORKS]]!=`function`){let t=function(){t.q.push(...e)};t.__kizen_pending=!0,t.q=[],window[C[x.FRESHWORKS]]=t}})()},[x.INTERCOM]:()=>{(function(){if(typeof window[C[x.INTERCOM]]!=`function`){let e=window,t=function(){t.c(arguments)};t.q=[],t.c=function(e){t.q.push(e)},t.__kizen_pending=!0,e[C[x.INTERCOM]]=t}})()}},T={[x.FRESHWORKS]:()=>window[C[x.FRESHWORKS]]?.__kizen_pending!==!0,[x.INTERCOM]:()=>window[C[x.INTERCOM]]?.__kizen_pending!==!0},E=()=>({host:window.location.host,hash:window.location.hash,href:window.location.href,origin:window.location.origin,pathname:window.location.pathname,search:window.location.search,port:window.location.port,protocol:window.location.protocol}),ee=()=>{let e=new Date().getTime();return typeof performance<`u`&&typeof performance.now==`function`&&(e+=performance.now()),`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t===`x`?n:n&3|8).toString(16)})};Object.getPrototypeOf(async function(){}).constructor;var te=e=>`${e?.plugin_api_name??``}-${e?.id??``}-${e?.api_name??``}-${e?.script_id??``}`,D=e=>typeof e==`object`&&!!e&&`__kzConsole`in e,O=/^\/(.*)\/([dgimsuvy]*)$/,k=e=>{try{if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(k);if(D(e))switch(e.__kzConsole){case`undefined`:return;case`bigint`:try{return BigInt(e.value)}catch{return e.value}case`symbol`:return e.value;case`function`:return`[Function: ${e.name}]`;case`error`:{let t=Error(e.message);return t.name=e.name,e.stack&&(t.stack=e.stack),t}case`date`:return new Date(e.value);case`regexp`:{let t=O.exec(e.value);if(!t)return e.value;try{return new RegExp(t[1]??``,t[2])}catch{return e.value}}case`circular`:return`[Circular]`;case`unserializable`:return`[Unserializable: ${e.reason}]`}let t={};for(let[n,r]of Object.entries(e))t[n]=k(r);return t}catch{return`[Unserializable]`}},A=class e extends Error{proxyStatus;upstreamStatus;upstreamResponse;constructor(t,n,r,i){super(i??r?.error?.message??(n?`Request failed with status code ${String(n)}`:`Request failed with proxy status code ${String(t)}`)),this.name=`KizenRequestError`,this.proxyStatus=t,this.upstreamStatus=n,this.upstreamResponse=r,Object.setPrototypeOf(this,e.prototype)}},ne=`__kizen__action__`,re=`__kizen__actionmenu__`,j=e=>`${ne}${e}`,M=e=>`${re}${e}`,N=(e,t)=>`${M(e)}_${t}`,ie=e=>e.startsWith(re),P=e=>e.startsWith(ne),F=e=>{if(!ie(e))return{actionApiName:``,objectId:``};let t=e.slice(re.length),n=t.lastIndexOf(`_`);return n===-1?{actionApiName:``,objectId:``}:{actionApiName:t.slice(0,n),objectId:t.slice(n+1)}},I=e=>({key:j(e.api_name),type:`custom_object`,label:e.name,allow_multiple:!0}),ae=[`description`,`container`,`qr`,`image`,`link`],L=(e,t)=>{let n=(e.fields??[]).filter(e=>!ae.includes(e.type)).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>L(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...I(e),match_hint:e.hint_object_name??``}))]},oe=(e,t)=>{let n=L(e).reduce((e,t)=>({...e,[t.key]:t}),{}),r=Object.keys(t),i={};return r.forEach(e=>{let r=t[e],a=n[e];if(a?.type){switch(a.type){case`boolean`:let t=r;if(!t)return;i[e]=t.value;return;case`custom_object`:{let t=r;if(!t)return;i[e]={objectId:t.value?.id,objectName:t.value?.objectName};return}case`field`:{let t=r;if(!t?.value)return;Array.isArray(t.value)?i[e]=t.value.map(e=>({fieldId:e.value,fieldName:e.label,objectId:t.associatedObject?.id,objectName:t.associatedObject?.name})):typeof t.value==`object`&&typeof t.associatedObject==`object`&&(i[e]={fieldId:t.value.value,fieldName:t.value.label,objectId:t.associatedObject.id,objectName:t.associatedObject.name});return}case`number`:{let t=r;if(!t)return;try{let n=Number(t.value);if(!n&&n!==0)return;i[e]=n}catch{i[e]=NaN}return}case`select`:{let t=r;if(!t)return;i[e]=t.value;return}case`radio`:{let t=r;if(!t?.value)return;i[e]=t.value;return}case`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:case`qr`:case`image`:case`link`:case`api_key`:return}return r?.value}}),i},se=`plugin-assets.kizen.dev`,R=`plugin-assets.kizen.com`,ce=[se,R],le=``,ue=le!==``,de=e=>ue&&e===le||ce.some(t=>e===`https://${t}`),fe=e=>{try{return de(new URL(e).origin)}catch{return!1}},pe=e=>{let t=e.data;if(!de(e.origin))return{handled:!0,data:t};let n=t;return typeof t!=`object`||!t||n.event!==`message`?{handled:!1}:{handled:!0,data:n.data}},z=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],me=[`allow-popups`,`allow-scripts`,`allow-same-origin`],he={useDevMode:!1,__dangerouslySkipProxy:!1},B=(e,t=he,n=``)=>{let{useDevMode:r,__dangerouslySkipProxy:i}=t,a=``;if(i)a=e;else try{a=de(new URL(e).origin)?e:`${ue?le:`https://${r?se:R}`}?url=${encodeURIComponent(e)}&allow=${encodeURIComponent(n)}`}catch(t){console.warn(`Failed to parse URL: ${e}. Apps should not attempt to display invalid URLs. Error: ${t.message}`),a=``}let o=fe(a);return{url:a,isUsingProxy:o}},ge=e=>e.filter(e=>z.some(t=>e.startsWith(t))),_e=e=>e.filter(e=>me.includes(e)),ve=()=>z.map(e=>`${e} *`).join(`; `),ye=Object.create,be=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,Se=Object.getOwnPropertyNames,Ce=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty,H=(e,t)=>function(){return t||(0,e[Se(e)[0]])((t={exports:{}}).exports,t),t.exports},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of Se(t))!V.call(e,i)&&i!==n&&be(e,i,{get:()=>t[i],enumerable:!(r=xe(t,i))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:ye(Ce(e)),we(t||!e||!e.__esModule?be(n,`default`,{value:e,enumerable:!0}):n,e));function Ee(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function De(e){if(Array.isArray(e))return e}function Oe(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function ke(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function U(e,t){return De(e)||Oe(e,t)||Ae(e,t)||ke()}function Ae(e,t){if(e){if(typeof e==`string`)return Ee(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ee(e,t):void 0}}var je=Object.entries,Me=Object.setPrototypeOf,Ne=Object.isFrozen,Pe=Object.getPrototypeOf,Fe=Object.getOwnPropertyDescriptor,W=Object.freeze,G=Object.seal,Ie=Object.create,Le=typeof Reflect<`u`&&Reflect,Re=Le.apply,ze=Le.construct;W||=function(e){return e},G||=function(e){return e},Re||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},ze||=function(e){return new e(...[...arguments].slice(1))};var Be=X(Array.prototype.forEach),Ve=X(Array.prototype.lastIndexOf),He=X(Array.prototype.pop),Ue=X(Array.prototype.push),We=X(Array.prototype.splice),K=Array.isArray,Ge=X(String.prototype.toLowerCase),Ke=X(String.prototype.toString),qe=X(String.prototype.match),Je=X(String.prototype.replace),Ye=X(String.prototype.indexOf),Xe=X(String.prototype.trim),q=X(Number.prototype.toString),Ze=X(Boolean.prototype.toString),Qe=typeof BigInt>`u`?null:X(BigInt.prototype.toString),$e=typeof Symbol>`u`?null:X(Symbol.prototype.toString),J=X(Object.prototype.hasOwnProperty),et=X(Object.prototype.toString),Y=X(RegExp.prototype.test),tt=nt(TypeError);function X(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Re(e,t,n)}}function nt(e){return function(){return ze(e,[...arguments])}}function Z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ge;if(Me&&Me(e,null),!K(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ne(t)||(t[r]=e),i=e)}e[i]=!0}return e}function rt(e){for(let t=0;t<e.length;t++)J(e,t)||(e[t]=null);return e}function Q(e){let t=Ie(null);for(let r of je(e)){var n=U(r,2);let i=n[0],a=n[1];J(e,i)&&(K(a)?t[i]=rt(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Q(a):t[i]=a)}return t}function it(e){switch(typeof e){case`string`:return e;case`number`:return q(e);case`boolean`:return Ze(e);case`bigint`:return Qe?Qe(e):`0`;case`symbol`:return $e?$e(e):`Symbol()`;case`undefined`:return et(e);case`function`:case`object`:{if(e===null)return et(e);let t=e,n=at(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:et(e)}return et(e)}default:return et(e)}}function at(e,t){for(;e!==null;){let n=Fe(e,t);if(n){if(n.get)return X(n.get);if(typeof n.value==`function`)return X(n.value)}e=Pe(e)}function n(){return null}return n}function ot(e){try{return Y(e,``),!0}catch{return!1}}var st=W(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ct=W(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),lt=W([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),ut=W([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),dt=W(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),ft=W([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),pt=W([`#text`]),mt=W(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),ht=W(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),gt=W(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),_t=W([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),vt=G(/{{[\w\W]*|^[\w\W]*}}/g),yt=G(/<%[\w\W]*|^[\w\W]*%>/g),bt=G(/\${[\w\W]*/g),xt=G(/^data-[\-\w.\u00B7-\uFFFF]+$/),St=G(/^aria-[\-\w]+$/),Ct=G(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),wt=G(/^(?:\w+script|data):/i),Tt=G(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Et=G(/^html$/i),Dt=G(/^[a-z][.\w]*(-[.\w]+)+$/i),Ot={element:1,text:3,progressingInstruction:7,comment:8,document:9},kt=function(){return typeof window>`u`?null:window},At=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},jt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Mt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kt(),t=e=>Mt(e);if(t.version=`3.4.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Ot.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript,a=e.DocumentFragment,o=e.HTMLTemplateElement,s=e.Node,c=e.Element,l=e.NodeFilter,u=e.NamedNodeMap,d=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,f=e.HTMLFormElement,p=e.DOMParser,m=e.trustedTypes,h=c.prototype,g=at(h,`cloneNode`),_=at(h,`remove`),v=at(h,`nextSibling`),y=at(h,`childNodes`),b=at(h,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C=n,w=C.implementation,T=C.createNodeIterator,E=C.createDocumentFragment,ee=C.getElementsByTagName,te=r.importNode,D=jt();t.isSupported=typeof je==`function`&&typeof b==`function`&&w&&w.createHTMLDocument!==void 0;let O=vt,k=yt,A=bt,ne=xt,re=St,j=wt,M=Tt,N=Dt,ie=Ct,P=null,F=Z({},[...st,...ct,...lt,...dt,...pt]),I=null,ae=Z({},[...mt,...ht,...gt,..._t]),L=Object.seal(Ie(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),oe=null,se=null,R=Object.seal(Ie(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),ce=!0,le=!0,ue=!1,de=!0,fe=!1,pe=!0,z=!1,me=!1,he=!1,B=!1,ge=!1,_e=!1,ve=!0,ye=!1,be=`user-content-`,xe=!0,Se=!1,Ce={},V=null,H=Z({},[`annotation-xml`,`audio`,`colgroup`,`desc`,`foreignobject`,`head`,`iframe`,`math`,`mi`,`mn`,`mo`,`ms`,`mtext`,`noembed`,`noframes`,`noscript`,`plaintext`,`script`,`style`,`svg`,`template`,`thead`,`title`,`video`,`xmp`]),we=null,Te=Z({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ee=null,De=Z({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Oe=`http://www.w3.org/1998/Math/MathML`,ke=`http://www.w3.org/2000/svg`,U=`http://www.w3.org/1999/xhtml`,Ae=U,Me=!1,Ne=null,Pe=Z({},[Oe,ke,U],Ke),Fe=Z({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),G=Z({},[`annotation-xml`]),Le=Z({},[`title`,`style`,`font`,`a`,`script`]),Re=null,ze=[`application/xhtml+xml`,`text/html`],q=null,Ze=null,Qe=n.createElement(`form`),$e=function(e){return e instanceof RegExp||e instanceof Function},et=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ze&&Ze===e)return;(!e||typeof e!=`object`)&&(e={}),e=Q(e),Re=ze.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,q=Re===`application/xhtml+xml`?Ke:Ge,P=J(e,`ALLOWED_TAGS`)&&K(e.ALLOWED_TAGS)?Z({},e.ALLOWED_TAGS,q):F,I=J(e,`ALLOWED_ATTR`)&&K(e.ALLOWED_ATTR)?Z({},e.ALLOWED_ATTR,q):ae,Ne=J(e,`ALLOWED_NAMESPACES`)&&K(e.ALLOWED_NAMESPACES)?Z({},e.ALLOWED_NAMESPACES,Ke):Pe,Ee=J(e,`ADD_URI_SAFE_ATTR`)&&K(e.ADD_URI_SAFE_ATTR)?Z(Q(De),e.ADD_URI_SAFE_ATTR,q):De,we=J(e,`ADD_DATA_URI_TAGS`)&&K(e.ADD_DATA_URI_TAGS)?Z(Q(Te),e.ADD_DATA_URI_TAGS,q):Te,V=J(e,`FORBID_CONTENTS`)&&K(e.FORBID_CONTENTS)?Z({},e.FORBID_CONTENTS,q):H,oe=J(e,`FORBID_TAGS`)&&K(e.FORBID_TAGS)?Z({},e.FORBID_TAGS,q):Q({}),se=J(e,`FORBID_ATTR`)&&K(e.FORBID_ATTR)?Z({},e.FORBID_ATTR,q):Q({}),Ce=J(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Q(e.USE_PROFILES):e.USE_PROFILES:!1,ce=e.ALLOW_ARIA_ATTR!==!1,le=e.ALLOW_DATA_ATTR!==!1,ue=e.ALLOW_UNKNOWN_PROTOCOLS||!1,de=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,fe=e.SAFE_FOR_TEMPLATES||!1,pe=e.SAFE_FOR_XML!==!1,z=e.WHOLE_DOCUMENT||!1,B=e.RETURN_DOM||!1,ge=e.RETURN_DOM_FRAGMENT||!1,_e=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,ve=e.SANITIZE_DOM!==!1,ye=e.SANITIZE_NAMED_PROPS||!1,xe=e.KEEP_CONTENT!==!1,Se=e.IN_PLACE||!1,ie=ot(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ct,Ae=typeof e.NAMESPACE==`string`?e.NAMESPACE:U,Fe=J(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Q(e.MATHML_TEXT_INTEGRATION_POINTS):Z({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),G=J(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Q(e.HTML_INTEGRATION_POINTS):Z({},[`annotation-xml`]);let t=J(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Q(e.CUSTOM_ELEMENT_HANDLING):Ie(null);if(L=Ie(null),J(t,`tagNameCheck`)&&$e(t.tagNameCheck)&&(L.tagNameCheck=t.tagNameCheck),J(t,`attributeNameCheck`)&&$e(t.attributeNameCheck)&&(L.attributeNameCheck=t.attributeNameCheck),J(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(L.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),fe&&(le=!1),ge&&(B=!0),Ce&&(P=Z({},pt),I=Ie(null),Ce.html===!0&&(Z(P,st),Z(I,mt)),Ce.svg===!0&&(Z(P,ct),Z(I,ht),Z(I,_t)),Ce.svgFilters===!0&&(Z(P,lt),Z(I,ht),Z(I,_t)),Ce.mathMl===!0&&(Z(P,dt),Z(I,gt),Z(I,_t))),R.tagCheck=null,R.attributeCheck=null,J(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?R.tagCheck=e.ADD_TAGS:K(e.ADD_TAGS)&&(P===F&&(P=Q(P)),Z(P,e.ADD_TAGS,q))),J(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?R.attributeCheck=e.ADD_ATTR:K(e.ADD_ATTR)&&(I===ae&&(I=Q(I)),Z(I,e.ADD_ATTR,q))),J(e,`ADD_URI_SAFE_ATTR`)&&K(e.ADD_URI_SAFE_ATTR)&&Z(Ee,e.ADD_URI_SAFE_ATTR,q),J(e,`FORBID_CONTENTS`)&&K(e.FORBID_CONTENTS)&&(V===H&&(V=Q(V)),Z(V,e.FORBID_CONTENTS,q)),J(e,`ADD_FORBID_CONTENTS`)&&K(e.ADD_FORBID_CONTENTS)&&(V===H&&(V=Q(V)),Z(V,e.ADD_FORBID_CONTENTS,q)),xe&&(P[`#text`]=!0),z&&Z(P,[`html`,`head`,`body`]),P.table&&(Z(P,[`tbody`]),delete oe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw tt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw tt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);x=e.TRUSTED_TYPES_POLICY,S=x.createHTML(``)}else x===void 0&&(x=At(m,i)),x!==null&&typeof S==`string`&&(S=x.createHTML(``));W&&W(e),Ze=e},X=Z({},[...ct,...lt,...ut]),nt=Z({},[...dt,...ft]),rt=function(e){let t=b(e);(!t||!t.tagName)&&(t={namespaceURI:Ae,tagName:`template`});let n=Ge(e.tagName),r=Ge(t.tagName);return Ne[e.namespaceURI]?e.namespaceURI===ke?t.namespaceURI===U?n===`svg`:t.namespaceURI===Oe?n===`svg`&&(r===`annotation-xml`||Fe[r]):!!X[n]:e.namespaceURI===Oe?t.namespaceURI===U?n===`math`:t.namespaceURI===ke?n===`math`&&G[r]:!!nt[n]:e.namespaceURI===U?t.namespaceURI===ke&&!G[r]||t.namespaceURI===Oe&&!Fe[r]?!1:!nt[n]&&(Le[n]||!X[n]):!!(Re===`application/xhtml+xml`&&Ne[e.namespaceURI]):!1},Nt=function(e){Ue(t.removed,{element:e});try{b(e).removeChild(e)}catch{_(e)}},Pt=function(e,n){try{Ue(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{Ue(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(B||ge)try{Nt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Ft=function(e){let t=null,r=null;if(he)e=`<remove></remove>`+e;else{let t=qe(e,/^[\r\n\t ]+/);r=t&&t[0]}Re===`application/xhtml+xml`&&Ae===U&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?x.createHTML(e):e;if(Ae===U)try{t=new p().parseFromString(i,Re)}catch{}if(!t||!t.documentElement){t=w.createDocument(Ae,`template`,null);try{t.documentElement.innerHTML=Me?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ae===U?ee.call(t,z?`html`:`body`)[0]:z?t.documentElement:a},It=function(e){return T.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},Lt=function(e){return e instanceof f&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof d)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Rt=function(e){return typeof s==`function`&&e instanceof s};function $(e,n,r){Be(e,e=>{e.call(t,n,r,Ze)})}let zt=function(e){let n=null;if($(D.beforeSanitizeElements,e,null),Lt(e))return Nt(e),!0;let r=q(e.nodeName);if($(D.uponSanitizeElement,e,{tagName:r,allowedTags:P}),pe&&e.hasChildNodes()&&!Rt(e.firstElementChild)&&Y(/<[/\w!]/g,e.innerHTML)&&Y(/<[/\w!]/g,e.textContent)||pe&&e.namespaceURI===U&&r===`style`&&Rt(e.firstElementChild)||e.nodeType===Ot.progressingInstruction||pe&&e.nodeType===Ot.comment&&Y(/<[/\w]/g,e.data))return Nt(e),!0;if(oe[r]||!(R.tagCheck instanceof Function&&R.tagCheck(r))&&!P[r]){if(!oe[r]&&Ht(r)&&(L.tagNameCheck instanceof RegExp&&Y(L.tagNameCheck,r)||L.tagNameCheck instanceof Function&&L.tagNameCheck(r)))return!1;if(xe&&!V[r]){let t=b(e)||e.parentNode,n=y(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=g(n[i],!0);t.insertBefore(r,v(e))}}}return Nt(e),!0}return e instanceof c&&!rt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Y(/<\/no(script|embed|frames)/i,e.innerHTML)?(Nt(e),!0):(fe&&e.nodeType===Ot.text&&(n=e.textContent,Be([O,k,A],e=>{n=Je(n,e,` `)}),e.textContent!==n&&(Ue(t.removed,{element:e.cloneNode()}),e.textContent=n)),$(D.afterSanitizeElements,e,null),!1)},Bt=function(e,t,r){if(se[t]||ve&&(t===`id`||t===`name`)&&(r in n||r in Qe))return!1;let i=I[t]||R.attributeCheck instanceof Function&&R.attributeCheck(t,e);if(!(le&&!se[t]&&Y(ne,t))&&!(ce&&Y(re,t))){if(!i||se[t]){if(!(Ht(e)&&(L.tagNameCheck instanceof RegExp&&Y(L.tagNameCheck,e)||L.tagNameCheck instanceof Function&&L.tagNameCheck(e))&&(L.attributeNameCheck instanceof RegExp&&Y(L.attributeNameCheck,t)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(t,e))||t===`is`&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&Y(L.tagNameCheck,r)||L.tagNameCheck instanceof Function&&L.tagNameCheck(r))))return!1}else if(!Ee[t]&&!Y(ie,Je(r,M,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Ye(r,`data:`)===0&&we[e])&&!(ue&&!Y(j,Je(r,M,``)))&&r)return!1}return!0},Vt=Z({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ht=function(e){return!Vt[Ge(e)]&&Y(N,e)},Ut=function(e){$(D.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Lt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:I,forceKeepAttr:void 0},i=n.length;for(;i--;){let a=n[i],o=a.name,s=a.namespaceURI,c=a.value,l=q(o),u=c,d=o===`value`?u:Xe(u);if(r.attrName=l,r.attrValue=d,r.keepAttr=!0,r.forceKeepAttr=void 0,$(D.uponSanitizeAttribute,e,r),d=r.attrValue,ye&&(l===`id`||l===`name`)&&Ye(d,be)!==0&&(Pt(o,e),d=be+d),pe&&Y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){Pt(o,e);continue}if(l===`attributename`&&qe(d,`href`)){Pt(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Pt(o,e);continue}if(!de&&Y(/\/>/i,d)){Pt(o,e);continue}fe&&Be([O,k,A],e=>{d=Je(d,e,` `)});let f=q(e.nodeName);if(!Bt(f,l,d)){Pt(o,e);continue}if(x&&typeof m==`object`&&typeof m.getAttributeType==`function`&&!s)switch(m.getAttributeType(f,l)){case`TrustedHTML`:d=x.createHTML(d);break;case`TrustedScriptURL`:d=x.createScriptURL(d);break}if(d!==u)try{s?e.setAttributeNS(s,o,d):e.setAttribute(o,d),Lt(e)?Nt(e):He(t.removed)}catch{Pt(o,e)}}$(D.afterSanitizeAttributes,e,null)},Wt=function(e){let t=null,n=It(e);for($(D.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)$(D.uponSanitizeShadowNode,t,null),zt(t),Ut(t),t.content instanceof a&&Wt(t.content);$(D.afterSanitizeShadowDOM,e,null)},Gt=function(e){if(e.nodeType===Ot.element&&e.shadowRoot instanceof a){let t=e.shadowRoot;Gt(t),Wt(t)}let t=e.childNodes;if(!t)return;let n=[];Be(t,e=>{Ue(n,e)});for(let e of n)Gt(e)};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,o=null,c=null,l=null;if(Me=!e,Me&&(e=`<!-->`),typeof e!=`string`&&!Rt(e)&&(e=it(e),typeof e!=`string`))throw tt(`dirty is not a string, aborting`);if(!t.isSupported)return e;if(me||et(n),t.removed=[],typeof e==`string`&&(Se=!1),Se){let t=e.nodeName;if(typeof t==`string`){let e=q(t);if(!P[e]||oe[e])throw tt(`root node is forbidden and cannot be sanitized in-place`)}Gt(e)}else if(e instanceof s)i=Ft(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Ot.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o),Gt(o);else{if(!B&&!fe&&!z&&e.indexOf(`<`)===-1)return x&&_e?x.createHTML(e):e;if(i=Ft(e),!i)return B?null:_e?S:``}i&&he&&Nt(i.firstChild);let u=It(Se?e:i);for(;c=u.nextNode();)zt(c),Ut(c),c.content instanceof a&&Wt(c.content);if(Se)return e;if(B){if(fe){i.normalize();let e=i.innerHTML;Be([O,k,A],t=>{e=Je(e,t,` `)}),i.innerHTML=e}if(ge)for(l=E.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(I.shadowroot||I.shadowrootmode)&&(l=te.call(r,l,!0)),l}let d=z?i.outerHTML:i.innerHTML;return z&&P[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Y(Et,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
3
  `+d),fe&&Be([O,k,A],e=>{d=Je(d,e,` `)}),x&&_e?x.createHTML(d):d},t.setConfig=function(){et(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),me=!0},t.clearConfig=function(){Ze=null,me=!1},t.isValidAttribute=function(e,t,n){return Ze||et({}),Bt(q(e),q(t),n)},t.addHook=function(e,t){typeof t==`function`&&Ue(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=Ve(D[e],t);return n===-1?void 0:We(D[e],n,1)[0]}return He(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=jt()},t}var Nt=Mt(),Pt=H({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/parse.js"(e,t){var n,r,i={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
4
4
  `,r:`\r`,t:` `},a;function o(e){throw{name:`SyntaxError`,message:e,at:n,text:a}}function s(e){return e&&e!==r&&o(`Expected '`+e+`' instead of '`+r+`'`),r=a.charAt(n),n+=1,r}function c(){var e,t=``;for(r===`-`&&(t=`-`,s(`-`));r>=`0`&&r<=`9`;)t+=r,s();if(r===`.`)for(t+=`.`;s()&&r>=`0`&&r<=`9`;)t+=r;if(r===`e`||r===`E`)for(t+=r,s(),(r===`-`||r===`+`)&&(t+=r,s());r>=`0`&&r<=`9`;)t+=r,s();return e=Number(t),isFinite(e)||o(`Bad number`),e}function l(){var e,t,n=``,a;if(r===`"`)for(;s();)if(r===`"`)return s(),n;else if(r===`\\`)if(s(),r===`u`){for(a=0,t=0;t<4&&(e=parseInt(s(),16),isFinite(e));t+=1)a=a*16+e;n+=String.fromCharCode(a)}else if(typeof i[r]==`string`)n+=i[r];else break;else n+=r;o(`Bad string`)}function u(){for(;r&&r<=` `;)s()}function d(){switch(r){case`t`:return s(`t`),s(`r`),s(`u`),s(`e`),!0;case`f`:return s(`f`),s(`a`),s(`l`),s(`s`),s(`e`),!1;case`n`:return s(`n`),s(`u`),s(`l`),s(`l`),null;default:o(`Unexpected '`+r+`'`)}}function f(){var e=[];if(r===`[`){if(s(`[`),u(),r===`]`)return s(`]`),e;for(;r;){if(e.push(m()),u(),r===`]`)return s(`]`),e;s(`,`),u()}}o(`Bad array`)}function p(){var e,t={};if(r===`{`){if(s(`{`),u(),r===`}`)return s(`}`),t;for(;r;){if(e=l(),u(),s(`:`),Object.prototype.hasOwnProperty.call(t,e)&&o(`Duplicate key "`+e+`"`),t[e]=m(),u(),r===`}`)return s(`}`),t;s(`,`),u()}}o(`Bad object`)}function m(){switch(u(),r){case`{`:return p();case`[`:return f();case`"`:return l();case`-`:return c();default:return r>=`0`&&r<=`9`?c():d()}}t.exports=function(e,t){var i;return a=e,n=0,r=` `,i=m(),u(),r&&o(`Syntax error`),typeof t==`function`?(function e(n,r){var i,a,o=n[r];if(o&&typeof o==`object`)for(i in m)Object.prototype.hasOwnProperty.call(o,i)&&(a=e(o,i),a===void 0?delete o[i]:o[i]=a);return t.call(n,r,o)})({"":i},``):i}}}),Ft=H({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/stringify.js"(e,t){var n=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,r,i,a={"\b":`\\b`," ":`\\t`,"\n":`\\n`,"\f":`\\f`,"\r":`\\r`,'"':`\\"`,"\\":`\\\\`},o;function s(e){return n.lastIndex=0,n.test(e)?`"`+e.replace(n,function(e){var t=a[e];return typeof t==`string`?t:`\\u`+(`0000`+e.charCodeAt(0).toString(16)).slice(-4)})+`"`:`"`+e+`"`}function c(e,t){var n,a,l,u,d=r,f,p=t[e];switch(p&&typeof p==`object`&&typeof p.toJSON==`function`&&(p=p.toJSON(e)),typeof o==`function`&&(p=o.call(t,e,p)),typeof p){case`string`:return s(p);case`number`:return isFinite(p)?String(p):`null`;case`boolean`:case`null`:return String(p);case`object`:if(!p)return`null`;if(r+=i,f=[],Object.prototype.toString.apply(p)===`[object Array]`){for(u=p.length,n=0;n<u;n+=1)f[n]=c(n,p)||`null`;return l=f.length===0?`[]`:r?`[
@@ -1 +1 @@
1
- import{I as e}from"./api-C4R44YCL.js";function t(t){let{apiKey:n,userId:r,businessId:i,environment:a}=t;return{queryKey:[`bootstrap`,a,n,r,i],enabled:!!(n&&r&&i),queryFn:async()=>{let t=await fetch(`/api/proxy/auth/bootstrap`,{headers:{"x-proxy-target":e[a],"X-API-KEY":n,"X-USER-ID":r,"X-BUSINESS-ID":i}});if(!t.ok)throw Error(`Bootstrap failed: ${String(t.status)} ${t.statusText}`);return t.json()},retry:!1}}export{t};
1
+ import{I as e}from"./api-CW7z0-aU.js";function t(t){let{apiKey:n,userId:r,businessId:i,environment:a}=t;return{queryKey:[`bootstrap`,a,n,r,i],enabled:!!(n&&r&&i),queryFn:async()=>{let t=await fetch(`/api/proxy/auth/bootstrap`,{headers:{"x-proxy-target":e[a],"X-API-KEY":n,"X-USER-ID":r,"X-BUSINESS-ID":i}});if(!t.ok)throw Error(`Bootstrap failed: ${String(t.status)} ${t.statusText}`);return t.json()},retry:!1}}export{t};