@kizenapps/cli 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,j as n}from"./fa-core-BoBqCOD3.js";import{a as r}from"./api-BcUybEsl.js";import{t as i}from"./Tooltip-tpqNw0op.js";var a=e(n(),1),o=t(),s=({when:e,whenState:t})=>{let[n,s]=(0,a.useState)(null);return(0,a.useEffect)(()=>{r(e,t).then(s).catch(()=>{s(null)})},[e,t]),n===null?null:(0,o.jsx)(i,{text:e,children:(0,o.jsxs)(`span`,{className:`font-mono text-[10px] ${n?`text-green-600`:`text-amber-600`}`,children:[n?`enabled`:`disabled`,` by condition`]})})};export{s as t};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,j as n}from"./fa-core-BoBqCOD3.js";import{a as r}from"./api-DtXiAEKW.js";import{t as i}from"./Tooltip-tpqNw0op.js";var a=e(n(),1),o=t(),s=({when:e,whenState:t})=>{let[n,s]=(0,a.useState)(null);return(0,a.useEffect)(()=>{r(e,t).then(s).catch(()=>{s(null)})},[e,t]),n===null?null:(0,o.jsx)(i,{text:e,children:(0,o.jsxs)(`span`,{className:`font-mono text-[10px] ${n?`text-green-600`:`text-amber-600`}`,children:[n?`enabled`:`disabled`,` by condition`]})})};export{s as t};
@@ -7,4 +7,4 @@ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{j as t}from"./fa-core-
7
7
  `+r+f.join(`,
8
8
  `+r)+`
9
9
  `+d+`}`:`{`+f.join(`,`)+`}`,r=d,l}}t.exports=function(e,t,n){var a;if(r=``,i=``,typeof n==`number`)for(a=0;a<n;a+=1)i+=` `;else typeof n==`string`&&(i=n);if(o=t,t&&typeof t!=`function`&&(typeof t!=`object`||typeof t.length!=`number`))throw Error(`JSON.stringify`);return c(``,{"":e})}}}),Ze=j({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/index.js"(e){e.parse=Ye(),e.stringify=Xe()}}),Qe=j({"node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js"(e,t){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)==`[object Array]`}}}),$e=j({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/isArguments.js"(e,t){var n=Object.prototype.toString;t.exports=function(e){var t=n.call(e),r=t===`[object Arguments]`;return r||=t!==`[object Array]`&&typeof e==`object`&&!!e&&typeof e.length==`number`&&e.length>=0&&n.call(e.callee)===`[object Function]`,r}}}),et=j({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/implementation.js"(e,t){var n;Object.keys||(r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,a=$e(),o=Object.prototype.propertyIsEnumerable,s=!o.call({toString:null},`toString`),c=o.call(function(){},`prototype`),l=[`toString`,`toLocaleString`,`valueOf`,`hasOwnProperty`,`isPrototypeOf`,`propertyIsEnumerable`,`constructor`],u=function(e){var t=e.constructor;return t&&t.prototype===e},d={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=(function(){if(typeof window>`u`)return!1;for(var e in window)try{if(!d[`$`+e]&&r.call(window,e)&&window[e]!==null&&typeof window[e]==`object`)try{u(window[e])}catch{return!0}}catch{return!0}return!1})(),p=function(e){if(typeof window>`u`||!f)return u(e);try{return u(e)}catch{return!1}},n=function(e){var t=typeof e==`object`&&!!e,n=i.call(e)===`[object Function]`,o=a(e),u=t&&i.call(e)===`[object String]`,d=[];if(!t&&!n&&!o)throw TypeError(`Object.keys called on a non-object`);var f=c&&n;if(u&&e.length>0&&!r.call(e,0))for(var m=0;m<e.length;++m)d.push(String(m));if(o&&e.length>0)for(var h=0;h<e.length;++h)d.push(String(h));else for(var g in e)!(f&&g===`prototype`)&&r.call(e,g)&&d.push(String(g));if(s)for(var _=p(e),v=0;v<l.length;++v)!(_&&l[v]===`constructor`)&&r.call(e,l[v])&&d.push(l[v]);return d});var r,i,a,o,s,c,l,u,d,f,p;t.exports=n}}),K=j({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js"(e,t){var n=Array.prototype.slice,r=$e(),i=Object.keys,a=i?function(e){return i(e)}:et(),o=Object.keys;a.shim=function(){return Object.keys?(function(){var e=Object.keys(arguments);return e&&e.length===arguments.length})(1,2)||(Object.keys=function(e){return r(e)?o(n.call(e)):o(e)}):Object.keys=a,Object.keys||a},t.exports=a}}),tt=j({"node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(e,t){t.exports=Object}}),nt=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(e,t){t.exports=Error}}),rt=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(e,t){t.exports=EvalError}}),it=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(e,t){t.exports=RangeError}}),at=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(e,t){t.exports=ReferenceError}}),ot=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(e,t){t.exports=SyntaxError}}),q=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(e,t){t.exports=TypeError}}),J=j({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(e,t){t.exports=URIError}}),st=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(e,t){t.exports=Math.abs}}),ct=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(e,t){t.exports=Math.floor}}),lt=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(e,t){t.exports=Math.max}}),ut=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(e,t){t.exports=Math.min}}),dt=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(e,t){t.exports=Math.pow}}),ft=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(e,t){t.exports=Math.round}}),pt=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(e,t){t.exports=Number.isNaN||function(e){return e!==e}}}),mt=j({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(e,t){var n=pt();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}}}),ht=j({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(e,t){t.exports=Object.getOwnPropertyDescriptor}}),Y=j({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(e,t){var n=ht();if(n)try{n([],`length`)}catch{n=null}t.exports=n}}),X=j({"node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(e,t){var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n}}),gt=j({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(e,t){t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}}}),_t=j({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(e,t){var n=typeof Symbol<`u`&&Symbol,r=gt();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}}}),vt=j({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null}}),yt=j({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(e,t){t.exports=tt().getPrototypeOf||null}}),bt=j({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(e,t){var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}}}),xt=j({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(e,t){var n=bt();t.exports=Function.prototype.bind||n}}),Z=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(e,t){t.exports=Function.prototype.call}}),Q=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(e,t){t.exports=Function.prototype.apply}}),St=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(e,t){t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply}}),Ct=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(e,t){var n=xt(),r=Q(),i=Z();t.exports=St()||n.call(i,r)}}),wt=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(e,t){var n=xt(),r=q(),i=Z(),a=Ct();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}}}),Tt=j({"node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(e,t){var n=wt(),r=Y(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?(function(e){return s(e==null?e:o(e))}):!1}}),$=j({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(e,t){var n=vt(),r=yt(),i=Tt();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null}}),Et=j({"node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(e,t){var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=xt().call(n,r)}}),Dt=j({"node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(e,t){var n,r=tt(),i=nt(),a=rt(),o=it(),s=at(),c=ot(),l=q(),u=J(),d=st(),f=ct(),p=lt(),m=ut(),h=dt(),g=ft(),_=mt(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=Y(),x=X(),S=function(){throw new l},C=b?(function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}})():S,w=_t()(),T=$(),ee=yt(),E=vt(),D=Q(),O=Z(),k={},te=typeof Uint8Array>`u`||!T?n:T(Uint8Array),A={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":k,"%AsyncGenerator%":k,"%AsyncGeneratorFunction%":k,"%AsyncIteratorPrototype%":k,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":k,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":te,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":O,"%Function.prototype.apply%":D,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":ee,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":E};if(T)try{null.error}catch(e){ne=T(T(e)),A[`%Error.prototype%`]=ne}var ne,j=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return A[t]=n,n},M={__proto__:null,"%ArrayBufferPrototype%":[`ArrayBuffer`,`prototype`],"%ArrayPrototype%":[`Array`,`prototype`],"%ArrayProto_entries%":[`Array`,`prototype`,`entries`],"%ArrayProto_forEach%":[`Array`,`prototype`,`forEach`],"%ArrayProto_keys%":[`Array`,`prototype`,`keys`],"%ArrayProto_values%":[`Array`,`prototype`,`values`],"%AsyncFunctionPrototype%":[`AsyncFunction`,`prototype`],"%AsyncGenerator%":[`AsyncGeneratorFunction`,`prototype`],"%AsyncGeneratorPrototype%":[`AsyncGeneratorFunction`,`prototype`,`prototype`],"%BooleanPrototype%":[`Boolean`,`prototype`],"%DataViewPrototype%":[`DataView`,`prototype`],"%DatePrototype%":[`Date`,`prototype`],"%ErrorPrototype%":[`Error`,`prototype`],"%EvalErrorPrototype%":[`EvalError`,`prototype`],"%Float32ArrayPrototype%":[`Float32Array`,`prototype`],"%Float64ArrayPrototype%":[`Float64Array`,`prototype`],"%FunctionPrototype%":[`Function`,`prototype`],"%Generator%":[`GeneratorFunction`,`prototype`],"%GeneratorPrototype%":[`GeneratorFunction`,`prototype`,`prototype`],"%Int8ArrayPrototype%":[`Int8Array`,`prototype`],"%Int16ArrayPrototype%":[`Int16Array`,`prototype`],"%Int32ArrayPrototype%":[`Int32Array`,`prototype`],"%JSONParse%":[`JSON`,`parse`],"%JSONStringify%":[`JSON`,`stringify`],"%MapPrototype%":[`Map`,`prototype`],"%NumberPrototype%":[`Number`,`prototype`],"%ObjectPrototype%":[`Object`,`prototype`],"%ObjProto_toString%":[`Object`,`prototype`,`toString`],"%ObjProto_valueOf%":[`Object`,`prototype`,`valueOf`],"%PromisePrototype%":[`Promise`,`prototype`],"%PromiseProto_then%":[`Promise`,`prototype`,`then`],"%Promise_all%":[`Promise`,`all`],"%Promise_reject%":[`Promise`,`reject`],"%Promise_resolve%":[`Promise`,`resolve`],"%RangeErrorPrototype%":[`RangeError`,`prototype`],"%ReferenceErrorPrototype%":[`ReferenceError`,`prototype`],"%RegExpPrototype%":[`RegExp`,`prototype`],"%SetPrototype%":[`Set`,`prototype`],"%SharedArrayBufferPrototype%":[`SharedArrayBuffer`,`prototype`],"%StringPrototype%":[`String`,`prototype`],"%SymbolPrototype%":[`Symbol`,`prototype`],"%SyntaxErrorPrototype%":[`SyntaxError`,`prototype`],"%TypedArrayPrototype%":[`TypedArray`,`prototype`],"%TypeErrorPrototype%":[`TypeError`,`prototype`],"%Uint8ArrayPrototype%":[`Uint8Array`,`prototype`],"%Uint8ClampedArrayPrototype%":[`Uint8ClampedArray`,`prototype`],"%Uint16ArrayPrototype%":[`Uint16Array`,`prototype`],"%Uint32ArrayPrototype%":[`Uint32Array`,`prototype`],"%URIErrorPrototype%":[`URIError`,`prototype`],"%WeakMapPrototype%":[`WeakMap`,`prototype`],"%WeakSetPrototype%":[`WeakSet`,`prototype`]},N=xt(),re=Et(),P=N.call(O,Array.prototype.concat),ie=N.call(D,Array.prototype.splice),F=N.call(O,String.prototype.replace),I=N.call(O,String.prototype.slice),L=N.call(O,RegExp.prototype.exec),R=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,ae=/\\(\\)?/g,z=function(e){var t=I(e,0,1),n=I(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return F(e,R,function(e,t,n,i){r[r.length]=n?F(i,ae,`$1`):t||e}),r},oe=function(e,t){var n=e,r;if(re(M,n)&&(r=M[n],n=`%`+r[0]+`%`),re(A,n)){var i=A[n];if(i===k&&(i=j(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(L(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=z(e),r=n.length>0?n[0]:``,i=oe(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],ie(n,P([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=I(p,0,1),h=I(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,re(A,a))o=A[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=re(o,p),o=o[p];f&&!s&&(A[a]=o)}}return o}}}),Ot=j({"node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(e,t){var n=X(),r=ot(),i=q(),a=Y();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}}}),kt=j({"node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(e,t){var n=X(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r}}),At=j({"node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(e,t){var n=Dt(),r=Ot(),i=kt()(),a=Y(),o=q(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}}}),jt=j({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js"(e,t){var n=xt(),r=Q(),i=Ct();t.exports=function(){return i(n,r,arguments)}}}),Mt=j({"node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js"(e,t){var n=At(),r=X(),i=wt(),a=jt();t.exports=function(e){var t=i(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a}}),Nt=j({"node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(e,t){var n=Dt(),r=wt(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}}}),Pt=N(j({"node_modules/.pnpm/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js"(e,t){var n=(typeof JSON<`u`?JSON:Ze()).stringify,r=Qe(),i=K(),a=Mt(),o=Nt(),s=o(`Array.prototype.join`),c=o(`Array.prototype.indexOf`),l=o(`Array.prototype.splice`),u=o(`Array.prototype.sort`),d=function(e,t){for(var n=``,r=0;r<e;r+=1)n+=t;return n},f=function(e,t,n){return n};t.exports=function(e){var t=arguments.length>1?arguments[1]:void 0,o=t&&t.space||``;typeof o==`number`&&(o=d(o,` `));var p=!!t&&typeof t.cycles==`boolean`&&t.cycles,m=t&&t.replacer?a(t.replacer):f;if(t&&t.collapseEmpty!==void 0&&typeof t.collapseEmpty!=`boolean`)throw TypeError("`collapseEmpty` must be a boolean, if provided");var h=!!t&&t.collapseEmpty,g=typeof t==`function`?t:t&&t.cmp,_=g&&function(e){var t=g.length>2&&function(t){return e[t]};return function(n,r){return g({key:n,value:e[n]},{key:r,value:e[r]},t?{__proto__:null,get:t}:void 0)}},v=[];return(function e(t,a,f,g){var y=o?`
10
- `+d(g,o):``,b=o?`: `:`:`;if(f&&f.toJSON&&typeof f.toJSON==`function`&&(f=f.toJSON()),f=m(t,a,f),f!==void 0){if(typeof f!=`object`||!f)return n(f);var x=function(e,t){return h&&e.length===0?t:(t===`[]`?`[`:`{`)+s(e,`,`)+y+(t===`[]`?`]`:`}`)};if(r(f)){for(var S=[],C=0;C<f.length;C++){var w=e(f,C,f[C],g+1)||n(null);S[S.length]=y+o+w}return x(S,`[]`)}if(c(v,f)!==-1){if(p)return n(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}else v[v.length]=f;for(var T=u(i(f),_&&_(f)),S=[],C=0;C<T.length;C++){var a=T[C],ee=e(f,a,f[a],g+1);if(ee){var E=n(a)+b+ee;S[S.length]=y+o+E}}return l(v,c(v,f),1),x(S,`{}`)}})({"":e},``,e,0)}}})(),1),Ft=e=>localStorage.getItem(`kizen-flag-${e}`)===`true`,It=(e=``)=>e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),Lt=e=>{try{return It((0,Pt.default)(e))}catch(e){return Ft(`script-runner-logging`)&&console.warn(`Failed to stringify object for hashing:`,e),It(String(Math.random()))}},Rt=e=>e.startsWith(`/`),zt=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],Bt=[`allow-popups`,`allow-scripts`,`allow-same-origin`],Vt=3e4,Ht=100,Ut=class{worker;scriptUIRef;onStateChange;done;onError;waitForFrame=!1;plugin;executionPlugin;frameId;onShowToast;onClearToasts;sessionData={};setSessionData;pluginComponentId;onShowModal;onShowCreateRecordModal;onShowCreateRelatedRecordModal;onReleaseBlockingScript;pluginApiName;onNetworkError;onNetworkRequest;invalidateCache;getPendingCacheCount;createFileId;performFileUpload;pushHistory;appPath;constructor(e){this.scriptUIRef=e.scriptUIRef,this.onStateChange=e.onStateChange,this.done=e.done,this.onError=e.onError,this.onReleaseBlockingScript=e.onReleaseBlockingScript,this.worker=e.worker,this.worker.onmessage=this.handleMessage,this.plugin=e.plugin,this.executionPlugin=e.executionPlugin,this.onShowToast=e.onShowToast,this.onClearToasts=e.onClearToasts,this.pluginComponentId=e.pluginComponentId,this.onShowModal=e.onShowModal,this.onShowCreateRecordModal=e.onShowCreateRecordModal,this.onShowCreateRelatedRecordModal=e.onShowCreateRelatedRecordModal,this.onNetworkError=e.onNetworkError,this.onNetworkRequest=e.onNetworkRequest,this.invalidateCache=e.invalidateCache,this.getPendingCacheCount=e.getPendingCacheCount,this.createFileId=e.createFileId,this.performFileUpload=e.performFileUpload,this.pushHistory=e.pushHistory,this.appPath=e.appPath,this.plugin&&(this.frameId=`${m}-${this.plugin.plugin_api_name}-${this.plugin.api_name}`),this.pluginApiName=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name??``,this.pluginApiName?(this.sessionData=e.sessionData[this.pluginApiName],this.setSessionData=t=>{e.setSessionData?.(this.pluginApiName,t)}):this.setSessionData=()=>{this.onError?.({message:`Script must be associated with a plugin to use session data`})}}handleMessage=async e=>{let t=JSON.parse(e.data),{action:n}=t;switch(n){case l.QUERY_REQUEST:{let e=t;await this.handleQueryRequest(e.id,e.method,e.url,e.payload,e.options);return}case l.UI_OUTPUT:{let e=t;this.handleUIOutput(e.markup);return}case l.IFRAME_OUTPUT:{let e=t;this.handleIframeOutput(e.url,e.allow,e.sandbox,e.preserve);return}case l.POSTFORMDATA_REQUEST:{let e=t;this.handleFormPostRequest(e.id,e.url,e.payload,e.createNewTab);return}case l.UPLOADFILE_REQUEST:{let e=t;await this.handleUploadFileRequest(e.id,e.payload);return}case l.SETSTATE:{let e=t;this.onStateChange?.(e.state);return}case l.DONE:{let e=t;this.handleDone(e.preserve,e.result);return}case u.ERROR:{let e=t;this.onError?.({message:e.error});return}case l.OPEN_WINDOW:{let e=t;this.handleOpenWindow(e.url,e.target,e.features);return}case l.COMMUNICATE:{let e=t;this.handleCommunication(e.type,e.recipient,e.args,e.params);return}case l.HIDE:{let{config:e}=t,n=!1;e.hideTrigger&&(n=!0),this.onStateChange?.({hidden:!0,triggerHidden:n});return}case l.SHOW:{let{config:e}=t,n=!1;e.showTrigger===!1&&(n=!0),this.onStateChange?.({hidden:!1,triggerHidden:n});return}case l.EXPAND:this.onStateChange?.({minimized:!1});return;case l.COLLAPSE:this.onStateChange?.({minimized:!0});return;case l.HIDE_HEADER:this.onStateChange?.({hideHeader:!0});return;case l.SHOW_HEADER:this.onStateChange?.({hideHeader:!1});return;case l.COPY_TO_CLIPBOARD:{let e=t;await this.copyToClipboard(e.text);return}case l.OPEN_CREATE_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRecordRequest(e.id,e.entityId);return}case l.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRelatedRecordRequest(e.id,e.objectId,e.relatedEntityId);return}case l.SHOW_TOAST:{let e=t;this.showToast(e.message,e.toastOptions);return}case l.CLEAR_TOASTS:this.clearToasts();return;case l.REFRESH_TIMELINE:{let e=t;this.handleRefreshTimeline(e.entityId);return}case l.REFRESH_ENTITY:{let e=t;await this.handleRefreshEntity(e.entityId,e.id);return}case l.UPDATE_SESSION_DATA:{let e=t;this.handleSetSessionData(e.update);return}case l.INSTALL_THIRD_PARTY_SCRIPT_REQUEST:{let e=t;this.handleInstallThirdPartyScriptRequest(e.id,e.url,e.args);return}case l.PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!1);return}case l.DYNAMIC_PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!0);return}case l.RELEASE_BLOCKING_SCRIPT:this.handleReleaseBlockingScript();return;case l.AUTHORIZE:{let e=t;this.handleAuthorize(e.serviceName,e.config);return}default:return}};handleCommunication=(e,t,n,r)=>{if(e===d.SEND_MESSAGE_TO_FRAME){if(this.frameId){let e=document.getElementById(this.frameId);e&&e.contentWindow?.postMessage({...n?.payload??{},__kizen:{recipient:t,frameId:this.frameId}},n?.path??`*`)}}else if(e===d.CALL_THIRD_PARTY_SCRIPT)this.handleCallThirdPartyScript(t.type,r);else{let r=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name,i=new CustomEvent(`integration:${e}`,{detail:{recipient:{...t,plugin:r},args:n}});window.dispatchEvent(i)}};handleDone=(e,t)=>{this.waitForFrame||this.done(e,t)};postMessage=(e,t)=>{this.worker.postMessage(JSON.stringify({action:e,...t}))};handleSetSessionData=e=>{this.setSessionData(e)};handleQueryRequest=async(e,t,n,r,i)=>{try{let a=await this.onNetworkRequest?.(t,n,r,i);this.postMessage(u.QUERY_RESPONSE,{data:a,id:e})}catch(t){this.onNetworkError?.(t);let n=t instanceof E?{__kizenError:!0,proxyStatus:t.proxyStatus,upstreamStatus:t.upstreamStatus,upstreamResponse:t.upstreamResponse,message:t.message}:(()=>{if(t instanceof Error)return{message:t.message,name:t.name};try{let e=JSON.parse(JSON.stringify(t));if(typeof e==`object`&&e&&!Array.isArray(e))return e}catch{}return{message:String(t)}})();this.postMessage(u.QUERY_RESPONSE,{error:n,id:e})}};handleUIOutput=e=>{if(this.scriptUIRef?.current){let t=Je.sanitize(e);this.scriptUIRef.current.innerHTML=t}};onLoad=e=>{e.iframe&&(this.waitForFrame=!1,this.handleDone(e.preserve))};handleIframeOutput=(e,t=[],n=[],r=!1)=>{if(this.scriptUIRef?.current){let i=t.filter(e=>zt.includes(e)),a=n.filter(e=>Bt.includes(e));this.waitForFrame=!0;let o=document.createElement(`iframe`);o.src=e,o.allow=i.join(`; `),a.forEach(e=>{o.sandbox.add(e)}),o.style.border=`none`,o.style.width=`100%`,o.style.height=`100%`,o.onload=this.onLoad.bind(this,{iframe:o,preserve:r}),this.frameId&&(o.id=this.frameId),this.scriptUIRef.current.replaceChildren(o)}};handleCreateRecordRequest=(e,t)=>{this.onShowCreateRecordModal?.(t,t=>{this.postMessage(u.CREATE_RECORD_RESPONSE,{id:e,data:t})})};handleCreateRelatedRecordRequest=(e,t,n)=>{this.onShowCreateRelatedRecordModal?.(t,n,t=>{this.postMessage(u.CREATE_RELATED_RECORD_RESPONSE,{id:e,data:t})})};showToast=(e,t)=>{this.onShowToast?.({message:e,variant:t?.variant??`success`,autohide:t?.autohide??!0})};clearToasts=()=>{this.onClearToasts?.()};copyToClipboard=async e=>{try{await navigator.clipboard.writeText(e)}catch(e){this.onError?.({message:e.message})}};handleRefreshTimeline=e=>{this.invalidateCache?.(`timeline`,e)};waitForIdleState=e=>new Promise(t=>{let n=0,r=setInterval(()=>{(this.getPendingCacheCount?.(e)??0)===0?(clearInterval(r),t(!0)):(n+=1,n>Math.floor(Vt/Ht)&&(clearInterval(r),t(!1)))},Ht)});handleRefreshEntity=async(e,t)=>{this.invalidateCache?.(`entity`,e);let n=await this.waitForIdleState(e);this.postMessage(u.REFRESH_ENTITY_RESPONSE,{id:t,data:{success:n}})};handleFormPostRequest=(e,t,n,r)=>{let i=document.createElement(`form`);i.method=`POST`,i.action=t,r&&(i.target=`_blank`);for(let e in n){let t=document.createElement(`input`);t.type=`hidden`,t.name=e,t.value=n[e],i.appendChild(t)}document.body.appendChild(i),i.submit(),r&&document.body.removeChild(i),this.postMessage(u.POSTFORMDATA_RESPONSE,{success:!0,id:e})};handleUploadFileRequest=async(e,t)=>{if(!this.performFileUpload){this.postMessage(u.UPLOADFILE_RESPONSE,{error:`File upload not supported`,id:e});return}let{file:n,isPublic:r=!1,fileName:i}=t,a=await(await fetch(n)).blob(),o=new File([a],i??`upload-${new Date().toISOString()}`,{type:a.type});o.$id=this.createFileId?.()??T();let s=await this.performFileUpload({file:o,id:o.$id,publicFile:r,source:`field_value`,handleProgress:e=>{this.postMessage(u.UPLOADFILE_PROGRESS,{fileId:e.id,progress:e.progress})},businessId:void 0});this.postMessage(u.UPLOADFILE_RESPONSE,{data:s,id:e})};waitForReadyState=(e,t,n=0)=>{e||t?.(!0),e?.()?t?.(!0):n<20?setTimeout(()=>{this.waitForReadyState(e,t,n+1)},n*50):t?.(!1)};handleCallThirdPartyScript=(e,t=[])=>{if(e&&x[e]){let n=x[e],r=window[n];r?.(...t)}};handleReleaseBlockingScript=()=>this.onReleaseBlockingScript?.(this.executionPlugin);handlePromptRequest=(e,t,n=!1)=>{this.onShowModal?this.onShowModal({...t,pluginApiName:this.pluginApiName??``,dynamic:n},(t={})=>{this.postMessage(u.PROMPT_RESPONSE,{id:e,data:t})}):this.postMessage(u.PROMPT_RESPONSE,{id:e,data:{canceled:!0}})};handleInstallThirdPartyScriptRequest=(e,t,n={})=>{let r=b(t);if(!r){this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e});return}let i=S[r];i(n);let a=document.createElement(`script`);a.onload=()=>{this.waitForReadyState(C[r],n=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,matched:n},id:e})})},a.onerror=()=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e})},a.src=t,a.setAttribute(`data-script-url`,t),document.querySelectorAll(`[data-script-url="`+t+`"]`).length>0?this.waitForReadyState(C[r],n=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,reused:!0,matched:n},id:e})}):document.documentElement.firstChild?.appendChild(a)};handleOpenWindow=(e,t,n)=>{!Rt(e)||t===`_blank`||!this.pushHistory?window.open(e,t,n):this.pushHistory(e)};handleAuthorize=(e,t={})=>{let n=new URLSearchParams;if(t.successRedirectPath&&n.append(`success_redirect_path`,t.successRedirectPath),t.errorRedirectPath&&n.append(`error_redirect_path`,t.errorRedirectPath),!this.appPath){this.onError?.({message:`App path is not defined.`});return}if(!this.pluginApiName){this.onError?.({message:`Plugin API name is not defined.`});return}let r=n.toString();this.handleOpenWindow(`${this.appPath}/external-integrations/business-plugin-apps/${this.pluginApiName}/services/${encodeURIComponent(e)}/authorize${r?`?${r}`:``}`,`_blank`,``)};run=(e,t,n)=>{let r=w();this.postMessage(l.RUN,{script:e,setup:t,args:n,sessionData:this.sessionData,pluginComponentId:this.pluginComponentId,pluginApiName:this.pluginApiName,location:r})}},Wt=async({scriptBody:e,user:t,teamMember:n,business:r,onError:i,onReleaseBlockingScript:a,setLoadingState:o,clientObject:s,scriptUIRef:c,onStateChange:l,workerName:u,context:d,args:f=``,plugin:p,onShowToast:m,onClearToasts:h,terminators:g,executionPlugin:_,sessionData:v,setSessionData:y,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,onNetworkRequest:w,appPath:T,pushHistory:ee,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:k})=>{let te=Ft(`script-runner-logging`),A;return A=u===`recordDetail`?new Worker(new URL(`/assets/recordDetail.worker-B-1qFS5m.js`,``+import.meta.url),{type:`module`}):u===`genericPlugin`?new Worker(new URL(`/assets/generic.worker-Bzr3c9PO.js`,``+import.meta.url),{type:`module`}):u===`floatingFramePlugin`?new Worker(new URL(`/assets/floatingFrame.worker-CKAMagoG.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/calendarSource.worker-DGRTJYHs.js`,``+import.meta.url),{type:`module`}),new Promise(u=>{let ne=It(e),j=It(f),M=`${p?.plugin_api_name??``}-${p?.api_name??``}-${String(ne)}-${String(j)}`,N=`${p?.plugin_api_name??``}-${p?.api_name??``}`;_?.field_type?(M=`${_.plugin_api_name??``}-${_.field_type}-${String(ne)}-${String(j)}`,N=`${_.plugin_api_name??``}-${_.field_type??_.script_id}`):_&&(M=`${_.plugin_api_name??``}-${_.api_name}-${String(ne)}-${String(j)}`,N=`${_.plugin_api_name??``}-${_.api_name}`),g.current[M]&&(g.current[M]?.forEach(e=>{e()}),g.current[M]=[]),g.current[M]??=[],g.current[M]?.push(()=>{A.terminate()});let re=new Ut({worker:A,done:(e,t)=>{o(!1),e||(g.current[M]?.forEach(e=>{e()}),g.current[M]=[]),u(t)},onError:i,onReleaseBlockingScript:a,scriptUIRef:c,onStateChange:l,plugin:p,executionPlugin:_,onShowToast:m,onClearToasts:h,sessionData:v,setSessionData:y,pluginComponentId:N,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,pushHistory:ee,onNetworkRequest:w,appPath:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:k});o(!0),re.run(e,{...d,user:t,teamMember:n,business:r,clientObject:s,appPath:T,isDebug:te},f)})},Gt=(e,t)=>{let n=new Worker(new URL(`/assets/expression.worker-Cin-WNVB.js`,``+import.meta.url),{type:`module`});return new Promise(r=>{n.onmessage=e=>{let t=JSON.parse(e.data);n.terminate(),r(t.result)};let i=Ft(`script-runner-logging`);n.postMessage(JSON.stringify({expression:e,args:t,isDebug:i}))})},Kt=async(e,t)=>await Gt(e,t),qt=async(e,t)=>await Gt(e,t),Jt=async(e,t)=>await Gt(e,t),Yt=async(e,t)=>await Gt(e,t),Xt=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),Zt=(e,t)=>{let n=(e.fields??[]).filter(e=>e.type!==`container`&&e.type!==`description`).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Zt(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...Xt(e),match_hint:e.hint_object_name??``}))]},Qt=(e,t)=>{let n=Zt(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`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:return}return r?.value}}),i},$t=e=>{if(e===`boolean`)return!1},en=(e,t,n,r)=>{let i=Object.keys(e),a={};return i.forEach(r=>{t.includes(r)?a[r]={value:$t(n[r]?.type),type:n[r]?.type}:a[r]={value:e[r],type:n[r]?.type}}),Zt({fields:r??[]}).forEach(e=>{a[e.key]===void 0&&(t.includes(e.key)?a[e.key]={value:$t(e.type),type:e.type}:a[e.key]={value:e.default,type:e.type})}),a},tn=e=>e?e.replaceAll(`{{config.`,`{{config__`).replaceAll(`{{userConfig.`,`{{userConfig__`):``,nn=async(e,t)=>await Kt(tn(e),t),rn=e=>{let t={...e,data:e.data.body??e.data,status:e.data.status_code??e.status};return{response:t,upstreamStatus:t.status,upstreamResponse:e.data.body}},an=(e,t,n)=>new E(e,t,n),on=(e,t)=>new E(e??500,void 0,void 0,t??`An unknown error occurred in the proxy`),sn=e=>{let{response:t,upstreamStatus:n,upstreamResponse:r}=rn(e);if(n>=400)throw an(200,n,r);return t},cn={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.dev/api`,integration:`https://integration.kizen.dev/api`,test1:`https://test1.kizen.dev/api`},ln={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`};function un(){let{apiKey:e,userId:t,businessId:i,environment:a}=n(),o=cn[a];return(0,r.useCallback)((n,r={})=>fetch(`/api/proxy${n}`,{...r,headers:{"x-proxy-target":o,"X-API-KEY":e,"X-USER-ID":t,"X-BUSINESS-ID":i,...r.headers}}),[o,e,t,i])}var dn=e=>async(t,n,r,i)=>{try{let a=await e.request(t,n,r,i);return sn({data:a,status:a.status_code??200})}catch(e){throw e instanceof E?e:o(e)&&n.startsWith(`/external-integrations/proxy`)?on(e.response?.status,e.response?.data?.error):e}};export{f as C,p as S,Je as _,nn as a,m as b,Zt as c,Ft as d,Kt as f,qt as g,Wt as h,un as i,Xt as l,Jt as m,cn as n,en as o,Yt as p,dn as r,Qt as s,ln as t,Lt as u,ee as v,c as w,g as x,d as y};
10
+ `+d(g,o):``,b=o?`: `:`:`;if(f&&f.toJSON&&typeof f.toJSON==`function`&&(f=f.toJSON()),f=m(t,a,f),f!==void 0){if(typeof f!=`object`||!f)return n(f);var x=function(e,t){return h&&e.length===0?t:(t===`[]`?`[`:`{`)+s(e,`,`)+y+(t===`[]`?`]`:`}`)};if(r(f)){for(var S=[],C=0;C<f.length;C++){var w=e(f,C,f[C],g+1)||n(null);S[S.length]=y+o+w}return x(S,`[]`)}if(c(v,f)!==-1){if(p)return n(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}else v[v.length]=f;for(var T=u(i(f),_&&_(f)),S=[],C=0;C<T.length;C++){var a=T[C],ee=e(f,a,f[a],g+1);if(ee){var E=n(a)+b+ee;S[S.length]=y+o+E}}return l(v,c(v,f),1),x(S,`{}`)}})({"":e},``,e,0)}}})(),1),Ft=e=>localStorage.getItem(`kizen-flag-${e}`)===`true`,It=(e=``)=>e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),Lt=e=>{try{return It((0,Pt.default)(e))}catch(e){return Ft(`script-runner-logging`)&&console.warn(`Failed to stringify object for hashing:`,e),It(String(Math.random()))}},Rt=e=>e.startsWith(`/`),zt=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],Bt=[`allow-popups`,`allow-scripts`,`allow-same-origin`],Vt=3e4,Ht=100,Ut=class{worker;scriptUIRef;onStateChange;done;onError;waitForFrame=!1;plugin;executionPlugin;frameId;onShowToast;onClearToasts;sessionData={};setSessionData;pluginComponentId;onShowModal;onShowCreateRecordModal;onShowCreateRelatedRecordModal;onReleaseBlockingScript;pluginApiName;onNetworkError;onNetworkRequest;invalidateCache;getPendingCacheCount;createFileId;performFileUpload;pushHistory;appPath;constructor(e){this.scriptUIRef=e.scriptUIRef,this.onStateChange=e.onStateChange,this.done=e.done,this.onError=e.onError,this.onReleaseBlockingScript=e.onReleaseBlockingScript,this.worker=e.worker,this.worker.onmessage=this.handleMessage,this.plugin=e.plugin,this.executionPlugin=e.executionPlugin,this.onShowToast=e.onShowToast,this.onClearToasts=e.onClearToasts,this.pluginComponentId=e.pluginComponentId,this.onShowModal=e.onShowModal,this.onShowCreateRecordModal=e.onShowCreateRecordModal,this.onShowCreateRelatedRecordModal=e.onShowCreateRelatedRecordModal,this.onNetworkError=e.onNetworkError,this.onNetworkRequest=e.onNetworkRequest,this.invalidateCache=e.invalidateCache,this.getPendingCacheCount=e.getPendingCacheCount,this.createFileId=e.createFileId,this.performFileUpload=e.performFileUpload,this.pushHistory=e.pushHistory,this.appPath=e.appPath,this.plugin&&(this.frameId=`${m}-${this.plugin.plugin_api_name}-${this.plugin.api_name}`),this.pluginApiName=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name??``,this.pluginApiName?(this.sessionData=e.sessionData[this.pluginApiName],this.setSessionData=t=>{e.setSessionData?.(this.pluginApiName,t)}):this.setSessionData=()=>{this.onError?.({message:`Script must be associated with a plugin to use session data`})}}handleMessage=async e=>{let t=JSON.parse(e.data),{action:n}=t;switch(n){case l.QUERY_REQUEST:{let e=t;await this.handleQueryRequest(e.id,e.method,e.url,e.payload,e.options);return}case l.UI_OUTPUT:{let e=t;this.handleUIOutput(e.markup);return}case l.IFRAME_OUTPUT:{let e=t;this.handleIframeOutput(e.url,e.allow,e.sandbox,e.preserve);return}case l.POSTFORMDATA_REQUEST:{let e=t;this.handleFormPostRequest(e.id,e.url,e.payload,e.createNewTab);return}case l.UPLOADFILE_REQUEST:{let e=t;await this.handleUploadFileRequest(e.id,e.payload);return}case l.SETSTATE:{let e=t;this.onStateChange?.(e.state);return}case l.DONE:{let e=t;this.handleDone(e.preserve,e.result);return}case u.ERROR:{let e=t;this.onError?.({message:e.error});return}case l.OPEN_WINDOW:{let e=t;this.handleOpenWindow(e.url,e.target,e.features);return}case l.COMMUNICATE:{let e=t;this.handleCommunication(e.type,e.recipient,e.args,e.params);return}case l.HIDE:{let{config:e}=t,n=!1;e.hideTrigger&&(n=!0),this.onStateChange?.({hidden:!0,triggerHidden:n});return}case l.SHOW:{let{config:e}=t,n=!1;e.showTrigger===!1&&(n=!0),this.onStateChange?.({hidden:!1,triggerHidden:n});return}case l.EXPAND:this.onStateChange?.({minimized:!1});return;case l.COLLAPSE:this.onStateChange?.({minimized:!0});return;case l.HIDE_HEADER:this.onStateChange?.({hideHeader:!0});return;case l.SHOW_HEADER:this.onStateChange?.({hideHeader:!1});return;case l.COPY_TO_CLIPBOARD:{let e=t;await this.copyToClipboard(e.text);return}case l.OPEN_CREATE_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRecordRequest(e.id,e.entityId);return}case l.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRelatedRecordRequest(e.id,e.objectId,e.relatedEntityId);return}case l.SHOW_TOAST:{let e=t;this.showToast(e.message,e.toastOptions);return}case l.CLEAR_TOASTS:this.clearToasts();return;case l.REFRESH_TIMELINE:{let e=t;this.handleRefreshTimeline(e.entityId);return}case l.REFRESH_ENTITY:{let e=t;await this.handleRefreshEntity(e.entityId,e.id);return}case l.UPDATE_SESSION_DATA:{let e=t;this.handleSetSessionData(e.update);return}case l.INSTALL_THIRD_PARTY_SCRIPT_REQUEST:{let e=t;this.handleInstallThirdPartyScriptRequest(e.id,e.url,e.args);return}case l.PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!1);return}case l.DYNAMIC_PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!0);return}case l.RELEASE_BLOCKING_SCRIPT:this.handleReleaseBlockingScript();return;case l.AUTHORIZE:{let e=t;this.handleAuthorize(e.serviceName,e.config);return}default:return}};handleCommunication=(e,t,n,r)=>{if(e===d.SEND_MESSAGE_TO_FRAME){if(this.frameId){let e=document.getElementById(this.frameId);e&&e.contentWindow?.postMessage({...n?.payload??{},__kizen:{recipient:t,frameId:this.frameId}},n?.path??`*`)}}else if(e===d.CALL_THIRD_PARTY_SCRIPT)this.handleCallThirdPartyScript(t.type,r);else{let r=this.executionPlugin?.plugin_api_name??this.plugin?.plugin_api_name,i=new CustomEvent(`integration:${e}`,{detail:{recipient:{...t,plugin:r},args:n}});window.dispatchEvent(i)}};handleDone=(e,t)=>{this.waitForFrame||this.done(e,t)};postMessage=(e,t)=>{this.worker.postMessage(JSON.stringify({action:e,...t}))};handleSetSessionData=e=>{this.setSessionData(e)};handleQueryRequest=async(e,t,n,r,i)=>{try{let a=await this.onNetworkRequest?.(t,n,r,i);this.postMessage(u.QUERY_RESPONSE,{data:a,id:e})}catch(t){this.onNetworkError?.(t);let n=t instanceof E?{__kizenError:!0,proxyStatus:t.proxyStatus,upstreamStatus:t.upstreamStatus,upstreamResponse:t.upstreamResponse,message:t.message}:(()=>{if(t instanceof Error)return{message:t.message,name:t.name};try{let e=JSON.parse(JSON.stringify(t));if(typeof e==`object`&&e&&!Array.isArray(e))return e}catch{}return{message:String(t)}})();this.postMessage(u.QUERY_RESPONSE,{error:n,id:e})}};handleUIOutput=e=>{if(this.scriptUIRef?.current){let t=Je.sanitize(e);this.scriptUIRef.current.innerHTML=t}};onLoad=e=>{e.iframe&&(this.waitForFrame=!1,this.handleDone(e.preserve))};handleIframeOutput=(e,t=[],n=[],r=!1)=>{if(this.scriptUIRef?.current){let i=t.filter(e=>zt.includes(e)),a=n.filter(e=>Bt.includes(e));this.waitForFrame=!0;let o=document.createElement(`iframe`);o.src=e,o.allow=i.join(`; `),a.forEach(e=>{o.sandbox.add(e)}),o.style.border=`none`,o.style.width=`100%`,o.style.height=`100%`,o.onload=this.onLoad.bind(this,{iframe:o,preserve:r}),this.frameId&&(o.id=this.frameId),this.scriptUIRef.current.replaceChildren(o)}};handleCreateRecordRequest=(e,t)=>{this.onShowCreateRecordModal?.(t,t=>{this.postMessage(u.CREATE_RECORD_RESPONSE,{id:e,data:t})})};handleCreateRelatedRecordRequest=(e,t,n)=>{this.onShowCreateRelatedRecordModal?.(t,n,t=>{this.postMessage(u.CREATE_RELATED_RECORD_RESPONSE,{id:e,data:t})})};showToast=(e,t)=>{this.onShowToast?.({message:e,variant:t?.variant??`success`,autohide:t?.autohide??!0})};clearToasts=()=>{this.onClearToasts?.()};copyToClipboard=async e=>{try{await navigator.clipboard.writeText(e)}catch(e){this.onError?.({message:e.message})}};handleRefreshTimeline=e=>{this.invalidateCache?.(`timeline`,e)};waitForIdleState=e=>new Promise(t=>{let n=0,r=setInterval(()=>{(this.getPendingCacheCount?.(e)??0)===0?(clearInterval(r),t(!0)):(n+=1,n>Math.floor(Vt/Ht)&&(clearInterval(r),t(!1)))},Ht)});handleRefreshEntity=async(e,t)=>{this.invalidateCache?.(`entity`,e);let n=await this.waitForIdleState(e);this.postMessage(u.REFRESH_ENTITY_RESPONSE,{id:t,data:{success:n}})};handleFormPostRequest=(e,t,n,r)=>{let i=document.createElement(`form`);i.method=`POST`,i.action=t,r&&(i.target=`_blank`);for(let e in n){let t=document.createElement(`input`);t.type=`hidden`,t.name=e,t.value=n[e],i.appendChild(t)}document.body.appendChild(i),i.submit(),r&&document.body.removeChild(i),this.postMessage(u.POSTFORMDATA_RESPONSE,{success:!0,id:e})};handleUploadFileRequest=async(e,t)=>{if(!this.performFileUpload){this.postMessage(u.UPLOADFILE_RESPONSE,{error:`File upload not supported`,id:e});return}let{file:n,isPublic:r=!1,fileName:i}=t,a=await(await fetch(n)).blob(),o=new File([a],i??`upload-${new Date().toISOString()}`,{type:a.type});o.$id=this.createFileId?.()??T();let s=await this.performFileUpload({file:o,id:o.$id,publicFile:r,source:`field_value`,handleProgress:e=>{this.postMessage(u.UPLOADFILE_PROGRESS,{fileId:e.id,progress:e.progress})},businessId:void 0});this.postMessage(u.UPLOADFILE_RESPONSE,{data:s,id:e})};waitForReadyState=(e,t,n=0)=>{e||t?.(!0),e?.()?t?.(!0):n<20?setTimeout(()=>{this.waitForReadyState(e,t,n+1)},n*50):t?.(!1)};handleCallThirdPartyScript=(e,t=[])=>{if(e&&x[e]){let n=x[e],r=window[n];r?.(...t)}};handleReleaseBlockingScript=()=>this.onReleaseBlockingScript?.(this.executionPlugin);handlePromptRequest=(e,t,n=!1)=>{this.onShowModal?this.onShowModal({...t,pluginApiName:this.pluginApiName??``,dynamic:n},(t={})=>{this.postMessage(u.PROMPT_RESPONSE,{id:e,data:t})}):this.postMessage(u.PROMPT_RESPONSE,{id:e,data:{canceled:!0}})};handleInstallThirdPartyScriptRequest=(e,t,n={})=>{let r=b(t);if(!r){this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e});return}let i=S[r];i(n);let a=document.createElement(`script`);a.onload=()=>{this.waitForReadyState(C[r],n=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,matched:n},id:e})})},a.onerror=()=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e})},a.src=t,a.setAttribute(`data-script-url`,t),document.querySelectorAll(`[data-script-url="`+t+`"]`).length>0?this.waitForReadyState(C[r],n=>{this.postMessage(u.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,reused:!0,matched:n},id:e})}):document.documentElement.firstChild?.appendChild(a)};handleOpenWindow=(e,t,n)=>{!Rt(e)||t===`_blank`||!this.pushHistory?window.open(e,t,n):this.pushHistory(e)};handleAuthorize=(e,t={})=>{let n=new URLSearchParams;if(t.successRedirectPath&&n.append(`success_redirect_path`,t.successRedirectPath),t.errorRedirectPath&&n.append(`error_redirect_path`,t.errorRedirectPath),!this.appPath){this.onError?.({message:`App path is not defined.`});return}if(!this.pluginApiName){this.onError?.({message:`Plugin API name is not defined.`});return}let r=n.toString();this.handleOpenWindow(`${this.appPath}/external-integrations/business-plugin-apps/${this.pluginApiName}/services/${encodeURIComponent(e)}/authorize${r?`?${r}`:``}`,`_blank`,``)};run=(e,t,n)=>{let r=w();this.postMessage(l.RUN,{script:e,setup:t,args:n,sessionData:this.sessionData,pluginComponentId:this.pluginComponentId,pluginApiName:this.pluginApiName,location:r})}},Wt=async({scriptBody:e,user:t,teamMember:n,business:r,onError:i,onReleaseBlockingScript:a,setLoadingState:o,clientObject:s,scriptUIRef:c,onStateChange:l,workerName:u,context:d,args:f=``,plugin:p,onShowToast:m,onClearToasts:h,terminators:g,executionPlugin:_,sessionData:v,setSessionData:y,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,onNetworkRequest:w,appPath:T,pushHistory:ee,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:k})=>{let te=Ft(`script-runner-logging`),A;return A=u===`recordDetail`?new Worker(new URL(`/assets/recordDetail.worker-B-1qFS5m.js`,``+import.meta.url),{type:`module`}):u===`genericPlugin`?new Worker(new URL(`/assets/generic.worker-Bzr3c9PO.js`,``+import.meta.url),{type:`module`}):u===`floatingFramePlugin`?new Worker(new URL(`/assets/floatingFrame.worker-CKAMagoG.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/calendarSource.worker-DGRTJYHs.js`,``+import.meta.url),{type:`module`}),new Promise(u=>{let ne=It(e),j=It(f),M=`${p?.plugin_api_name??``}-${p?.api_name??``}-${String(ne)}-${String(j)}`,N=`${p?.plugin_api_name??``}-${p?.api_name??``}`;_?.field_type?(M=`${_.plugin_api_name??``}-${_.field_type}-${String(ne)}-${String(j)}`,N=`${_.plugin_api_name??``}-${_.field_type??_.script_id}`):_&&(M=`${_.plugin_api_name??``}-${_.api_name}-${String(ne)}-${String(j)}`,N=`${_.plugin_api_name??``}-${_.api_name}`),g.current[M]&&(g.current[M]?.forEach(e=>{e()}),g.current[M]=[]),g.current[M]??=[],g.current[M]?.push(()=>{A.terminate()});let re=new Ut({worker:A,done:(e,t)=>{o(!1),e||(g.current[M]?.forEach(e=>{e()}),g.current[M]=[]),u(t)},onError:i,onReleaseBlockingScript:a,scriptUIRef:c,onStateChange:l,plugin:p,executionPlugin:_,onShowToast:m,onClearToasts:h,sessionData:v,setSessionData:y,pluginComponentId:N,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:S,onNetworkError:C,pushHistory:ee,onNetworkRequest:w,appPath:T,createFileId:E,performFileUpload:D,getPendingCacheCount:O,invalidateCache:k});o(!0),re.run(e,{...d,user:t,teamMember:n,business:r,clientObject:s,appPath:T,isDebug:te},f)})},Gt=(e,t)=>{let n=new Worker(new URL(`/assets/expression.worker-Cin-WNVB.js`,``+import.meta.url),{type:`module`});return new Promise(r=>{n.onmessage=e=>{let t=JSON.parse(e.data);n.terminate(),r(t.result)};let i=Ft(`script-runner-logging`);n.postMessage(JSON.stringify({expression:e,args:t,isDebug:i}))})},Kt=async(e,t)=>await Gt(e,t),qt=async(e,t)=>await Gt(e,t),Jt=async(e,t)=>await Gt(e,t),Yt=async(e,t)=>await Gt(e,t),Xt=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),Zt=(e,t)=>{let n=(e.fields??[]).filter(e=>e.type!==`container`&&e.type!==`description`).map(e=>({...e,when:t?`(${t}) && (${e.when??`true`})`:e.when})),r=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>Zt(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...Xt(e),match_hint:e.hint_object_name??``}))]},Qt=(e,t)=>{let n=Zt(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`text`:{let t=r?.value;if(t){i[e]=t;return}let n=a.default;n&&(i[e]=n);return}case`description`:case`container`:return}return r?.value}}),i},$t=e=>{if(e===`boolean`)return!1},en=(e,t,n,r)=>{let i=Object.keys(e),a={};return i.forEach(r=>{t.includes(r)?a[r]={value:$t(n[r]?.type),type:n[r]?.type}:a[r]={value:e[r],type:n[r]?.type}}),Zt({fields:r??[]}).forEach(e=>{a[e.key]===void 0&&(t.includes(e.key)?a[e.key]={value:$t(e.type),type:e.type}:a[e.key]={value:e.default,type:e.type})}),a},tn=e=>e?e.replaceAll(`{{config.`,`{{config__`).replaceAll(`{{userConfig.`,`{{userConfig__`):``,nn=async(e,t)=>await Kt(tn(e),t),rn=e=>{let t={...e,data:e.data.body??e.data,status:e.data.status_code??e.status};return{response:t,upstreamStatus:t.status,upstreamResponse:e.data.body}},an=(e,t,n)=>new E(e,t,n),on=(e,t)=>new E(e??500,void 0,void 0,t??`An unknown error occurred in the proxy`),sn=e=>{let{response:t,upstreamStatus:n,upstreamResponse:r}=rn(e);if(n>=400)throw an(200,n,r);return t},cn={go:`https://app.go.kizen.com/api`,fmo:`https://app.fmo.kizen.com/api`,staging:`https://staging.kizen.dev/api`,integration:`https://integration.kizen.dev/api`,test1:`https://test1.kizen.dev/api`},ln={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`};function un(){let{apiKey:e,userId:t,businessId:i,environment:a}=n(),o=cn[a];return(0,r.useCallback)((n,r={})=>fetch(`/api/proxy${n}`,{...r,headers:{"x-proxy-target":o,"X-API-KEY":e,"X-USER-ID":t,"X-BUSINESS-ID":i,...r.headers}}),[o,e,t,i])}var dn=e=>async(t,n,r,i)=>{if(n.startsWith(`/external-integrations/proxy`))try{let a=await e.request(t,n,r,i);return sn({data:a,status:a.status_code??200})}catch(e){throw e instanceof E?e:o(e)?on(e.response?.status,e.response?.data?.error):e}else return{data:await e.request(t,n,r,i)}};export{f as C,p as S,Je as _,nn as a,m as b,Zt as c,Ft as d,Kt as f,qt as g,Wt as h,un as i,Xt as l,Jt as m,cn as n,en as o,Yt as p,dn as r,Qt as s,ln as t,Lt as u,ee as v,c as w,g as x,d as y};
@@ -1 +1 @@
1
- import{a as e,i as t}from"./storageKeys-C6c8YF5Y.js";import{s as n}from"./api-BcUybEsl.js";function r(e){function t(t){try{let n=localStorage.getItem(e(t));return n?JSON.parse(n):null}catch{return null}}function r(t,r,i){let a={__kizen_setup_assistant_values:r,__kizen_clean_config:n(i,r)};localStorage.setItem(e(t),JSON.stringify(a))}function i(t,n){let r={__kizen_setup_assistant_values:{},__kizen_clean_config:n};localStorage.setItem(e(t),JSON.stringify(r))}function a(t){localStorage.removeItem(e(t))}return{load:t,save:r,saveRaw:i,clear:a}}var i=r(t),a=r(e),o=i.load,s=i.save,c=i.saveRaw,l=i.clear,u=a.load,d=a.save,f=a.clear;function p(e,t){return i.load(e)?.__kizen_clean_config||(t??null)}export{p as a,d as c,u as i,f as n,s as o,o as r,c as s,l as t};
1
+ import{a as e,i as t}from"./storageKeys-C6c8YF5Y.js";import{s as n}from"./api-DtXiAEKW.js";function r(e){function t(t){try{let n=localStorage.getItem(e(t));return n?JSON.parse(n):null}catch{return null}}function r(t,r,i){let a={__kizen_setup_assistant_values:r,__kizen_clean_config:n(i,r)};localStorage.setItem(e(t),JSON.stringify(a))}function i(t,n){let r={__kizen_setup_assistant_values:{},__kizen_clean_config:n};localStorage.setItem(e(t),JSON.stringify(r))}function a(t){localStorage.removeItem(e(t))}return{load:t,save:r,saveRaw:i,clear:a}}var i=r(t),a=r(e),o=i.load,s=i.save,c=i.saveRaw,l=i.clear,u=a.load,d=a.save,f=a.clear;function p(e,t){return i.load(e)?.__kizen_clean_config||(t??null)}export{p as a,d as c,u as i,f as n,s as o,o as r,c as s,l as t};