@kizenapps/cli 1.0.0-f7bc09a → 1.1.0-431518c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/viewer/assets/CodeStepsPage-nECzIPiV.js +1 -0
- package/dist/viewer/assets/ConfigurationPage-D0tcJxje.js +1 -0
- package/dist/viewer/assets/SandboxPage-Bnp6YAtk.js +1 -0
- package/dist/viewer/assets/{WhenBadge-P9aN2Qd7.js → WhenBadge-pfupnVMz.js} +1 -1
- package/dist/viewer/assets/{calendarSource.worker-C9iglnKD.js → calendarSource.worker-DGRTJYHs.js} +4 -4
- package/dist/viewer/assets/configStorage-TfZCyGrB.js +10 -0
- package/dist/viewer/assets/floatingFrame.worker-CKAMagoG.js +23 -0
- package/dist/viewer/assets/{generic.worker-DRXu0-5B.js → generic.worker-Bzr3c9PO.js} +4 -4
- package/dist/viewer/assets/{index-BXPMaCXm.js → index-BVpA7WNR.js} +2 -2
- package/dist/viewer/assets/{recordDetail.worker-C0-mQTaj.js → recordDetail.worker-B-1qFS5m.js} +6 -6
- package/dist/viewer/assets/useCriticalExceptionDialog-FcLgRoVH.js +5 -0
- package/dist/viewer/index.html +1 -1
- package/package.json +2 -2
- package/dist/viewer/assets/CodeStepsPage-bUqixBkt.js +0 -1
- package/dist/viewer/assets/ConfigurationPage-egBHLNoe.js +0 -1
- package/dist/viewer/assets/SandboxPage-CWOkZs5g.js +0 -1
- package/dist/viewer/assets/configStorage-DcQWEL9-.js +0 -10
- package/dist/viewer/assets/floatingFrame.worker-CWLtchq3.js +0 -23
- package/dist/viewer/assets/useCriticalExceptionDialog-BI_gNDBK.js +0 -5
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as e,i as t}from"./storageKeys-C6c8YF5Y.js";var n={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`},r={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`},i={RUN_FRAME_SCRIPT:`runframescript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},a=`integration:route-change`,o=`kizen-route-change`,s=`kzn-integration-frame`,c=[`__plugin_engine`,`1.2.2`],l={CALENDAR_SOURCE_CALENDAR_LIST:(e,t)=>[...c,`calendar-source`,`calendar-list`,e,t],CALENDAR_SOURCE_EVENTS:(e,t,n,r)=>[...c,`calendar-source`,`events`,e,t,n,r]},u=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,d=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,f={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},p=e=>{if(u.test(e))return f.FRESHWORKS;if(d.test(e))return f.INTERCOM},m={[f.FRESHWORKS]:`FreshworksWidget`,[f.INTERCOM]:`Intercom`},h={[f.FRESHWORKS]:e=>{window.fwSettings={widget_id:e.widgetId},(function(...e){if(typeof window[m[f.FRESHWORKS]]!=`function`){let t=function(){t.q.push(...e)};t.__kizen_pending=!0,t.q=[],window[m[f.FRESHWORKS]]=t}})()},[f.INTERCOM]:()=>{(function(){if(typeof window[m[f.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[m[f.INTERCOM]]=t}})()}},g={[f.FRESHWORKS]:()=>window[m[f.FRESHWORKS]]?.__kizen_pending!==!0,[f.INTERCOM]:()=>window[m[f.INTERCOM]]?.__kizen_pending!==!0},_=()=>({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}),v=()=>{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 y=e=>`${e?.plugin_api_name??``}-${e?.id??``}-${e?.api_name??``}-${e?.script_id??``}`,b=Object.create,x=Object.defineProperty,S=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyNames,w=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(e,t)=>function(){return t||(0,e[C(e)[0]])((t={exports:{}}).exports,t),t.exports},D=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of C(t))!T.call(e,i)&&i!==n&&x(e,i,{get:()=>t[i],enumerable:!(r=S(t,i))||r.enumerable});return e},ee=(e,t,n)=>(n=e==null?{}:b(w(e)),D(t||!e||!e.__esModule?x(n,`default`,{value:e,enumerable:!0}):n,e)),{entries:O,setPrototypeOf:k,isFrozen:te,getPrototypeOf:A,getOwnPropertyDescriptor:ne}=Object,{freeze:j,seal:M,create:N}=Object,{apply:P,construct:re}=typeof Reflect<`u`&&Reflect;j||=function(e){return e},M||=function(e){return e},P||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},re||=function(e){return new e(...[...arguments].slice(1))};var ie=L(Array.prototype.forEach),ae=L(Array.prototype.lastIndexOf),oe=L(Array.prototype.pop),se=L(Array.prototype.push),ce=L(Array.prototype.splice),le=L(String.prototype.toLowerCase),ue=L(String.prototype.toString),de=L(String.prototype.match),fe=L(String.prototype.replace),pe=L(String.prototype.indexOf),me=L(String.prototype.trim),F=L(Object.prototype.hasOwnProperty),I=L(RegExp.prototype.test),he=R(TypeError);function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return P(e,t,n)}}function R(e){return function(){return re(e,[...arguments])}}function z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:le;k&&k(e,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(te(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ge(e){for(let t=0;t<e.length;t++)F(e,t)||(e[t]=null);return e}function B(e){let t=N(null);for(let[n,r]of O(e))F(e,n)&&(Array.isArray(r)?t[n]=ge(r):r&&typeof r==`object`&&r.constructor===Object?t[n]=B(r):t[n]=r);return t}function _e(e,t){for(;e!==null;){let n=ne(e,t);if(n){if(n.get)return L(n.get);if(typeof n.value==`function`)return L(n.value)}e=A(e)}function n(){return null}return n}var ve=j(`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(`.`)),ye=j(`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(`.`)),be=j([`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`]),xe=j([`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`]),Se=j(`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(`.`)),Ce=j([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),we=j([`#text`]),Te=j(`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.slot`.split(`.`)),Ee=j(`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(`.`)),De=j(`accent.accentunder.align.bevelled.close.columnsalign.columnlines.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lspace.lquote.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(`.`)),Oe=j([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),V=M(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ke=M(/<%[\w\W]*|[\w\W]*%>/gm),H=M(/\$\{[\w\W]*/gm),Ae=M(/^data-[\-\w.\u00B7-\uFFFF]+$/),je=M(/^aria-[\-\w]+$/),Me=M(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),U=M(/^(?:\w+script|data):/i),Ne=M(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pe=M(/^html$/i),Fe=M(/^[a-z][.\w]*(-[.\w]+)+$/i),Ie=Object.freeze({__proto__:null,ARIA_ATTR:je,ATTR_WHITESPACE:Ne,CUSTOM_ELEMENT:Fe,DATA_ATTR:Ae,DOCTYPE_NAME:Pe,ERB_EXPR:ke,IS_ALLOWED_URI:Me,IS_SCRIPT_OR_DATA:U,MUSTACHE_EXPR:V,TMPLIT_EXPR:H}),Le={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Re=function(){return typeof window>`u`?null:window},ze=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}},Be=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ve(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Re(),t=e=>Ve(e);if(t.version=`3.3.3`,t.removed=[],!e||!e.document||e.document.nodeType!==Le.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e,r=n,i=r.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:s,Element:c,NodeFilter:l,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:d,DOMParser:f,trustedTypes:p}=e,m=c.prototype,h=_e(m,`cloneNode`),g=_e(m,`remove`),_=_e(m,`nextSibling`),v=_e(m,`childNodes`),y=_e(m,`parentNode`);if(typeof o==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let b,x=``,{implementation:S,createNodeIterator:C,createDocumentFragment:w,getElementsByTagName:T}=n,{importNode:E}=r,D=Be();t.isSupported=typeof O==`function`&&typeof y==`function`&&S&&S.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:ee,ERB_EXPR:k,TMPLIT_EXPR:te,DATA_ATTR:A,ARIA_ATTR:ne,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:P,CUSTOM_ELEMENT:re}=Ie,{IS_ALLOWED_URI:L}=Ie,R=null,ge=z({},[...ve,...ye,...be,...Se,...we]),V=null,ke=z({},[...Te,...Ee,...De,...Oe]),H=Object.seal(N(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}})),Ae=null,je=null,U=Object.seal(N(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ne=!0,Fe=!0,He=!1,Ue=!0,We=!1,Ge=!0,W=!1,Ke=!1,qe=!1,Je=!1,Ye=!1,Xe=!1,Ze=!0,Qe=!1,$e=!0,et=!1,G={},K=null,tt=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`]),nt=null,rt=z({},[`audio`,`video`,`img`,`source`,`image`,`track`]),it=null,at=z({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),ot=`http://www.w3.org/1998/Math/MathML`,st=`http://www.w3.org/2000/svg`,q=`http://www.w3.org/1999/xhtml`,J=q,ct=!1,lt=null,ut=z({},[ot,st,q],ue),dt=z({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),ft=z({},[`annotation-xml`]),pt=z({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],Y=null,X=null,gt=n.createElement(`form`),_t=function(e){return e instanceof RegExp||e instanceof Function},vt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=B(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=mt===`application/xhtml+xml`?ue:le,R=F(e,`ALLOWED_TAGS`)?z({},e.ALLOWED_TAGS,Y):ge,V=F(e,`ALLOWED_ATTR`)?z({},e.ALLOWED_ATTR,Y):ke,lt=F(e,`ALLOWED_NAMESPACES`)?z({},e.ALLOWED_NAMESPACES,ue):ut,it=F(e,`ADD_URI_SAFE_ATTR`)?z(B(at),e.ADD_URI_SAFE_ATTR,Y):at,nt=F(e,`ADD_DATA_URI_TAGS`)?z(B(rt),e.ADD_DATA_URI_TAGS,Y):rt,K=F(e,`FORBID_CONTENTS`)?z({},e.FORBID_CONTENTS,Y):tt,Ae=F(e,`FORBID_TAGS`)?z({},e.FORBID_TAGS,Y):B({}),je=F(e,`FORBID_ATTR`)?z({},e.FORBID_ATTR,Y):B({}),G=F(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ne=e.ALLOW_ARIA_ATTR!==!1,Fe=e.ALLOW_DATA_ATTR!==!1,He=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ue=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,We=e.SAFE_FOR_TEMPLATES||!1,Ge=e.SAFE_FOR_XML!==!1,W=e.WHOLE_DOCUMENT||!1,Je=e.RETURN_DOM||!1,Ye=e.RETURN_DOM_FRAGMENT||!1,Xe=e.RETURN_TRUSTED_TYPE||!1,qe=e.FORCE_BODY||!1,Ze=e.SANITIZE_DOM!==!1,Qe=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,et=e.IN_PLACE||!1,L=e.ALLOWED_URI_REGEXP||Me,J=e.NAMESPACE||q,dt=e.MATHML_TEXT_INTEGRATION_POINTS||dt,ft=e.HTML_INTEGRATION_POINTS||ft,H=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(H.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),We&&(Fe=!1),Ye&&(Je=!0),G&&(R=z({},we),V=N(null),G.html===!0&&(z(R,ve),z(V,Te)),G.svg===!0&&(z(R,ye),z(V,Ee),z(V,Oe)),G.svgFilters===!0&&(z(R,be),z(V,Ee),z(V,Oe)),G.mathMl===!0&&(z(R,Se),z(V,De),z(V,Oe))),F(e,`ADD_TAGS`)||(U.tagCheck=null),F(e,`ADD_ATTR`)||(U.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS==`function`?U.tagCheck=e.ADD_TAGS:(R===ge&&(R=B(R)),z(R,e.ADD_TAGS,Y))),e.ADD_ATTR&&(typeof e.ADD_ATTR==`function`?U.attributeCheck=e.ADD_ATTR:(V===ke&&(V=B(V)),z(V,e.ADD_ATTR,Y))),e.ADD_URI_SAFE_ATTR&&z(it,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(K===tt&&(K=B(K)),z(K,e.FORBID_CONTENTS,Y)),e.ADD_FORBID_CONTENTS&&(K===tt&&(K=B(K)),z(K,e.ADD_FORBID_CONTENTS,Y)),$e&&(R[`#text`]=!0),W&&z(R,[`html`,`head`,`body`]),R.table&&(z(R,[`tbody`]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw he(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw he(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);b=e.TRUSTED_TYPES_POLICY,x=b.createHTML(``)}else b===void 0&&(b=ze(p,i)),b!==null&&typeof x==`string`&&(x=b.createHTML(``));j&&j(e),X=e}},yt=z({},[...ye,...be,...xe]),bt=z({},[...Se,...Ce]),xt=function(e){let t=y(e);(!t||!t.tagName)&&(t={namespaceURI:J,tagName:`template`});let n=le(e.tagName),r=le(t.tagName);return lt[e.namespaceURI]?e.namespaceURI===st?t.namespaceURI===q?n===`svg`:t.namespaceURI===ot?n===`svg`&&(r===`annotation-xml`||dt[r]):!!yt[n]:e.namespaceURI===ot?t.namespaceURI===q?n===`math`:t.namespaceURI===st?n===`math`&&ft[r]:!!bt[n]:e.namespaceURI===q?t.namespaceURI===st&&!ft[r]||t.namespaceURI===ot&&!dt[r]?!1:!bt[n]&&(pt[n]||!yt[n]):!!(mt===`application/xhtml+xml`&<[e.namespaceURI]):!1},Z=function(e){se(t.removed,{element:e});try{y(e).removeChild(e)}catch{g(e)}},Q=function(e,n){try{se(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{se(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Je||Ye)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},St=function(e){let t=null,r=null;if(qe)e=`<remove></remove>`+e;else{let t=de(e,/^[\r\n\t ]+/);r=t&&t[0]}mt===`application/xhtml+xml`&&J===q&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=b?b.createHTML(e):e;if(J===q)try{t=new f().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=S.createDocument(J,`template`,null);try{t.documentElement.innerHTML=ct?x:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),J===q?T.call(t,W?`html`:`body`)[0]:W?t.documentElement:a},Ct=function(e){return C.call(e.ownerDocument||e,e,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},wt=function(e){return e instanceof d&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof u)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},Tt=function(e){return typeof s==`function`&&e instanceof s};function $(e,n,r){ie(e,e=>{e.call(t,n,r,X)})}let Et=function(e){let n=null;if($(D.beforeSanitizeElements,e,null),wt(e))return Z(e),!0;let r=Y(e.nodeName);if($(D.uponSanitizeElement,e,{tagName:r,allowedTags:R}),Ge&&e.hasChildNodes()&&!Tt(e.firstElementChild)&&I(/<[/\w!]/g,e.innerHTML)&&I(/<[/\w!]/g,e.textContent)||e.nodeType===Le.progressingInstruction||Ge&&e.nodeType===Le.comment&&I(/<[/\w]/g,e.data))return Z(e),!0;if(!(U.tagCheck instanceof Function&&U.tagCheck(r))&&(!R[r]||Ae[r])){if(!Ae[r]&&Ot(r)&&(H.tagNameCheck instanceof RegExp&&I(H.tagNameCheck,r)||H.tagNameCheck instanceof Function&&H.tagNameCheck(r)))return!1;if($e&&!K[r]){let t=y(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=h(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,_(e))}}}return Z(e),!0}return e instanceof c&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&I(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(We&&e.nodeType===Le.text&&(n=e.textContent,ie([ee,k,te],e=>{n=fe(n,e,` `)}),e.textContent!==n&&(se(t.removed,{element:e.cloneNode()}),e.textContent=n)),$(D.afterSanitizeElements,e,null),!1)},Dt=function(e,t,r){if(je[t]||Ze&&(t===`id`||t===`name`)&&(r in n||r in gt))return!1;if(!(Fe&&!je[t]&&I(A,t))&&!(Ne&&I(ne,t))&&!(U.attributeCheck instanceof Function&&U.attributeCheck(t,e))){if(!V[t]||je[t]){if(!(Ot(e)&&(H.tagNameCheck instanceof RegExp&&I(H.tagNameCheck,e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(e))&&(H.attributeNameCheck instanceof RegExp&&I(H.attributeNameCheck,t)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(t,e))||t===`is`&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&I(H.tagNameCheck,r)||H.tagNameCheck instanceof Function&&H.tagNameCheck(r))))return!1}else if(!it[t]&&!I(L,fe(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&pe(r,`data:`)===0&&nt[e])&&!(He&&!I(M,fe(r,P,``)))&&r)return!1}return!0},Ot=function(e){return e!==`annotation-xml`&&de(e,re)},kt=function(e){$(D.beforeSanitizeAttributes,e,null);let{attributes:n}=e;if(!n||wt(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:V,forceKeepAttr:void 0},i=n.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=n[i],c=Y(a),l=s,u=a===`value`?l:me(l);if(r.attrName=c,r.attrValue=u,r.keepAttr=!0,r.forceKeepAttr=void 0,$(D.uponSanitizeAttribute,e,r),u=r.attrValue,Qe&&(c===`id`||c===`name`)&&(Q(a,e),u=`user-content-`+u),Ge&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,u)){Q(a,e);continue}if(c===`attributename`&&de(u,`href`)){Q(a,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Q(a,e);continue}if(!Ue&&I(/\/>/i,u)){Q(a,e);continue}We&&ie([ee,k,te],e=>{u=fe(u,e,` `)});let d=Y(e.nodeName);if(!Dt(d,c,u)){Q(a,e);continue}if(b&&typeof p==`object`&&typeof p.getAttributeType==`function`&&!o)switch(p.getAttributeType(d,c)){case`TrustedHTML`:u=b.createHTML(u);break;case`TrustedScriptURL`:u=b.createScriptURL(u);break}if(u!==l)try{o?e.setAttributeNS(o,a,u):e.setAttribute(a,u),wt(e)?Z(e):oe(t.removed)}catch{Q(a,e)}}$(D.afterSanitizeAttributes,e,null)},At=function e(t){let n=null,r=Ct(t);for($(D.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(D.uponSanitizeShadowNode,n,null),Et(n),kt(n),n.content instanceof a&&e(n.content);$(D.afterSanitizeShadowDOM,t,null)};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(ct=!e,ct&&(e=`<!-->`),typeof e!=`string`&&!Tt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw he(`dirty is not a string, aborting`)}else throw he(`toString is not a function`);if(!t.isSupported)return e;if(Ke||vt(n),t.removed=[],typeof e==`string`&&(et=!1),et){if(e.nodeName){let t=Y(e.nodeName);if(!R[t]||Ae[t])throw he(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof s)i=St(`<!---->`),o=i.ownerDocument.importNode(e,!0),o.nodeType===Le.element&&o.nodeName===`BODY`||o.nodeName===`HTML`?i=o:i.appendChild(o);else{if(!Je&&!We&&!W&&e.indexOf(`<`)===-1)return b&&Xe?b.createHTML(e):e;if(i=St(e),!i)return Je?null:Xe?x:``}i&&qe&&Z(i.firstChild);let u=Ct(et?e:i);for(;c=u.nextNode();)Et(c),kt(c),c.content instanceof a&&At(c.content);if(et)return e;if(Je){if(Ye)for(l=w.call(i.ownerDocument);i.firstChild;)l.appendChild(i.firstChild);else l=i;return(V.shadowroot||V.shadowrootmode)&&(l=E.call(r,l,!0)),l}let d=W?i.outerHTML:i.innerHTML;return W&&R[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&I(Pe,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
2
|
-
`+d),We&&ie([ee,k,te],e=>{d=fe(d,e,` `)}),b&&Xe?b.createHTML(d):d},t.setConfig=function(){vt(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Ke=!0},t.clearConfig=function(){X=null,Ke=!1},t.isValidAttribute=function(e,t,n){return X||vt({}),Dt(Y(e),Y(t),n)},t.addHook=function(e,t){typeof t==`function`&&se(D[e],t)},t.removeHook=function(e,t){if(t!==void 0){let n=ae(D[e],t);return n===-1?void 0:ce(D[e],n,1)[0]}return oe(D[e])},t.removeHooks=function(e){D[e]=[]},t.removeAllHooks=function(){D=Be()},t}var He=Ve(),Ue=E({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/lib/parse.js"(e,t){var n,r,i={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
3
|
-
`,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}}}),We=E({"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?`[
|
|
4
|
-
`+r+f.join(`,
|
|
5
|
-
`+r)+`
|
|
6
|
-
`+d+`]`:`[`+f.join(`,`)+`]`,r=d,l}if(o&&typeof o==`object`)for(u=o.length,n=0;n<u;n+=1)a=o[n],typeof a==`string`&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));else for(a in p)Object.prototype.hasOwnProperty.call(p,a)&&(l=c(a,p),l&&f.push(s(a)+(r?`: `:`:`)+l));return l=f.length===0?`{}`:r?`{
|
|
7
|
-
`+r+f.join(`,
|
|
8
|
-
`+r)+`
|
|
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})}}}),Ge=E({"node_modules/.pnpm/jsonify@0.0.1/node_modules/jsonify/index.js"(e){e.parse=Ue(),e.stringify=We()}}),W=E({"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]`}}}),Ke=E({"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}}}),qe=E({"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=Ke(),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}}),Je=E({"node_modules/.pnpm/object-keys@1.1.1/node_modules/object-keys/index.js"(e,t){var n=Array.prototype.slice,r=Ke(),i=Object.keys,a=i?function(e){return i(e)}:qe(),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}}),Ye=E({"node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(e,t){t.exports=Object}}),Xe=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(e,t){t.exports=Error}}),Ze=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(e,t){t.exports=EvalError}}),Qe=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(e,t){t.exports=RangeError}}),$e=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(e,t){t.exports=ReferenceError}}),et=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(e,t){t.exports=SyntaxError}}),G=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(e,t){t.exports=TypeError}}),K=E({"node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(e,t){t.exports=URIError}}),tt=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(e,t){t.exports=Math.abs}}),nt=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(e,t){t.exports=Math.floor}}),rt=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(e,t){t.exports=Math.max}}),it=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(e,t){t.exports=Math.min}}),at=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(e,t){t.exports=Math.pow}}),ot=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(e,t){t.exports=Math.round}}),st=E({"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}}}),q=E({"node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(e,t){var n=st();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}}}),J=E({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(e,t){t.exports=Object.getOwnPropertyDescriptor}}),ct=E({"node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(e,t){var n=J();if(n)try{n([],`length`)}catch{n=null}t.exports=n}}),lt=E({"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}}),ut=E({"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}}}),dt=E({"node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(e,t){var n=typeof Symbol<`u`&&Symbol,r=ut();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}}}),ft=E({"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}}),pt=E({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(e,t){t.exports=Ye().getPrototypeOf||null}}),mt=E({"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}}}),ht=E({"node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(e,t){var n=mt();t.exports=Function.prototype.bind||n}}),Y=E({"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}}),X=E({"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}}),gt=E({"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}}),_t=E({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(e,t){var n=ht(),r=X(),i=Y();t.exports=gt()||n.call(i,r)}}),vt=E({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(e,t){var n=ht(),r=G(),i=Y(),a=_t();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}}}),yt=E({"node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(e,t){var n=vt(),r=ct(),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}}),bt=E({"node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(e,t){var n=ft(),r=pt(),i=yt();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}}),xt=E({"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=ht().call(n,r)}}),Z=E({"node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(e,t){var n,r=Ye(),i=Xe(),a=Ze(),o=Qe(),s=$e(),c=et(),l=G(),u=K(),d=tt(),f=nt(),p=rt(),m=it(),h=at(),g=ot(),_=q(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=ct(),x=lt(),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=dt()(),T=bt(),E=pt(),D=ft(),ee=X(),O=Y(),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%":ee,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};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=ht(),P=xt(),re=N.call(O,Array.prototype.concat),ie=N.call(ee,Array.prototype.splice),ae=N.call(O,String.prototype.replace),oe=N.call(O,String.prototype.slice),se=N.call(O,RegExp.prototype.exec),ce=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,le=/\\(\\)?/g,ue=function(e){var t=oe(e,0,1),n=oe(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 ae(e,ce,function(e,t,n,i){r[r.length]=n?ae(i,le,`$1`):t||e}),r},de=function(e,t){var n=e,r;if(P(M,n)&&(r=M[n],n=`%`+r[0]+`%`),P(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(se(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ue(e),r=n.length>0?n[0]:``,i=de(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],ie(n,re([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=oe(p,0,1),h=oe(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+`%`,P(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=P(o,p),o=o[p];f&&!s&&(A[a]=o)}}return o}}}),Q=E({"node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js"(e,t){var n=lt(),r=et(),i=G(),a=ct();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.`)}}}),St=E({"node_modules/.pnpm/has-property-descriptors@1.0.2/node_modules/has-property-descriptors/index.js"(e,t){var n=lt(),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}}),Ct=E({"node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js"(e,t){var n=Z(),r=Q(),i=St()(),a=ct(),o=G(),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}}}),wt=E({"node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js"(e,t){var n=ht(),r=X(),i=_t();t.exports=function(){return i(n,r,arguments)}}}),Tt=E({"node_modules/.pnpm/call-bind@1.0.8/node_modules/call-bind/index.js"(e,t){var n=Ct(),r=lt(),i=vt(),a=wt();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}}),$=E({"node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(e,t){var n=Z(),r=vt(),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}}}),Et=ee(E({"node_modules/.pnpm/json-stable-stringify@1.3.0/node_modules/json-stable-stringify/index.js"(e,t){var n=(typeof JSON<`u`?JSON:Ge()).stringify,r=W(),i=Je(),a=Tt(),o=$(),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],E=e(f,a,f[a],g+1);if(E){var D=n(a)+b+E;S[S.length]=y+o+D}}return l(v,c(v,f),1),x(S,`{}`)}})({"":e},``,e,0)}}})(),1),Dt=e=>localStorage.getItem(`kizen-flag-${e}`)===`true`,Ot=(e=``)=>e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),kt=e=>{try{return Ot((0,Et.default)(e))}catch(e){return Dt(`script-runner-logging`)&&console.warn(`Failed to stringify object for hashing:`,e),Ot(String(Math.random()))}},At=e=>e.startsWith(`/`),jt=[`microphone`,`speaker-selection`,`autoplay`,`camera`,`display-capture`,`hid`],Mt=[`allow-popups`,`allow-scripts`,`allow-same-origin`],Nt=3e4,Pt=100,Ft=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=`${s}-${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:i}=t;switch(i){case n.QUERY_REQUEST:{let e=t;await this.handleQueryRequest(e.id,e.method,e.url,e.payload,e.options);return}case n.UI_OUTPUT:{let e=t;this.handleUIOutput(e.markup);return}case n.IFRAME_OUTPUT:{let e=t;this.handleIframeOutput(e.url,e.allow,e.sandbox,e.preserve);return}case n.POSTFORMDATA_REQUEST:{let e=t;this.handleFormPostRequest(e.id,e.url,e.payload,e.createNewTab);return}case n.UPLOADFILE_REQUEST:{let e=t;await this.handleUploadFileRequest(e.id,e.payload);return}case n.SETSTATE:{let e=t;this.onStateChange?.(e.state);return}case n.DONE:{let e=t;this.handleDone(e.preserve,e.result);return}case r.ERROR:{let e=t;this.onError?.({message:e.error});return}case n.OPEN_WINDOW:{let e=t;this.handleOpenWindow(e.url,e.target,e.features);return}case n.COMMUNICATE:{let e=t;this.handleCommunication(e.type,e.recipient,e.args,e.params);return}case n.HIDE:{let{config:e}=t,n=!1;e.hideTrigger&&(n=!0),this.onStateChange?.({hidden:!0,triggerHidden:n});return}case n.SHOW:{let{config:e}=t,n=!1;e.showTrigger===!1&&(n=!0),this.onStateChange?.({hidden:!1,triggerHidden:n});return}case n.EXPAND:this.onStateChange?.({minimized:!1});return;case n.COLLAPSE:this.onStateChange?.({minimized:!0});return;case n.HIDE_HEADER:this.onStateChange?.({hideHeader:!0});return;case n.SHOW_HEADER:this.onStateChange?.({hideHeader:!1});return;case n.COPY_TO_CLIPBOARD:{let e=t;await this.copyToClipboard(e.text);return}case n.OPEN_CREATE_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRecordRequest(e.id,e.entityId);return}case n.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST:{let e=t;this.handleCreateRelatedRecordRequest(e.id,e.objectId,e.relatedEntityId);return}case n.SHOW_TOAST:{let e=t;this.showToast(e.message,e.toastOptions);return}case n.CLEAR_TOASTS:this.clearToasts();return;case n.REFRESH_TIMELINE:{let e=t;this.handleRefreshTimeline(e.entityId);return}case n.REFRESH_ENTITY:{let e=t;await this.handleRefreshEntity(e.entityId,e.id);return}case n.UPDATE_SESSION_DATA:{let e=t;this.handleSetSessionData(e.update);return}case n.INSTALL_THIRD_PARTY_SCRIPT_REQUEST:{let e=t;this.handleInstallThirdPartyScriptRequest(e.id,e.url,e.args);return}case n.PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!1);return}case n.DYNAMIC_PROMPT_REQUEST:{let e=t;this.handlePromptRequest(e.id,e.config,!0);return}case n.RELEASE_BLOCKING_SCRIPT:this.handleReleaseBlockingScript();return;case n.AUTHORIZE:{let e=t;this.handleAuthorize(e.serviceName,e.config);return}default:return}};handleCommunication=(e,t,n,r)=>{if(e===i.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===i.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,i,a)=>{try{let o=await this.onNetworkRequest?.(t,n,i,a);this.postMessage(r.QUERY_RESPONSE,{data:o,id:e})}catch(t){this.onNetworkError?.(t),this.postMessage(r.QUERY_RESPONSE,{error:t,id:e})}};handleUIOutput=e=>{if(this.scriptUIRef?.current){let t=He.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=>jt.includes(e)),a=n.filter(e=>Mt.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(r.CREATE_RECORD_RESPONSE,{id:e,data:t})})};handleCreateRelatedRecordRequest=(e,t,n)=>{this.onShowCreateRelatedRecordModal?.(t,n,t=>{this.postMessage(r.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(Nt/Pt)&&(clearInterval(r),t(!1)))},Pt)});handleRefreshEntity=async(e,t)=>{this.invalidateCache?.(`entity`,e);let n=await this.waitForIdleState(e);this.postMessage(r.REFRESH_ENTITY_RESPONSE,{id:t,data:{success:n}})};handleFormPostRequest=(e,t,n,i)=>{let a=document.createElement(`form`);a.method=`POST`,a.action=t,i&&(a.target=`_blank`);for(let e in n){let t=document.createElement(`input`);t.type=`hidden`,t.name=e,t.value=n[e],a.appendChild(t)}document.body.appendChild(a),a.submit(),i&&document.body.removeChild(a),this.postMessage(r.POSTFORMDATA_RESPONSE,{success:!0,id:e})};handleUploadFileRequest=async(e,t)=>{if(!this.performFileUpload){this.postMessage(r.UPLOADFILE_RESPONSE,{error:`File upload not supported`,id:e});return}let{file:n,isPublic:i=!1,fileName:a}=t,o=await(await fetch(n)).blob(),s=new File([o],a??`upload-${new Date().toISOString()}`,{type:o.type});s.$id=this.createFileId?.()??v();let c=await this.performFileUpload({file:s,id:s.$id,publicFile:i,source:`field_value`,handleProgress:e=>{this.postMessage(r.UPLOADFILE_PROGRESS,{fileId:e.id,progress:e.progress})},businessId:void 0});this.postMessage(r.UPLOADFILE_RESPONSE,{data:c,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&&m[e]){let n=m[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(r.PROMPT_RESPONSE,{id:e,data:t})}):this.postMessage(r.PROMPT_RESPONSE,{id:e,data:{canceled:!0}})};handleInstallThirdPartyScriptRequest=(e,t,n={})=>{let i=p(t);if(!i){this.postMessage(r.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e});return}let a=h[i];a(n);let o=document.createElement(`script`);o.onload=()=>{this.waitForReadyState(g[i],n=>{this.postMessage(r.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,matched:n},id:e})})},o.onerror=()=>{this.postMessage(r.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!1,url:t},id:e})},o.src=t,o.setAttribute(`data-script-url`,t),document.querySelectorAll(`[data-script-url="`+t+`"]`).length>0?this.waitForReadyState(g[i],n=>{this.postMessage(r.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE,{data:{success:!0,url:t,reused:!0,matched:n},id:e})}):document.documentElement.firstChild?.appendChild(o)};handleOpenWindow=(e,t,n)=>{!At(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,r)=>{let i=_();this.postMessage(n.RUN,{script:e,setup:t,args:r,sessionData:this.sessionData,pluginComponentId:this.pluginComponentId,pluginApiName:this.pluginApiName,location:i})}},It=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:E,createFileId:D,performFileUpload:ee,getPendingCacheCount:O,invalidateCache:k})=>{let te=Dt(`script-runner-logging`),A;return A=u===`recordDetail`?new Worker(new URL(`/assets/recordDetail.worker-C0-mQTaj.js`,``+import.meta.url),{type:`module`}):u===`genericPlugin`?new Worker(new URL(`/assets/generic.worker-DRXu0-5B.js`,``+import.meta.url),{type:`module`}):u===`floatingFramePlugin`?new Worker(new URL(`/assets/floatingFrame.worker-CWLtchq3.js`,``+import.meta.url),{type:`module`}):new Worker(new URL(`/assets/calendarSource.worker-C9iglnKD.js`,``+import.meta.url),{type:`module`}),new Promise(u=>{let ne=Ot(e),j=Ot(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 P=new Ft({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:E,onNetworkRequest:w,appPath:T,createFileId:D,performFileUpload:ee,getPendingCacheCount:O,invalidateCache:k});o(!0),P.run(e,{...d,user:t,teamMember:n,business:r,clientObject:s,appPath:T,isDebug:te},f)})},Lt=(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=Dt(`script-runner-logging`);n.postMessage(JSON.stringify({expression:e,args:t,isDebug:i}))})},Rt=async(e,t)=>await Lt(e,t),zt=async(e,t)=>await Lt(e,t),Bt=async(e,t)=>await Lt(e,t),Vt=async(e,t)=>await Lt(e,t),Ht=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),Ut=(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=>Ut(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...Ht(e),match_hint:e.hint_object_name??``}))]},Wt=(e,t)=>{let n=Ut(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},Gt=e=>{if(e===`boolean`)return!1},Kt=(e,t,n,r)=>{let i=Object.keys(e),a={};return i.forEach(r=>{t.includes(r)?a[r]={value:Gt(n[r]?.type),type:n[r]?.type}:a[r]={value:e[r],type:n[r]?.type}}),Ut({fields:r??[]}).forEach(e=>{a[e.key]===void 0&&(t.includes(e.key)?a[e.key]={value:Gt(e.type),type:e.type}:a[e.key]={value:e.default,type:e.type})}),a},qt=e=>e?e.replaceAll(`{{config.`,`{{config__`).replaceAll(`{{userConfig.`,`{{userConfig__`):``,Jt=async(e,t)=>await Rt(qt(e),t);function Yt(e){function t(t){try{let n=localStorage.getItem(e(t));return n?JSON.parse(n):null}catch{return null}}function n(t,n,r){let i={__kizen_setup_assistant_values:n,__kizen_clean_config:Wt(r,n)};localStorage.setItem(e(t),JSON.stringify(i))}function r(t,n){let r={__kizen_setup_assistant_values:{},__kizen_clean_config:n};localStorage.setItem(e(t),JSON.stringify(r))}function i(t){localStorage.removeItem(e(t))}return{load:t,save:n,saveRaw:r,clear:i}}var Xt=Yt(t),Zt=Yt(e),Qt=Xt.load,$t=Xt.save,en=Xt.saveRaw,tn=Xt.clear,nn=Zt.load,rn=Zt.save,an=Zt.clear;function on(e,t){return Xt.load(e)?.__kizen_clean_config||(t??null)}export{s as C,a as E,i as S,o as T,Bt as _,on as a,He as b,rn as c,Ut as d,Ht as f,Vt as g,Rt as h,nn as i,Jt as l,Dt as m,an as n,$t as o,kt as p,Qt as r,en as s,tn as t,Kt as u,It as v,l as w,y as x,zt as y};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
(function(){var e={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`},t={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`},n={RUN_FRAME_SCRIPT:`runframescript`,SEND_MESSAGE_TO_FRAME:`sendmessagetoframe`,CALL_THIRD_PARTY_SCRIPT:`callthirdpartyscript`},r=/https:\/\/.*widget\.freshworks\.com\/.*\.js/,i=/https:\/\/widget\.intercom\.io\/widget\/[a-z0-9]+/,a={FRESHWORKS:`freshworks`,INTERCOM:`intercom`},o=e=>{if(r.test(e))return a.FRESHWORKS;if(i.test(e))return a.INTERCOM};a.FRESHWORKS,a.INTERCOM,a.FRESHWORKS,a.INTERCOM,a.FRESHWORKS,a.INTERCOM;var s=class{instance;scriptUrl;integration;constructor(e,t){this.instance=e,this.scriptUrl=t;let n=o(t);if(n)this.integration=n;else throw Error(`Error: Disallowed script url: ${t}`)}get type(){return this.integration}call(...t){this.instance.postMessage(JSON.stringify({action:e.COMMUNICATE,type:n.CALL_THIRD_PARTY_SCRIPT,eventName:`thirdParty:${n.CALL_THIRD_PARTY_SCRIPT}`,recipient:{script:this.scriptUrl,type:this.type},params:t}))}},c=e=>({key:`action__${e.api_name}`,type:`custom_object`,label:e.name,allow_multiple:!0}),l=(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=>l(e,e.when)),i=e.actions?.filter(e=>e.hint_object_name)??[];return[...n,...r,...i.map(e=>({...c(e),match_hint:e.hint_object_name??``}))]},u=(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`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},d=(t,n)=>r=>async(i,a,o)=>new Promise((s,c)=>{let l=n.register(s,c);t.postMessage(JSON.stringify({action:e.QUERY_REQUEST,id:l,method:r,url:i,payload:a,options:o}))}),f=(t,n)=>(r,i,a=!0)=>new Promise((o,s)=>{let c=n.register(o,s);t.postMessage(JSON.stringify({action:e.POSTFORMDATA_REQUEST,url:r,id:c,payload:i,createNewTab:a}))}),p=(t,n)=>r=>new Promise((i,a)=>{let o=n.register(i,a);t.postMessage(JSON.stringify({action:e.PROMPT_REQUEST,id:o,config:r}))}),m=(t,n)=>r=>new Promise((i,a)=>{let o=n.register(i,a);t.postMessage(JSON.stringify({action:e.DYNAMIC_PROMPT_REQUEST,id:o,config:r}))}),h=(t,n)=>r=>new Promise((i,a)=>{let o=n.register(i,a);t.postMessage(JSON.stringify({action:e.UPLOADFILE_REQUEST,id:o,payload:r}))}),g=(t,n)=>(r,i)=>new Promise((a,o)=>{let s=n.register(a,o);t.postMessage(JSON.stringify({action:e.INSTALL_THIRD_PARTY_SCRIPT_REQUEST,url:r,id:s,args:i}))}),_=(t,n)=>r=>new Promise((i,a)=>{let o=n.register(i,a);t.postMessage(JSON.stringify({action:e.REFRESH_ENTITY,id:o,entityId:r}))}),v=(t,n)=>r=>new Promise((i,a)=>{let o=n.register(i,a);t.postMessage(JSON.stringify({action:e.OPEN_CREATE_RECORD_MODAL_REQUEST,id:o,entityId:r}))}),y=(t,n)=>(r,i)=>new Promise((a,o)=>{let s=n.register(a,o);t.postMessage(JSON.stringify({action:e.OPEN_CREATE_RELATED_RECORD_MODAL_REQUEST,id:s,objectId:r,relatedEntityId:i}))}),b=(e,n,r)=>{switch(e){case t.QUERY_RESPONSE:{let{id:e,data:t,error:i}=JSON.parse(n.data);i?r.reject(e,i):r.resolve(e,t);break}case t.POSTFORMDATA_RESPONSE:{let{id:e,success:t}=JSON.parse(n.data);t?r.resolve(e):r.reject(e);break}case t.UPLOADFILE_RESPONSE:{let{id:e,data:t,error:i}=JSON.parse(n.data);t?r.resolve(e,t):r.reject(e,i);break}case t.INSTALL_THIRD_PARTY_SCRIPT_RESPONSE:{let{id:e,data:t}=JSON.parse(n.data);t.success?r.resolve(e,t):r.reject(e);break}case t.PROMPT_RESPONSE:{let{id:e,data:t}=JSON.parse(n.data);r.resolve(e,t);break}case t.CREATE_RECORD_RESPONSE:{let{id:e,data:t}=JSON.parse(n.data);r.resolve(e,t);break}case t.CREATE_RELATED_RECORD_RESPONSE:{let{id:e,data:t}=JSON.parse(n.data);r.resolve(e,t);break}case t.REFRESH_ENTITY_RESPONSE:{let{id:e,data:t}=JSON.parse(n.data);t.success?r.resolve(e,!0):r.reject(e);break}}},x=`integration:${n.RUN_FRAME_SCRIPT}`,S=class{instance;constructor(e){this.instance=e}runFrameScript(t,r,i){this.instance.postMessage(JSON.stringify({action:e.COMMUNICATE,type:n.RUN_FRAME_SCRIPT,eventName:x,recipient:{frame:t,script:r},args:i}))}sendMessageToOwnFrame(t,r){this.instance.postMessage(JSON.stringify({action:e.COMMUNICATE,type:n.SEND_MESSAGE_TO_FRAME,args:{payload:t,path:r}}))}},C=async e=>{let t=null;try{t=await e.json()}catch{}return{status:e.status,statusText:e.statusText,body:t}},w=(e,t,n={},r=``)=>`(function() { ${r}
|
|
2
|
-
return ${`(${e.toString()})({ state: {{${t}}}, args: ${JSON.stringify(n)}, utils: __kizen_utils })`}; })()`,T=class{user;teamMember;business;clientObject;appPath;dataCache=new Map;queryOptions={};api;postFormData;executionTimer=0;setupExecutions=0;cleanupExecutions=0;isDebug=!1;scriptBody;internalState={indicator:`none`};console=console;instance;breakOnException=!1;args;communicate;shouldPreserve=!1;uploadFileHandler;internalSessionData;pluginComponentId;installThirdPartyScriptHandler;promptHandler;dynamicPromptHandler;refreshEntityHandler;openCreateRecordHandler;openCreateRelatedRecordHandler;runnerType;pluginApiName;tempPromptState={};partialLocation;constructor({user:e,teamMember:t,business:n,clientObject:r,appPath:i,isDebug:a,kizenRequest:o,postFormData:s,scriptBody:c,instance:l,args:u,uploadFile:d,sessionData:f,pluginComponentId:p,installThirdPartyScript:m,prompt:h,refreshEntity:g,openCreateRecord:_,openCreateRelatedRecord:v,pluginApiName:y,dynamicPrompt:b,location:x}){this.user=e,this.teamMember=t,this.business=n,this.clientObject=r,this.partialLocation=x,this.appPath=i,this.isDebug=a??!1,this.api={get:o(`get`),post:o(`post`),put:o(`put`),delete:o(`delete`),patch:o(`patch`)},this.postFormData=s,this.scriptBody=c,this.instance=l,this.communicate=new S(l),this.uploadFileHandler=d,this.internalSessionData=f??{},this.pluginComponentId=p,this.installThirdPartyScriptHandler=m,this.promptHandler=h,this.refreshEntityHandler=g,this.openCreateRecordHandler=_,this.openCreateRelatedRecordHandler=v,this.runnerType=`base`,this.pluginApiName=y,this.dynamicPromptHandler=b;try{this.args=JSON.parse(u??`{}`)}catch{this.args={}}}onError(e){if(this.breakOnException)debugger;this.instance.postMessage(JSON.stringify({action:t.ERROR,error:e?.message}))}set debug(e){this.isDebug=e,this.breakOnException=e}set preserve(e){this.shouldPreserve=e}get preserve(){return this.shouldPreserve}parseDate(e){return e.split(`-`)}parsePhone(e){return e.replace(/\+/g,``)}openWindow(t,n=`_blank`){this.instance.postMessage(JSON.stringify({action:e.OPEN_WINDOW,url:t,target:n,features:`noopener noreferrer`}))}authorize(t,n={}){if(!t)throw Error(`Service name is required to authorize`);this.instance.postMessage(JSON.stringify({action:e.AUTHORIZE,serviceName:t,config:{successRedirectPath:n.successRedirectPath??`/marketplace/${this.pluginApiName}/auth`,errorRedirectPath:n.errorRedirectPath??`/marketplace/${this.pluginApiName}/auth`}}))}getServiceUrl(e,t){if(!e)throw Error(`Service name is required to get a service url`);let n=`/external-integrations/proxy/${this.pluginApiName}/${e}`;return t.startsWith(`/`)?`${n}${t}`:`${n}/${t}`}get currentBusiness(){return this.business}get applicationPath(){return this.appPath}get currentUser(){return{profile:{id:this.teamMember?.id??``,full_name:this.teamMember?.full_name??``,first_name:this.teamMember?.first_name??``,last_name:this.teamMember?.last_name??``,email:this.teamMember?.email??``,phone:this.teamMember?.phone??``,created:this.teamMember?.created??``,crm_client_id:this.user?.crm_client_id??``}}}get sessionData(){return this.internalSessionData}get config(){return this.args.__kizen_clean_config?new Proxy(this.args.__kizen_clean_config??{},{get:(e,t)=>{if(Reflect.has(e,t))return Reflect.get(e,t)}}):{}}get location(){return new Proxy(this.partialLocation,{get:(e,t)=>{if(t===`toJSON`)return()=>this.partialLocation;if(Reflect.has(e,t))return Reflect.get(e,t);throw Error(`Property ${String(t)} is not available on location object for plugin apps`)}})}get userConfig(){let e=this.args.__kizen_user_config?.__kizen_clean_config;return e?new Proxy(e,{get:(e,t)=>{if(Reflect.has(e,t))return Reflect.get(e,t)}}):{}}setSessionData(t){if(typeof t!=`object`)throw Error(`Invalid session update with type ${typeof t}`);if(Array.isArray(t))throw Error(`Invalid session update with type array`);this.internalSessionData={...this.internalSessionData,...t},this.instance.postMessage(JSON.stringify({action:e.UPDATE_SESSION_DATA,update:t}))}async get(e,t){try{if(this.isRelativeUrl(e)){let n=this.dataCache.get(e);if(n&&!t?.ignoreCache)return t?.returnErrors?[n.data,null]:n.data;let{data:r}=await this.api.get(e,{...this.queryOptions,headers:this.buildHeaders(t?.headers)});return this.dataCache.set(e,{ts:Date.now(),data:r}),t?.returnErrors?[r,null]:r}else{let n=await fetch(e,{method:`GET`,headers:new Headers(t?.headers),credentials:t?.credentials??`same-origin`});if(!n.ok)throw await C(n);let r=await n.json();return t?.returnErrors?[r,null]:r}}catch(e){if(t?.returnErrors)return[null,e];this.onError(e)}}async getWithErrors(e,t){return this.get(e,{...t,returnErrors:!0})}async getUserConfig(){if(!this.args.pluginId||!this.pluginComponentId)throw Error(`User config is not available for scripts not associated to a plugin or plugin component`);return(await this.get(`/employee/mine/configs/plugins/${this.args.pluginId}`,{ignoreCache:!0})).config?.[this.pluginComponentId]??{}}async setUserConfig(e){if(!this.args.pluginId||!this.pluginComponentId)throw Error(`User config is not available for scripts not associated to a plugin or plugin component`);let t=await this.get(`/employee/mine/configs/plugins/${this.args.pluginId}`,{ignoreCache:!0});return await this.post(`/employee/mine/configs/plugins/${this.args.pluginId}`,{config:{...t?.config,[this.pluginComponentId]:{...t?.config?.[this.pluginComponentId],...e}}})}async patch(e,t,n){try{if(this.isRelativeUrl(e)){let{data:r}=await this.api.patch(e,t,{...this.queryOptions,headers:n?.headers});return n?.returnErrors?[r,null]:r}else{let r=await fetch(e,{method:`PATCH`,body:t?JSON.stringify(t):null,headers:new Headers(n?.headers),credentials:n?.credentials??`same-origin`});if(!r.ok)throw await C(r);let i=await r.json();return n?.returnErrors?[i,null]:i}}catch(e){if(n?.returnErrors)return[null,e];this.onError(e)}}async patchWithErrors(e,t,n){return this.patch(e,t,{...n,returnErrors:!0})}async post(e,t,n){try{if(this.isRelativeUrl(e)){let{data:r}=await this.api.post(e,t,{...this.queryOptions,headers:this.buildHeaders(n?.headers)});return n?.returnErrors?[r,null]:r}else{let r=await fetch(e,{method:`POST`,body:t?JSON.stringify(t):null,headers:new Headers(n?.headers),credentials:n?.credentials??`same-origin`});if(!r.ok)throw await C(r);let i=await r.json();return n?.returnErrors?[i,null]:i}}catch(e){if(n?.returnErrors)return[null,e];this.onError(e)}}async postWithErrors(e,t,n){return this.post(e,t,{...n,returnErrors:!0})}async delete(e,t){try{if(this.isRelativeUrl(e)){let{data:n}=await this.api.delete(e,{...this.queryOptions,headers:this.buildHeaders(t?.headers)});return t?.returnErrors?[n,null]:n}else{let n=await fetch(e,{method:`DELETE`,headers:new Headers(t?.headers),credentials:t?.credentials??`same-origin`});if(!n.ok)throw await C(n);let r=null;return n.status!==204&&(r=await n.json()),t?.returnErrors?[r,null]:r}}catch(e){if(t?.returnErrors)return[null,e];this.onError(e)}}async deleteWithErrors(e,t){return this.delete(e,{...t,returnErrors:!0})}async openCreateRecordModal(e){return this.openCreateRecordHandler(e)}async openCreateRelatedRecordModal(e,t){return this.openCreateRelatedRecordHandler(e,t)}showToast(t,n){this.instance.postMessage(JSON.stringify({action:e.SHOW_TOAST,message:t,toastOptions:n}))}clearToasts(){this.instance.postMessage(JSON.stringify({action:e.CLEAR_TOASTS}))}outputUI(t){this.instance.postMessage(JSON.stringify({action:e.UI_OUTPUT,markup:t}))}prompt(e){return this.promptHandler(e)}async dynamicPrompt(e){let t=`__kizen_state`,n=`const __kizen_utils = {};
|
|
3
|
-
`;if(e.registerUtils){let t=Object.keys(e.registerUtils);n+=t.map(t=>{let n=e.registerUtils?.[t];if(typeof n!=`function`)throw Error(`Registered util ${t} is not a function, got ${typeof n}`);return`__kizen_utils["${t}"] = (${n.toString()});`}).join(`
|
|
4
|
-
`)}let r=e.content?.map(e=>{let r=``;`optionMapper`in e&&(r=w(e.optionMapper,t,e.args,n));let i=``;`getFetchUrl`in e&&(i=w(e.getFetchUrl,t,e.args,n));let a=``;`getHeaders`in e&&(a=w(e.getHeaders,t,e.args,n));let o=``;return`getBody`in e&&(o=w(e.getBody,t,e.args,n)),{...e,optionMapper:r,getFetchUrl:i,getHeaders:a,getBody:o}}),i={...e,content:r},a={fields:i.content},o=await this.dynamicPromptHandler(i),s=u(a,o.values);return{...o,values:s}}outputIframe(t,n,r){this.instance.postMessage(JSON.stringify({action:e.IFRAME_OUTPUT,url:t,allow:n,sandbox:r,preserve:this.preserve}))}getBase64EncodedBlob(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=e=>{n(e)}})}async uploadFile(e,t,n=!1){let r=await this.getBase64EncodedBlob(e);return await this.uploadFileHandler({file:r,fileName:t??`file_`+String(Date.now()),isPublic:n})}afterSetup(){}__setup(){if(this.setupExecutions!==0)throw Error(`Setup must be called exactly once, and should never be called by a script directly.`);if(this.cleanupExecutions!==0)throw Error(`Setup was called after cleanup`);this.isDebug&&this.console.log(`Running script:
|
|
5
|
-
|
|
6
|
-
${this.scriptBody}`),this.setupExecutions++,this.executionTimer=performance.now(),this.afterSetup()}__cleanup(e){if(this.cleanupExecutions!==0)throw Error(`Cleanup must be called exactly once, and should never be called by a script directly.`);if(this.setupExecutions!==1)throw Error(`Cleanup was called before setup`);this.cleanupExecutions++,this.setIndicator(`none`);let t=performance.now();this.isDebug&&this.console.log(`Script execution took ${String(t-this.executionTimer)}ms`),this.done(this.preserve,e)}setIndicator(e=`none`){this.internalState.indicator=e,this.setState({indicator:e})}wait(e){return new Promise(t=>setTimeout(t,e))}done(t,n){this.instance.postMessage(JSON.stringify({action:e.DONE,result:n,preserve:t}))}setState(t){this.instance.postMessage(JSON.stringify({action:e.SETSTATE,state:t}))}isRelativeUrl(e){return e.startsWith(`/`)}buildHeaders(e={}){return{...e,"X-Request-Type":`kizen-ui-scripting-api`}}refreshTimelineForId(t){t&&this.instance.postMessage(JSON.stringify({action:e.REFRESH_TIMELINE,entityId:t}))}refreshEntityForId(e){if(e)return this.refreshEntityHandler(e)}async installThirdPartyScript(e){try{let t=await this.installThirdPartyScriptHandler(e,this.args);return new s(this.instance,t.url)}catch{this.onError(Error(`Third party script ${e} could not be installed.`))}}releaseBlockingScript(){this.instance.postMessage(JSON.stringify({action:e.RELEASE_BLOCKING_SCRIPT}))}copyToClipboard(t){this.instance.postMessage(JSON.stringify({action:e.COPY_TO_CLIPBOARD,text:t}))}createDateObject(e){if(typeof e!=`string`)throw Error(`Invalid date string ${String(e)}`);if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`Date string ${e} is not in the format YYYY-MM-DD`);let t=e.split(`-`).map(e=>parseInt(e,10));if(t.length<3)throw Error(`Date string ${e} could not be parsed into valid date parts`);return new Date(t[0],t[1]-1,t[2])}formatDateForResponse(e){return e.getTime()}},E=class extends T{constructor(e){super(e),this.runnerType=`floatingFrame`}hide(t={}){this.instance.postMessage(JSON.stringify({action:e.HIDE,config:t}))}hideHeader(){this.instance.postMessage(JSON.stringify({action:e.HIDE_HEADER}))}showHeader(){this.instance.postMessage(JSON.stringify({action:e.SHOW_HEADER}))}show(t={}){this.instance.postMessage(JSON.stringify({action:e.SHOW,config:t}))}expand(){this.instance.postMessage(JSON.stringify({action:e.EXPAND}))}collapse(){this.instance.postMessage(JSON.stringify({action:e.COLLAPSE}))}afterSetup(){this.show()}},D=()=>{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)})},O=Object.getPrototypeOf(async function(){}).constructor,k=e=>{let t=`
|
|
7
|
-
const __cleanup = this.__cleanup.bind(this);
|
|
8
|
-
const __error = this.onError.bind(this);
|
|
9
|
-
{
|
|
10
|
-
this.__setup();
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
${e}
|
|
14
|
-
} catch (ex) {
|
|
15
|
-
__error(ex);
|
|
16
|
-
} finally {
|
|
17
|
-
__cleanup();
|
|
18
|
-
}
|
|
19
|
-
`;try{return{fn:new O(t),functionBody:t}}catch{let e=`
|
|
20
|
-
this.__setup();
|
|
21
|
-
this.onError({ message: "The script has a syntax error and could not be parsed" });
|
|
22
|
-
this.__cleanup();
|
|
23
|
-
`;return{fn:new O(e),functionBody:e}}},A=new class{promises;isDebug;constructor({isDebug:e=!1}){this.promises=new Map,this.isDebug=e}delete(e){this.isDebug&&console.log(`Deleting promise ${e}`),this.promises.delete(e)}get(e){return this.isDebug&&console.log(`Getting promise ${e}`),this.promises.get(e)}set(e,t,n){this.promises.set(e,{resolve:t,reject:n})}id(){return D()}register(e,t){let n=this.id();return this.set(n,e,t),n}resolve(e,t){this.get(e)?.resolve(t),this.delete(e)}reject(e,t){this.get(e)?.reject(t),this.delete(e)}}({isDebug:!1});self.onmessage=async t=>{let{action:n,script:r,setup:i,args:a,sessionData:o={},pluginComponentId:s,pluginApiName:c,location:l}=JSON.parse(t.data);if(n===e.RUN&&i&&r){let{fn:e,functionBody:t}=k(r),n=new E({user:i.user,teamMember:i.teamMember,business:i.business,clientObject:i.clientObject,appPath:i.appPath,isDebug:i.isDebug,scriptBody:r,functionBody:t,instance:self,kizenRequest:d(self,A),postFormData:f(self,A),uploadFile:h(self,A),installThirdPartyScript:g(self,A),args:a??``,sessionData:o,pluginComponentId:s,prompt:p(self,A),dynamicPrompt:m(self,A),refreshEntity:_(self,A),openCreateRecord:v(self,A),openCreateRelatedRecord:y(self,A),pluginApiName:c,location:l});await e.bind(n)()}else b(n,t,A)}})();
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,j as n,k as r,y as i}from"./fa-core-BoBqCOD3.js";import{n as a}from"./react-csXWLXSE.js";import{A as o,I as s,M as c,O as l,a as u,c as d,d as f,f as p,i as m,l as h,n as g,o as _,p as v,r as y,s as b,u as x,v as S}from"./useQuery-5OkVbV1s.js";import{a as C,i as w,n as T,o as E,r as D}from"./BootstrapContext-D5ZnMrOp.js";import{r as O}from"./api-CT-MKz2h.js";import{C as k,E as A,S as j,T as M,_ as N,b as P,d as F,f as I,g as L,h as R,m as ee,p as te,v as z,w as B,x as ne,y as re}from"./configStorage-DcQWEL9-.js";function ie(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function ae(e,t,n){let r=e.slice(0);return r[t]=n,r}var V=class extends s{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,S.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!c(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ie(e,n).forEach(e=>{e.destroy()}),ie(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=o(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new v(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=ae(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&S.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},H=e(n(),1);function U({queries:e,...t},n){let r=p(n),i=h(),a=d(),o=H.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{g(e),u(e,a,r.getQueryCache().get(e.queryHash))}),b(a);let[s]=H.useState(()=>new V(r,o,t)),[c,f,x]=s.getOptimisticResult(o,t.combine),C=!i&&t.subscribed!==!1;H.useSyncExternalStore(H.useCallback(e=>C?s.subscribe(S.batchCalls(e)):l,[s,C]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),H.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let w=c.some((e,t)=>m(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&m(n,e)?y(n,new v(r,n),a):[]}):[];if(w.length>0)throw Promise.all(w);let T=c.find((e,t)=>{let n=o[t];return n&&_({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(T?.error)throw T.error;return f(x())}var oe=`integration:${j.RUN_FRAME_SCRIPT}`,se={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},ce=(e,t,n)=>{let r,i=se[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function le(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ue={date:le({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:le({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:le({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},de={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},fe=(e,t,n,r)=>de[e];function pe(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var me={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:pe({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:pe({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:pe({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:pe({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:pe({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function W(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?ge(s,e=>e.test(o)):he(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function he(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ge(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function _e(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var ve={code:`en-US`,formatDistance:ce,formatLong:ue,formatRelative:fe,localize:me,match:{ordinalNumber:_e({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:W({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:W({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:W({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:W({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:W({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}},ye={};function be(){return ye}var xe=365.2425,Se=6048e5,Ce=864e5,we=3600*24;we*7,we*xe/12*3;var Te=Symbol.for(`constructDateFrom`);function G(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Te in e?e[Te](t):e instanceof Date?new e.constructor(t):new Date(t)}function K(e,t){return G(t||e,e)}function Ee(e){let t=K(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function De(e,...t){let n=G.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Oe(e,t){let n=K(e,t?.in);return n.setHours(0,0,0,0),n}function ke(e,t,n){let[r,i]=De(n?.in,e,t),a=Oe(r),o=Oe(i),s=+a-Ee(a),c=+o-Ee(o);return Math.round((s-c)/Ce)}function Ae(e,t){let n=K(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function je(e,t){let n=K(e,t?.in);return ke(n,Ae(n))+1}function Me(e,t){let n=be(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=K(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Ne(e,t){return Me(e,{...t,weekStartsOn:1})}function Pe(e,t){let n=K(e,t?.in),r=n.getFullYear(),i=G(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Ne(i),o=G(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Ne(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Fe(e,t){let n=Pe(e,t),r=G(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Ne(r)}function Ie(e,t){let n=K(e,t?.in),r=Ne(n)-+Fe(n);return Math.round(r/Se)+1}function Le(e,t){let n=K(e,t?.in),r=n.getFullYear(),i=be(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=G(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Me(o,t),c=G(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Me(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Re(e,t){let n=be(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Le(e,t),a=G(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Me(a,t)}function ze(e,t){let n=K(e,t?.in),r=Me(n,t)-+Re(n,t);return Math.round(r/Se)+1}function q(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var J={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return q(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):q(n+1,2)},d(e,t){return q(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return q(e.getHours()%12||12,t.length)},H(e,t){return q(e.getHours(),t.length)},m(e,t){return q(e.getMinutes(),t.length)},s(e,t){return q(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return q(Math.trunc(r*10**(n-3)),t.length)}},Be={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Ve={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return J.y(e,t)},Y:function(e,t,n,r){let i=Le(e,r),a=i>0?i:1-i;return t===`YY`?q(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):q(a,t.length)},R:function(e,t){return q(Pe(e),t.length)},u:function(e,t){return q(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return q(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return q(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return J.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return q(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=ze(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):q(i,t.length)},I:function(e,t,n){let r=Ie(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):q(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):J.d(e,t)},D:function(e,t,n){let r=je(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):q(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return q(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return q(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return q(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Be.noon:r===0?Be.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Be.evening:r>=12?Be.afternoon:r>=4?Be.morning:Be.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return J.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):J.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):q(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):q(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):J.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):J.s(e,t)},S:function(e,t){return J.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Ue(r);case`XXXX`:case`XX`:return We(r);default:return We(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Ue(r);case`xxxx`:case`xx`:return We(r);default:return We(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+He(r,`:`);default:return`GMT`+We(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+He(r,`:`);default:return`GMT`+We(r,`:`)}},t:function(e,t,n){return q(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return q(+e,t.length)}};function He(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+q(a,2)}function Ue(e,t){return e%60==0?(e>0?`-`:`+`)+q(Math.abs(e)/60,2):We(e,t)}function We(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=q(Math.trunc(r/60),2),a=q(r%60,2);return n+i+t+a}var Ge=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Ke=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},qe={p:Ke,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Ge(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Ge(r,t)).replace(`{{time}}`,Ke(i,t))}},Je=/^D+$/,Ye=/^Y+$/,Xe=[`D`,`DD`,`YY`,`YYYY`];function Ze(e){return Je.test(e)}function Qe(e){return Ye.test(e)}function $e(e,t,n){let r=et(e,t,n);if(console.warn(r),Xe.includes(e))throw RangeError(r)}function et(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function tt(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function nt(e){return!(!tt(e)&&typeof e!=`number`||isNaN(+K(e)))}var rt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,it=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,at=/^'([^]*?)'?$/,ot=/''/g,st=/[a-zA-Z]/;function ct(e,t,n){let r=be(),i=n?.locale??r.locale??ve,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=K(e,n?.in);if(!nt(s))throw RangeError(`Invalid time value`);let c=t.match(it).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=qe[t];return n(e,i.formatLong)}return e}).join(``).match(rt).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:lt(e)};if(Ve[t])return{isToken:!0,value:e};if(t.match(st))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Qe(a)||!n?.useAdditionalDayOfYearTokens&&Ze(a))&&$e(a,t,String(e));let o=Ve[a[0]];return o(s,a,i.localize,l)}).join(``)}function lt(e){let t=e.match(at);return t?t[1].replace(ot,`'`):e}function ut(e,t){let n=K(e,t?.in);return n.setHours(23,59,59,999),n}function dt(){return Object.assign({},be())}function ft(e,t,n){let r=dt(),i=ht(e,n.timeZone,n.locale??r.locale);return`formatToParts`in i?pt(i,t):mt(i,t)}function pt(e,t){let n=e.formatToParts(t);for(let e=n.length-1;e>=0;--e)if(n[e].type===`timeZoneName`)return n[e].value}function mt(e,t){let n=e.format(t).replace(/\u200E/g,``),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):``}function ht(e,t,n){return new Intl.DateTimeFormat(n?[n.code,`en-US`]:void 0,{timeZone:t,timeZoneName:e})}function gt(e,t){let n=Ct(t);return`formatToParts`in n?vt(n,e):yt(n,e)}var _t={year:0,month:1,day:2,hour:3,minute:4,second:5};function vt(e,t){try{let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let t=_t[n[e].type];t!==void 0&&(r[t]=parseInt(n[e].value,10))}return r}catch(e){if(e instanceof RangeError)return[NaN];throw e}}function yt(e,t){let n=e.format(t),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}var bt={},xt=new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:`America/New_York`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}).format(new Date(`2014-06-25T04:00:00.123Z`)),St=xt===`06/25/2014, 00:00:00`||xt===`06/25/2014 00:00:00`;function Ct(e){return bt[e]||(bt[e]=St?new Intl.DateTimeFormat(`en-US`,{hourCycle:`h23`,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`}):new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`numeric`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})),bt[e]}function wt(e,t,n,r,i,a,o){let s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,i,a,o),s}var Tt=36e5,Et=6e4,Dt={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Ot(e,t,n){if(!e)return 0;let r=Dt.timezoneZ.exec(e);if(r)return 0;let i,a;if(r=Dt.timezoneHH.exec(e),r)return i=parseInt(r[1],10),Mt(i)?-(i*Tt):NaN;if(r=Dt.timezoneHHMM.exec(e),r){i=parseInt(r[2],10);let e=parseInt(r[3],10);return Mt(i,e)?(a=Math.abs(i)*Tt+e*Et,r[1]===`+`?-a:a):NaN}if(Pt(e)){t=new Date(t||Date.now());let r=At(n?t:kt(t),e);return-(n?r:jt(t,r,e))}return NaN}function kt(e){return wt(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function At(e,t){let n=gt(e,t),r=wt(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),i=e.getTime(),a=i%1e3;return i-=a>=0?a:1e3+a,r-i}function jt(e,t,n){let r=e.getTime()-t,i=At(new Date(r),n);if(t===i)return t;r-=i-t;let a=At(new Date(r),n);return i===a?i:Math.max(i,a)}function Mt(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var Nt={};function Pt(e){if(Nt[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Nt[e]=!0,!0}catch{return!1}}var Ft=60*1e3,It={X:function(e,t,n){let r=Lt(n.timeZone,e);if(r===0)return`Z`;switch(t){case`X`:return Bt(r);case`XXXX`:case`XX`:return zt(r);default:return zt(r,`:`)}},x:function(e,t,n){let r=Lt(n.timeZone,e);switch(t){case`x`:return Bt(r);case`xxxx`:case`xx`:return zt(r);default:return zt(r,`:`)}},O:function(e,t,n){let r=Lt(n.timeZone,e);switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Vt(r,`:`);default:return`GMT`+zt(r,`:`)}},z:function(e,t,n){switch(t){case`z`:case`zz`:case`zzz`:return ft(`short`,e,n);default:return ft(`long`,e,n)}}};function Lt(e,t){let n=e?Ot(e,t,!0)/Ft:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw RangeError(`Invalid time zone specified: `+e);return n}function Rt(e,t){let n=e<0?`-`:``,r=Math.abs(e).toString();for(;r.length<t;)r=`0`+r;return n+r}function zt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Rt(Math.floor(r/60),2),a=Rt(Math.floor(r%60),2);return n+i+t+a}function Bt(e,t){return e%60==0?(e>0?`-`:`+`)+Rt(Math.abs(e)/60,2):zt(e,t)}function Vt(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.floor(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Rt(a,2)}function Ht(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e-+t}var Ut=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Wt=36e5,Gt=6e4,Kt=2,Y={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Ut};function qt(e,t={}){if(arguments.length<1)throw TypeError(`1 argument required, but only `+arguments.length+` present`);if(e===null)return new Date(NaN);let n=t.additionalDigits==null?Kt:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw RangeError(`additionalDigits must be 0, 1 or 2`);if(e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`)return new Date(e.getTime());if(typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`)return new Date(e);if(Object.prototype.toString.call(e)!==`[object String]`)return new Date(NaN);let r=Jt(e),{year:i,restDateString:a}=Yt(r.date,n),o=Xt(a,i);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){let e=o.getTime(),n=0,i;if(r.time&&(n=Zt(r.time),n===null||isNaN(n)))return new Date(NaN);if(r.timeZone||t.timeZone){if(i=Ot(r.timeZone||t.timeZone,new Date(e+n)),isNaN(i))return new Date(NaN)}else i=Ht(new Date(e+n)),i=Ht(new Date(e+n+i));return new Date(e+n+i)}else return new Date(NaN)}function Jt(e){let t={},n=Y.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=Y.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){let e=Y.timeZone.exec(r);e?(t.time=r.replace(e[1],``),t.timeZone=e[1].trim()):t.time=r}return t}function Yt(e,t){if(e){let n=Y.YYY[t],r=Y.YYYYY[t],i=Y.YYYY.exec(e)||r.exec(e);if(i){let t=i[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(i=Y.YY.exec(e)||n.exec(e),i){let t=i[1];return{year:parseInt(t,10)*100,restDateString:e.slice(t.length)}}}return{year:null}}function Xt(e,t){if(t===null)return null;let n,r,i;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let a=Y.MM.exec(e);if(a)return n=new Date(0),r=parseInt(a[1],10)-1,nn(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(a=Y.DDD.exec(e),a){n=new Date(0);let e=parseInt(a[1],10);return rn(t,e)?(n.setUTCFullYear(t,0,e),n):new Date(NaN)}if(a=Y.MMDD.exec(e),a){n=new Date(0),r=parseInt(a[1],10)-1;let e=parseInt(a[2],10);return nn(t,r,e)?(n.setUTCFullYear(t,r,e),n):new Date(NaN)}if(a=Y.Www.exec(e),a)return i=parseInt(a[1],10)-1,an(i)?Qt(t,i):new Date(NaN);if(a=Y.WwwD.exec(e),a){i=parseInt(a[1],10)-1;let e=parseInt(a[2],10)-1;return an(i,e)?Qt(t,i,e):new Date(NaN)}return null}function Zt(e){let t,n,r=Y.HH.exec(e);if(r)return t=parseFloat(r[1].replace(`,`,`.`)),on(t)?t%24*Wt:NaN;if(r=Y.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(`,`,`.`)),on(t,n)?t%24*Wt+n*Gt:NaN;if(r=Y.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);let e=parseFloat(r[3].replace(`,`,`.`));return on(t,n,e)?t%24*Wt+n*Gt+e*1e3:NaN}return null}function Qt(e,t,n){t||=0,n||=0;let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=t*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var $t=[31,28,31,30,31,30,31,31,30,31,30,31],en=[31,29,31,30,31,30,31,31,30,31,30,31];function tn(e){return e%400==0||e%4==0&&e%100!=0}function nn(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;let r=tn(e);if(r&&n>en[t]||!r&&n>$t[t])return!1}return!0}function rn(e,t){if(t<1)return!1;let n=tn(e);return!(n&&t>366||!n&&t>365)}function an(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function on(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}var sn=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function cn(e,t,n={}){t=String(t);let r=t.match(sn);if(r){let i=qt(n.originalDate||e,n);t=r.reduce(function(e,t){if(t[0]===`'`)return e;let r=e.indexOf(t),a=e[r-1]===`'`,o=e.replace(t,`'`+It[t[0]](i,t,n)+`'`);return a?o.substring(0,r-1)+o.substring(r+1):o},t)}return ct(e,t,n)}function ln(e,t,n){e=qt(e,n);let r=Ot(t,e,!0),i=new Date(e.getTime()-r),a=new Date(0);return a.setFullYear(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate()),a.setHours(i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()),a}function un(e,t,n,r){return r={...r,timeZone:t,originalDate:e},cn(ln(e,t,{timeZone:r.timeZone}),n,r)}var X=t(),dn=a(),fn=(0,H.createContext)(null),pn=({children:e})=>{let t=(0,H.useRef)({}),n=(0,H.useCallback)(()=>{Object.keys(t.current).forEach(e=>{t.current[e]?.forEach(e=>{e()}),t.current[e]=[]})},[]);return(0,H.useEffect)(()=>()=>{n()},[n]),(0,X.jsx)(fn.Provider,{value:{terminators:t,cleanupWorkers:n},children:e})},mn=()=>{let e=(0,H.useContext)(fn);if(!e)throw Error(`useTerminators must be used within a TerminatorsWrapper`);return e},hn=(0,H.createContext)(null),gn=({children:e})=>{let[t,n]=(0,H.useState)({}),r=(0,H.useCallback)((e,t)=>{n(n=>({...n,[e]:{...n[e],...t}}))},[]);return(0,X.jsx)(hn.Provider,{value:{sessionData:t,setSessionData:r},children:e})},_n=()=>{let e=(0,H.useContext)(hn);if(!e)throw Error(`useSessionData must be used within a SessionDataWrapper`);return e},vn=(0,H.createContext)(null),yn=({children:e,bootstrapPlugins:t=[],userConfigs:n=[],user:r,teamMember:i,business:a,clientObject:o,appPath:s})=>{let[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)({}),f=(0,H.useMemo)(()=>Object.values(u).some(e=>e.waitingOnRouteScript),[u]),p=(0,H.useMemo)(()=>t.reduce((e,t)=>({...e,[t.api_name]:t.id}),{}),[t]),m=(0,H.useMemo)(()=>n.reduce((e,t)=>({...e,[t.api_name]:t.config}),{}),[n]),h=(0,H.useCallback)(()=>{l(!0)},[]);return(0,X.jsx)(vn.Provider,{value:{installedPluginAPINamesToIds:p,userConfigsByApiName:m,user:r,teamMember:i,business:a,clientObject:o,appPath:s,onInitialBootstrap:h,setRouteScriptRunState:d},children:e({waitingOnRouteScript:f,hasFinishedBootstrapping:c})})},bn=()=>{let e=(0,H.useContext)(vn);if(!e)throw Error(`useAppState must be used within an AppStateWrapper`);return e},xn=(0,H.createContext)(null),Sn=({children:e})=>{let[t,n]=(0,H.useState)({}),r=(0,H.useCallback)(e=>t=>{n(n=>({...n,[e]:t(n[e]??{indicator:`none`,hidden:!1,pending:!1})}))},[]),i=(0,H.useCallback)(e=>!e||!t[e]?{indicator:`none`,hidden:!1,pending:!1}:{...t[e]},[t]),a=(0,H.useMemo)(()=>{let e=Object.keys(t);return e.length>0&&e.some(e=>t[e]?.indicator===`block`)},[t]);return(0,X.jsx)(xn.Provider,{value:{getRunnerStateUpdater:r,getRunnerState:i},children:e(a)})},Cn=()=>{let e=(0,H.useContext)(xn);if(!e)throw Error(`useRunnerState must be used within a RunnerStateWrapper`);return e},wn=(0,H.createContext)(null),Tn=({children:e,showing:t,showPrompt:n,show:r,onConfirm:i,onHide:a})=>{let[o,s]=(0,H.useState)([]),[c,l]=(0,H.useState)([]),[u,d]=(0,H.useState)([]),f=(0,H.useRef)(void 0),p=(0,H.useRef)(void 0),m=(0,H.useCallback)((e,t)=>{s(n=>[...n,{config:e,cb:t}])},[]),h=(0,H.useCallback)((e,t)=>{l(n=>[...n,{objectId:e,cb:t}])},[]),g=(0,H.useCallback)((e,t,n)=>{d(r=>[...r,{objectId:e,relatedEntityId:t,cb:n}])},[]),_=(0,H.useCallback)(e=>{c[0]?.cb(e),l(e=>e.slice(1))},[c]),v=(0,H.useCallback)(e=>{u[0]?.cb(e),d(e=>e.slice(1))},[u]);(0,H.useEffect)(()=>{o.length>0&&!t&&(f.current=o[0]?.config,p.current=o[0]?.cb,n())},[o,t,n]);let y=(0,H.useCallback)(()=>{f.current=void 0,p.current=void 0,s(e=>e.slice(1))},[]),b=(0,H.useMemo)(()=>({props:{show:r,onConfirm:e=>{i(),p.current&&p.current({canceled:!1,values:e}),y()},onHide:(e,...t)=>{a(...t),p.current&&p.current({canceled:!0,values:{},eventSource:e}),y()}},config:f.current??{}}),[i,a,r,y]);return(0,X.jsx)(wn.Provider,{value:{modalState:b,showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g,onCreateRecordComplete:_,onCreateRelatedRecordComplete:v},children:e({showPluginModal:b.props.show,pluginApiName:b.config.pluginApiName??``,handleShowModal:m,handleShowCreateRecordModal:h,handleShowCreateRelatedRecordModal:g,derivedModalState:b,handleCreateRecordComplete:_,handleCreateRelatedRecordComplete:v,showCreateRecordModal:c.length>0,createRecordModalObjectId:c[0]?.objectId??``,showCreateRelatedRecordModal:u.length>0,createRelatedRecordModalObjectId:u[0]?.objectId??``,createRelatedRecordModalRelatedEntityId:u[0]?.relatedEntityId??``})})},En=()=>{let e=(0,H.useContext)(wn);if(!e)throw Error(`useModals must be used within a ModalsWrapper`);return e},Dn=(0,H.createContext)(null),On=({children:e,monitoringExceptionHelper:t})=>{let n=(0,H.useCallback)((e,n)=>{t(e,{extra:n})},[t]);return(0,X.jsx)(Dn.Provider,{value:{sendException:n},children:e})},kn=()=>{let e=(0,H.useContext)(Dn);if(!e)throw Error(`useMonitoring must be used within an MonitoringWrapper`);return e},An=(0,H.createContext)(null),jn=({children:e,onNavigate:t})=>{let n=(0,H.useCallback)(e=>{t(e,{replace:!1})},[t]),r=(0,H.useCallback)(e=>{t(e,{replace:!0})},[t]);return(0,X.jsx)(An.Provider,{value:{push:n,replace:r},children:e})},Mn=()=>{let e=(0,H.useContext)(An);if(!e)throw Error(`useHistory must be used within an HistoryWrapper`);return e},Nn=(0,H.createContext)(null),Pn=({children:e,performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a})=>(0,X.jsx)(Nn.Provider,{value:{performRequest:t,createFileId:n,performFileUpload:r,getPendingCacheCount:i,invalidateCache:a},children:e}),Fn=()=>{let e=(0,H.useContext)(Nn);if(!e)throw Error(`useNetwork must be used within a NetworkWrapper`);return e},In=e=>e,Ln=(0,H.createContext)({t:In}),Rn=e=>{let{children:t,t:n=In}=e;return(0,X.jsx)(Ln.Provider,{value:{t:n},children:t})},Z=()=>(0,H.useContext)(Ln),zn=(e,t)=>{if(!Array.isArray(e))throw Error(`Return value must be an array`);t.required.forEach(t=>{e.forEach((e,n)=>{if(!(t.key in e))throw Error(`Missing required field: ${t.key} in result row ${String(n)}`);let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)})}),t.optional.forEach(t=>{e.forEach((e,n)=>{if(t.key in e){let r=typeof e[t.key];if(r!==t.type)throw Error(`Invalid type for field: ${t.key} in result row ${String(n)}. Expected ${t.type}, got ${r}`)}})})},Bn=({onError:e,showToast:t,clearToasts:n})=>{let{t:r}=Z(),[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(void 0),{terminators:c}=mn(),{sessionData:l,setSessionData:u}=_n(),{installedPluginAPINamesToIds:d,userConfigsByApiName:f,user:p,teamMember:m,business:h,clientObject:g,appPath:_}=bn(),{getRunnerState:v,getRunnerStateUpdater:y}=Cn(),{showModal:b,showCreateRecordModal:x}=En(),{sendException:S}=kn(),C=Mn(),{performRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O}=Fn(),k=(0,H.useCallback)(t=>n=>{e?.(n);let r=n?.message??`Unknown plugin error`;S(Error(r),{error:n,workerName:`calendarSource`,pluginApiName:t?.plugin_api_name??``})},[e,S]);return[(0,H.useCallback)(async(i,o,v,S)=>{let A=``,j=ne(o);s(j);try{let e=d[o.plugin_api_name];A=JSON.stringify({...v,pluginId:e,__kizen_user_config:f[o.plugin_api_name]})}catch{k(o)({message:r(`Arguments passed to the script are invalid`)})}let M=!1,N=await z({user:p,teamMember:m,business:h,onError:k(o),setLoadingState:a,scriptBody:i,clientObject:g,onStateChange:e=>{y(j)(t=>({...t,...e}))},workerName:`calendarSource`,args:A,pushHistory:C.push,onShowToast:t,onClearToasts:n,terminators:c,plugin:o,sessionData:l,setSessionData:u,onShowModal:b,onShowCreateRecordModal:x,onShowCreateRelatedRecordModal:()=>{},onNetworkError:e=>{e?.status===503&&(M=!0)},appPath:_,onNetworkRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O});try{S&&zn(N,S)}catch(t){e?.(t)}return{result:N,authError:M}},[p,m,d,h,g,C,t,n,c,l,u,b,x,k,y,f,e,w,T,_,E,D,O,r]),{...v(o),pending:i}]},Vn=(0,H.createContext)(null),Hn=({children:e,showToast:t,clearToasts:n})=>(0,X.jsx)(Vn.Provider,{value:{showToast:t,clearToasts:n},children:e}),Q=()=>{let e=(0,H.useContext)(Vn);if(!e)throw Error(`useToast must be used within a ToastWrapper`);return e},Un=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`name`,type:`string`}],optional:[{key:`description`,type:`string`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar source script to return an array, but got:`,i),{result:[],authError:a})},Wn=async(e,t,n,r)=>{let{result:i,authError:a}=await n(e,t,r,{required:[{key:`id`,type:`string`},{key:`calendar_id`,type:`string`},{key:`title`,type:`string`},{key:`start_time`,type:`number`},{key:`end_time`,type:`number`}],optional:[{key:`description`,type:`string`},{key:`url`,type:`string`},{key:`activity_id`,type:`string`},{key:`all_day`,type:`boolean`},{key:`busy`,type:`boolean`}]});return Array.isArray(i)?{result:i,authError:a}:(console.warn(`Expected calendar event script to return an array, but got:`,i),{result:[],authError:a})},Gn=(e,t,n={})=>{let{showToast:r,clearToasts:i}=Q(),{t:a}=Z(),[o]=Bn({onError:e=>{r({message:`${a(`Error fetching calendar options.`)} ${e?.message??``}`,variant:`failure`})},showToast:r,clearToasts:i}),s=U({queries:t.map(t=>({queryKey:B.CALENDAR_SOURCE_CALENDAR_LIST(t.plugin_api_name,t.api_name),queryFn:async()=>{let e=n[t.plugin_api_name]?.business_config??{},{result:r,authError:i}=await Un(t.calendars_script,t,o,e);return{source:t,calendars:r,authError:i}},enabled:e&&!!t.calendars_script}))}),c=s.some(e=>e.isLoading);return{calendars:(0,H.useMemo)(()=>c||!e?{}:s.reduce((e,t)=>{if(!t.data?.source.plugin_api_name||typeof t.data.source.plugin_api_name!=`string`)return e;let n=t.data.source.plugin_api_name;return e[n]??=[],e[n].push(...t.data.calendars.map(e=>({calendar:e,source:t.data.source}))),e},{}),[s,c,e]),errorServices:(0,H.useMemo)(()=>s.filter(e=>e.data?.authError).map(e=>e.data?.source.plugin_api_name),[s]),isLoading:c}},Kn=`yyyy-MM-dd'T'HH:mm:ssXXX`,qn=e=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(e))throw Error(`Invalid date string: ${e}. Expected format: YYYY-MM-DD`);let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r)},Jn=(e,t)=>un(e,t,Kn),Yn=(e,t,n={})=>{let r=Intl.DateTimeFormat().resolvedOptions().timeZone,i=Jn(Oe(qn(t.rangeStart)),r),a=Jn(ut(qn(t.rangeEnd)),r),{showToast:o,clearToasts:s}=Q(),{t:c}=Z(),[l]=Bn({onError:e=>{o({message:`${c(`Error fetching calendar events.`)} ${e?.message??``}`,variant:`failure`})},showToast:o,clearToasts:s}),u=U({queries:e.map(({calendar:e,source:r})=>({queryKey:B.CALENDAR_SOURCE_EVENTS(r.plugin_api_name,r.api_name,e.id,t),queryFn:async()=>{let t=n[r.plugin_api_name]?.business_config??{},{result:o,authError:s}=await Wn(r.events_script,r,l,{...t,calendar:{calendar_id:e.id,range_start:i,range_end:a}});return{calendarId:e.id,events:o,authError:s}}}))}),d=u.some(e=>e.isLoading),f=(0,H.useMemo)(()=>e.reduce((e,{calendar:t,source:n})=>(e[t.id]={source:n,calendar:t},e),{}),[e]);return{events:(0,H.useMemo)(()=>d?{}:u.reduce((e,t)=>(t.data?.calendarId&&(e[t.data.calendarId]=t.data.events),e),{}),[u,d]),sources:f,isLoading:d}},Xn=({onError:e,scriptUIRef:t,plugin:n,onChangeMinimized:r})=>{let{terminators:i}=mn(),{sessionData:a,setSessionData:o}=_n(),{installedPluginAPINamesToIds:s,userConfigsByApiName:c,user:l,teamMember:u,business:d,clientObject:f,appPath:p}=bn(),{showModal:m,showCreateRecordModal:h,showCreateRelatedRecordModal:g}=En(),{sendException:_}=kn(),{showToast:v,clearToasts:y}=Q(),b=Mn(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=Fn(),{t:E}=Z(),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)({indicator:`none`,hidden:!0,triggerHidden:!1,hideHeader:!1}),j=(0,H.useRef)(!1),[M,N]=(0,H.useState)(!1);D&&!j.current&&(j.current=!0),!D&&j.current&&!M&&N(!0);let P=(0,H.useCallback)(t=>{e?.(t);let r=t?.message??`Unknown plugin error`;_(Error(r),{error:t,workerName:`floatingFrame`,pluginApiName:n.plugin_api_name})},[e,n,_]);return[(0,H.useCallback)((e,_)=>{let D=``;try{let e=s[n.plugin_api_name];D=JSON.stringify({..._,pluginId:e,__kizen_user_config:c[n.plugin_api_name]})}catch{P({message:E(`Arguments passed to the script are invalid`)})}return z({user:l,teamMember:u,business:d,onError:P,setLoadingState:(...e)=>{(0,dn.flushSync)(()=>{O(...e)})},scriptBody:e,clientObject:f,scriptUIRef:t,onStateChange:e=>{let{minimized:t,...n}=e;typeof t==`boolean`&&r?.(t),A(e=>({...e,...n}))},workerName:`floatingFramePlugin`,args:D,pushHistory:b.push,plugin:n,onShowToast:v,onClearToasts:y,terminators:i,sessionData:a,setSessionData:o,onShowModal:m,onShowCreateRecordModal:h,onShowCreateRelatedRecordModal:g,appPath:p,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[l,u,d,s,f,t,b,n,r,v,y,i,a,o,P,A,c,m,h,g,x,p,S,C,w,T,E]),{...k,pending:M?!1:D}]},Zn=({onError:e,scriptUIRef:t,plugin:n})=>{let{terminators:r}=mn(),{sessionData:i,setSessionData:a}=_n(),{installedPluginAPINamesToIds:o,userConfigsByApiName:s,user:c,teamMember:l,business:u,clientObject:d,appPath:f}=bn(),{getRunnerState:p,getRunnerStateUpdater:m}=Cn(),{showModal:h,showCreateRecordModal:g}=En(),{sendException:_}=kn(),{showToast:v,clearToasts:y}=Q(),b=Mn(),{performRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T}=Fn(),{t:E}=Z(),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(void 0),j=(0,H.useCallback)((t,r)=>{e?.(t);let i=t?.message??`Unknown plugin error`;_(Error(i),{error:t,workerName:`genericPlugin`,pluginApiName:n?.plugin_api_name??r?.plugin_api_name??``})},[e,n,_]);return[(0,H.useCallback)((e,p,_)=>{let D=``,k=ne(_);A(k);try{let e=o[n?.plugin_api_name??_?.plugin_api_name??``];D=JSON.stringify({...p,pluginId:e,__kizen_user_config:s[n?.plugin_api_name??_?.plugin_api_name??``]})}catch{j({message:E(`Arguments passed to the script are invalid`)})}return z({user:c,teamMember:l,business:u,onError:j,setLoadingState:O,scriptBody:e,clientObject:d,scriptUIRef:t,onStateChange:e=>{m(k)(t=>({...t,...e}))},workerName:`genericPlugin`,args:D,pushHistory:b.push,onShowToast:v,onClearToasts:y,terminators:r,plugin:n,executionPlugin:_,sessionData:i,setSessionData:a,onShowModal:h,onShowCreateRecordModal:g,onShowCreateRelatedRecordModal:()=>{},appPath:f,onNetworkRequest:x,createFileId:S,performFileUpload:C,getPendingCacheCount:w,invalidateCache:T})},[c,l,o,u,d,t,b,v,y,r,n,i,a,j,m,s,h,g,x,f,S,C,w,T,E]),{...p(k),pending:D}]},Qn=({entityId:e,objectId:t,onError:n,scriptUIRef:r,onReleaseBlockingScript:i})=>{let{terminators:a}=mn(),{sessionData:o,setSessionData:s}=_n(),{installedPluginAPINamesToIds:c,userConfigsByApiName:l,user:u,teamMember:d,business:f,clientObject:p,appPath:m}=bn(),{getRunnerState:h,getRunnerStateUpdater:g}=Cn(),{showModal:_,showCreateRecordModal:v,showCreateRelatedRecordModal:y}=En(),{sendException:b}=kn(),{showToast:x,clearToasts:S}=Q(),C=Mn(),{performRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O}=Fn(),{t:k}=Z(),[A,j]=(0,H.useState)(!1),[M,N]=(0,H.useState)(void 0),P=(0,H.useCallback)((r,i)=>{n?.(r);let a=r?.message??`Unknown plugin error`;b(Error(a),{error:r,workerName:`recordDetail`,pluginApiName:i?.plugin_api_name??``,objectId:t,entityId:e})},[n,t,e,b]);return[(0,H.useCallback)((n,h,b,A)=>{let M=``;try{let e=c[b?.plugin_api_name??``];M=JSON.stringify({...h,pluginId:e,__kizen_user_config:l[b?.plugin_api_name??``]})}catch{P({message:k(`Arguments passed to the script are invalid`)},b)}let F=ne(b);return N(F),z({user:u,teamMember:d,business:f,onReleaseBlockingScript:i,onError:e=>{P(e,b)},setLoadingState:j,scriptBody:n,clientObject:p,scriptUIRef:r,onStateChange:e=>{g(F)(t=>({...t,...e}))},workerName:`recordDetail`,args:M,context:A??{entityId:e,objectId:t},pushHistory:C.push,onShowToast:x,onClearToasts:S,terminators:a,executionPlugin:b,sessionData:o,setSessionData:s,onShowModal:_,onShowCreateRecordModal:v,onShowCreateRelatedRecordModal:y,appPath:m,onNetworkRequest:w,createFileId:T,performFileUpload:E,getPendingCacheCount:D,invalidateCache:O})},[u,d,c,f,e,t,p,r,C,x,S,a,o,s,_,v,y,i,P,g,l,w,m,T,E,D,O,k]),{...h(M),pending:A}]},$n=(e,t)=>{let{showToast:n}=Q(),{t:r}=Z(),i=(0,H.useRef)(null),a=(0,H.useRef)(null),o=e?.css,s=(0,H.useMemo)(()=>{let t=e?.html;return t?P.sanitize(t):null},[e]),c=(0,H.useMemo)(()=>e?.event_scripts??{},[e]),[l,{pending:u}]=Zn({onError:e=>{n({message:`${r(`Script could not be executed:`)} ${e?.message??`Unknown Error`}`,variant:`failure`})},scriptUIRef:i,plugin:e}),d=(0,H.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!u){let n=e.target.getAttribute(`data-script`);n&&c[n]&&l(c[n],t)}},[u,l,c,t]);return(0,H.useEffect)(()=>{let e=a.current;return e&&e.addEventListener(`click`,d),()=>{e&&e.removeEventListener(`click`,d)}},[d,e]),{scopedCss:`
|
|
2
|
-
@scope {
|
|
3
|
-
${o??``}
|
|
4
|
-
}
|
|
5
|
-
`,sanitizedHtml:s,outputUIRef:i,interactableScriptRef:a}},er=(e,t,n,r,i={})=>{let a=(0,H.useMemo)(()=>t?.event_scripts??{},[t]),o=(0,H.useCallback)(t=>{if(t.preventDefault(),t.stopPropagation(),!r){let n=t.target.getAttribute(`data-script`);n&&a[n]&&e(a[n],{...i})}},[r,e,a,i]);(0,H.useEffect)(()=>{let e=n?.current;return e&&e.addEventListener(`click`,o),()=>{e&&e.removeEventListener(`click`,o)}},[o,t,n])},tr=(e,t,n)=>{let r=e?.iframe_url,i=e?.script,a=e?.callback,o=e?.args,{showToast:s}=Q(),{t:c}=Z(),l=(0,H.useRef)(null),[u,{pending:d}]=Zn({onError:e=>{s({message:`${c(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:e}),f=(0,H.useMemo)(()=>{let e=new URLSearchParams(t);return{...Object.fromEntries(e),...o}},[t,o]),{outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g}=$n(e,f);er(u,e,l,d);let _=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!r&&!_.current&&i&&!n&&(_.current=!0,u(i,f))},[r,u,i,f,n]);let v=(0,H.useCallback)(e=>{let t=e.data;if(t?.type===`kizen:plugin_callback`){let e=t.query;a&&u(a,e)}},[u,a]);return(0,H.useEffect)(()=>(window.addEventListener(`message`,v),()=>{window.removeEventListener(`message`,v)}),[v]),{scriptUIRef:l,outputUIRef:p,scopedCss:m,sanitizedHtml:h,interactableScriptRef:g,iframeURL:r,pending:d}},nr=(0,H.createContext)(null),rr=({children:e})=>{let[t,n]=(0,H.useState)([]),[r,i]=(0,H.useState)(!1),a=(0,H.useCallback)((e,t)=>{n(n=>{let r=[e,...n.filter(t=>t!==e)];return t?.(r),r})},[]),o=(0,H.useMemo)(()=>[...t].reverse().reduce((e,t,n)=>({...e,[t]:n}),{}),[t]);return(0,H.useEffect)(()=>{let e=new MutationObserver(()=>{document.querySelector(`div[role="dialog"]`)?i(!0):i(!1)});return e.observe(document.body,{childList:!0}),()=>{e.disconnect()}},[]),(0,X.jsx)(nr.Provider,{value:{touchFloatingFrame:a,floatingFrameOffset:o},children:e(r)})},ir=()=>{let e=(0,H.useContext)(nr);if(!e)throw Error(`useFloatingFrame must be used within a FloatingFrameWrapper`);return e},ar=[`^/$`,`^/login*`,`/settings/mine$`,`/settings/others$`,`/create-new-business$`,`^/choose-business*`,`^/inactive-business$`,`^/reset$`,`/welcome$`,`/embed/*`,`/create-new-business$`,`/businessbuilder`],or=[`https://js.stripe.com`],sr=(e,t,n,r)=>e<n?t<r?`top-left`:`top-right`:t<r?`bottom-left`:`bottom-right`,cr=e=>{let{currentWindow:t,pathname:n,id:r,frameHeaderSize:i,defaultPositionGap:a=0,viewportHeight:o=window.innerHeight,hiddenByModal:s,updateEmployeeConfig:c}=e,l=(0,H.useRef)(null),u=(0,H.useRef)(!1),{showToast:d}=Q(),{t:f}=Z(),{installedPluginAPINamesToIds:p,clientObject:m}=bn(),{touchFloatingFrame:h,floatingFrameOffset:g}=ir(),_=g[r]??-1,v=t.minimized_style===`none`,y=t.minimized_style===`circle`||v,b=t.default_position===`bottom-right-fixed`,x=t.default_position===`bottom-left-fixed`,S=b||x,C=t.minimized_config?.icon??`action-drag-handle`,w=t.minimized_config?.color??`blue`,T=(0,H.useMemo)(()=>{let e=n.split(`/`),t=e[1],r=e[2];if(t===`client`)return{objectId:m?.id,entityId:r};if(t===`custom-objects`)return{objectId:r,entityId:e[3]}},[m,n]),E=(0,H.useMemo)(()=>{let e=t.match,r=t.ignore;return!!(e?.length&&!e.some(e=>new RegExp(e).test(n))||ar.concat(r??[]).filter(Boolean).some(e=>{try{return new RegExp(e).test(n)}catch{return!1}}))},[t,n]),D=t.plugin_api_name?p[t.plugin_api_name]:``,[O,k]=(0,H.useState)(()=>t.employee_config?.[r]?.minimized??!1),A=t.script,j=t.type,M=t.args,N=t.message_handler,P=t.width??0,[F,I]=(0,H.useState)(()=>{let e=window.innerHeight;return Math.min(t.height??0,e-i)}),[L,R]=(0,H.useState)(null),ee=t.default_position,te=(0,H.useCallback)(e=>{let n=t.employee_config?.[r]?.position;if(!n?.quadrant){let t=window.innerWidth-P,r=window.innerHeight-F-i;if(O&&!e&&(r=window.innerHeight-i),n)try{let e=n;return e.left>t&&(e.left=t),e.top>r&&(e.top=r),e.left<0&&(e.left=a),e.top<0&&(e.top=a),e}catch{}let o=t;return ee===`bottom-left`&&(o=a),{left:o,top:r-a}}else if(n.quadrant===`top-left`){let e=n.deltas?.left??0,t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`top-right`){let e=window.innerWidth-P-(n.deltas?.right??0),t=n.deltas?.top??0;return{...n,left:e,top:t}}else if(n.quadrant===`bottom-left`){let e=n.deltas?.left??0,t=window.innerHeight-(O?0:F)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}else{let e=window.innerWidth-P-(n.deltas?.right??0),t=window.innerHeight-(O?0:F)-(n.deltas?.bottom??0)-i;return{...n,left:e,top:t}}},[t,r,ee,O,P,F,i,a]),z=(0,H.useCallback)(e=>{let t=te(e),n=[`bottom-right`,`bottom-left`].includes(t.quadrant??``)&&O?0:F;return t.left<0?t.left=0:t.left>window.innerWidth-P&&(t.left=window.innerWidth-P),t.top<0?t.top=0:t.top>window.innerHeight-n&&(t.top=window.innerHeight-n),t},[te,P,F,O]);(0,H.useEffect)(()=>{let e=t.height??0;if(e>o){I(o-i);let e=te(!0);e.top=0,R(e)}else I(e)},[t.height,te,o,i]);let[B,ne]=(0,H.useState)(O),[re,ie]=(0,H.useState)(O&&y),ae=F*5e-4*1e3,V=e=>{k(e),e&&y?setTimeout(()=>{ie(e)},ae):y&&ie(e),s?setTimeout(()=>{ne(e)},ae):ne(e),(L?.quadrant===`bottom-left`||L?.quadrant===`bottom-right`)&&R(e?e=>e?{...e,top:e.top+F}:null:e=>{if(!e)return null;let t=window.innerHeight,n=e.top>=0&&e.top+F<=t;return{...e,top:n?e.top:e.top-F}}),c?.(r,O,L)({minimized:e})},[U,{pending:se,hidden:ce,indicator:le,triggerHidden:ue,hideHeader:de}]=Xn({onError:e=>{d({message:`${f(`Plugin error:`)} ${e?.message??``}`,variant:`failure`})},scriptUIRef:l,plugin:t,onChangeMinimized:e=>{V(e)}}),fe=(0,H.useMemo)(()=>de&&S,[de,S]),pe=(0,H.useMemo)(()=>{if(!L)return`top`;let{left:e,top:t}=L;return window.innerWidth-(e+P)<40?`left`:t<40?`bottom`:`top`},[L,P]),me=(0,H.useCallback)(()=>{let e=x?`left`:`right`,n=`${t.plugin_api_name}-${t.api_name}-trigger-${e}`;return document.getElementById(n)},[x,t]),W=(0,H.useCallback)(()=>{if(!S)return;let e=me();if(!e)return;let t=e.getBoundingClientRect(),n=O?0:F,r=fe?0:i,o=t.top-(n+r)-a,s=x?t.left:t.right-P,c=n+r,l=Math.max(0,window.innerWidth-P),u=Math.max(0,window.innerHeight-c);s=Math.min(Math.max(0,s),l),o=Math.min(Math.max(0,o),u),R({left:s,top:o,quadrant:x?`bottom-left`:`bottom-right`,deltas:{top:o,left:s,right:window.innerWidth-(s+P),bottom:window.innerHeight-(o+c)}})},[S,x,F,O,P,fe,me,i,a]);(0,H.useEffect)(()=>{S&&W()},[S,F,O,W]),(0,H.useEffect)(()=>{if(!S)return;W();let e=new ResizeObserver(()=>{W()});return e.observe(document.body),()=>{e.disconnect()}},[S,W]),(0,H.useEffect)(()=>{!u.current&&A&&j===`script`&&!E&&(u.current=!0,U(A,{...M}))},[U,A,j,M,E]),(0,H.useEffect)(()=>{let e=e=>{let n=e;if(n?.detail?.recipient?.frame===t.api_name){let e=n.detail;if(e.recipient?.plugin!==t.plugin_api_name)return;e.recipient.script&&t.event_scripts?.[e.recipient.script]&&U(t.event_scripts[e.recipient.script]??``,{...e.args,...M,...T})}};return window.addEventListener(oe,e),()=>{window.removeEventListener(oe,e)}},[t,U,M,T]);let[he,ge]=(0,H.useState)(!1),_e=(e,t)=>{ge(!1),h(r);let n=window.innerWidth,i=window.innerHeight;if(t.node){let e=t.node.getBoundingClientRect(),a=e.left,o=e.top,s=o+e.height,l=a+e.width,u=o,d=i-s,f=a,p=n-l,m={left:a,right:l,top:o,quadrant:sr(u,f,d,p),deltas:{top:u,bottom:d,left:f,right:p}};R(m),c?.(r,O,L)({position:m})}};(0,H.useEffect)(()=>{let e=()=>{S?W():R(z(!1))};return window.addEventListener(`resize`,e),()=>{window.removeEventListener(`resize`,e)}},[S,W,z]),er(U,t,l,se,M),(0,H.useEffect)(()=>{let e=e=>{e.source!==window&&N&&!or.includes(e.origin)&&U(N,{...M,eventData:e.data})};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[U,M,N]);let{outputUIRef:ve,scopedCss:ye,sanitizedHtml:be,interactableScriptRef:xe}=$n(t,{}),Se=B?ce||E||s:ce||E,Ce=`floating-window-parent--${r}`,we=`floating-drag-handle--${r}`,Te=`floating-window-content--${r}`,G=t.employee_config?.[r]?.position?.quadrant?.split(`-`)[1]===`right`?`right`:`left`;x?G=`left`:b&&(G=`right`);let K=t.minimized_config?.customIcon,Ee=null;return K?.startsWith(`data:image/`)&&(Ee=({className:e=``})=>(0,X.jsx)(`img`,{src:K,alt:t.title||`Open Frame`,className:`object-cover select-none pointer-events-none ${e}`})),L||R(z(!1)),{circleProps:{id:r,side:G,circleIcon:C,CustomIcon:Ee,circleColor:w,onClick:()=>{V(!O)},hidden:!!(Se||E||v||ue)},parentProps:{className:Ce,dragging:he,hidden:Se||re||E||v},draggableProps:{onStop:_e,onStart:()=>{ge(!0)},bounds:`.${Ce}`,handle:`.${we}`,defaultPosition:{x:L?.left??0,y:L?.top??0},position:{x:L?.left??0,y:L?.top??0},disabled:S},floatProps:{pending:se,width:P,dragging:he,height:F,isCircle:y&&O},contentProps:{className:Te,dragging:he,solid:!0},minimized:O,pending:se,indicator:le,hideHeader:fe,isFixed:S,isCircle:y,outputUIRef:ve,scopedCss:ye,sanitizedHtml:be,interactableScriptRef:xe,tooltipPosition:pe,currentPluginId:D,setMinimized:V,dragHandleClassName:we,height:F,script:A,dragging:he,frameOffset:_,scriptUIRef:l}},lr=()=>{(0,H.useEffect)(()=>{let e=null,t=t=>{if(!t.detail?.location)return;let n=te(t.detail.location);n!==e&&(e=n,document.querySelectorAll(`iframe[id^=${k}-]`).forEach(e=>{let n=null;try{n=new URL(e.src,window.location.href).origin}catch(e){ee(`script-runner-logging`)&&console.warn(`Failed to parse iframe src for location change message target origin:`,e),n=null}n&&e.contentWindow?.postMessage({action:M,location:t.detail?.location},n)}))};return window.addEventListener(A,t),()=>{window.removeEventListener(A,t)}},[])},ur=new E,dr=({children:e})=>(0,H.useContext)(x)?(0,X.jsx)(X.Fragment,{children:e}):(0,X.jsx)(f,{client:ur,children:e}),fr=e=>{let{children:t,bootstrapPlugins:n=[],userConfigs:r=[],user:i,teamMember:a,business:o,clientObject:s,onNavigate:c,modal:l,monitoringExceptionHelper:u,showToast:d,clearToasts:f,performRequest:p,appPath:m,hideFramesOnModal:h=!0,createFileId:g,performFileUpload:_,t:v,invalidateCache:y,getPendingCacheCount:b}=e;return lr(),(0,X.jsx)(dr,{children:(0,X.jsx)(yn,{bootstrapPlugins:n,userConfigs:r,user:i,teamMember:a,business:o,clientObject:s,appPath:m,children:({hasFinishedBootstrapping:e,waitingOnRouteScript:n})=>(0,X.jsx)(Rn,{t:v,children:(0,X.jsx)(Sn,{children:r=>(0,X.jsx)(jn,{onNavigate:c,children:(0,X.jsx)(Tn,{...l,children:i=>(0,X.jsx)(On,{monitoringExceptionHelper:u,children:(0,X.jsx)(gn,{children:(0,X.jsx)(pn,{children:(0,X.jsx)(Hn,{showToast:d,clearToasts:f,children:(0,X.jsx)(rr,{children:a=>(0,X.jsx)(Pn,{performRequest:p,createFileId:g,performFileUpload:_,invalidateCache:y,getPendingCacheCount:b,children:t({...i,showLoadingIndicator:r,hasFinishedBootstrapping:e,waitingOnRouteScript:n,hiddenByModal:h?a:!1})})})})})})})})})})})})})},pr=(0,H.createContext)(null),mr=pr.Provider,hr=(e,t)=>{if(e===`custom_object`)return t?.id},gr=(e,t)=>{if(e.type===`custom_object`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.id;if(e.type===`field`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;if(e.type===`text`)return!!(t?.value??``).trim();if(e.type===`number`){let e=Number(t?.value);return!!t?.value&&!isNaN(e)}else if(e.type===`select`)return e.allow_multiple?(t?.value??[]).length>0:!!t?.value?.value;else if(e.type===`boolean`)return!!t?.value;return!1},_r=e=>{let t=(e.fields??[]).filter(e=>e.type===`custom_object`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>_r(e)),r=e.actions?.filter(e=>e.hint_object_name)??[];return[...t,...n,...r.map(e=>({...I(e),match_hint:e.hint_object_name??``}))]},vr=e=>{let t=(e.fields??[]).filter(e=>e.type===`field`),n=(e.fields??[]).filter(e=>e.type===`container`).flatMap(e=>vr(e));return[...t,...n]},yr=({children:e,config:t,value:n,onStateChange:r,disabledKeys:i,templateAssociationsByActionApiName:a,getObjectByAPIName:o,getCustomObjectDetails:s})=>{let[c,l]=(0,H.useState)(n??{}),u=(0,H.useMemo)(()=>F(t),[t]),d=(0,H.useMemo)(()=>u.reduce((e,t)=>({...e,[t.key]:{type:t.type,value:t.default}}),{}),[u]),f=(0,H.useMemo)(()=>{let e={...Object.entries(a??{}).reduce((e,[t,n])=>{let r=`action__${t}`,i=n.map(e=>({id:e.custom_object.id??``,objectName:e.custom_object.object_name??`Unknown Object`}));return i.length>0&&n.length>0&&n[0]&&(e[r]={type:`custom_object`,value:i,config:I(n[0].browser_js_action_template)}),e},{}),...c};return i?.forEach(t=>{e[t]&&(e[t]=void 0)}),e},[c,a,i]),p=(0,H.useRef)(!!n),m=(0,H.useRef)({}),[h,g]=(0,H.useState)(!n),[_,v]=(0,H.useState)({}),[y,b]=(0,H.useState)({}),[x,S]=(0,H.useState)(!1),C=(0,H.useRef)(null),[w,T]=(0,H.useState)({}),[E,D]=(0,H.useState)(!1),[O,k]=(0,H.useState)(!0),A=(0,H.useRef)({}),j=(0,H.useCallback)((e,t)=>{A.current[e]=t},[]),M=(0,H.useCallback)(e=>{typeof e==`function`?l(t=>{let n=e(t);return m.current=n,r?.(n),n}):(m.current=e,l(e),r?.(e)),T({})},[r]),N=(0,H.useCallback)((e,t)=>{if(e.startsWith(`{{`)&&e.endsWith(`}}`)){let n=e.slice(2,-2).trim();return hr(t[n]?.type,t[n]?.value)}return e},[]),P=(0,H.useCallback)(e=>N(e,f),[f,N]),{clientObject:L}=bn(),ee=(0,H.useCallback)(async e=>e===`client_client`&&L?[{id:L.id,object_name:L.objectName}]:await o(e),[L,o]),te=(0,H.useCallback)(async()=>{let e=_r(t);for(let t of e){if(!t.match_hint)continue;let e=await ee(t.match_hint);if(e?.[0]){let n={id:e[0].id,objectName:e[0].object_name};M(e=>({...e,[t.key]:{type:`custom_object`,value:t.allow_multiple?[n]:n}}))}}},[t,M,ee]),z=(0,H.useCallback)(()=>vr(t),[t]),B=(0,H.useCallback)(async(e,t)=>{let n=z(),r={};for(let i of n){if(!i.object_id)continue;let n=t??N(i.object_id,m.current);if(e&&!i.object_id.includes(e))continue;if(!r[n]&&n)try{r[n]=await s(n)}catch{}let a=r[n];if(a){let e=a.fields.find(e=>e.name===i.match_hint);e&&M(t=>({...t,[i.key]:{type:`field`,value:{value:e.id,label:e.displayName},associatedObject:{id:n,name:a.objectName}}}))}}},[N,z,M,s]),ne=(0,H.useCallback)(async e=>{let n=_r(t).find(t=>t.key===e);if(n?.match_hint){let t=``,r=(await ee(n.match_hint))?.[0];r&&(t=r.id,M(t=>({...t,[e]:{type:`custom_object`,value:{id:r.id,objectName:r.object_name}}})),t&&B(void 0,t))}},[t,M,B,ee]),re=(0,H.useCallback)(async()=>{await te(),await B(),g(!1)},[te,B]),ie=(0,H.useCallback)(()=>vr(t),[t]),ae=(0,H.useCallback)(e=>B(e),[B]),V=(0,H.useCallback)(()=>{C.current&&=(clearTimeout(C.current),null),C.current=setTimeout(()=>{S(!0)},500)},[]),U=(0,H.useCallback)(async(e,t)=>{V(),v(e=>({...e,[t]:!0})),D(!0);let n=await R(e,{...d,...f});return b(e=>(e[t]===!1&&typeof n==`boolean`&&n&&(f[t]||ne(t)),{...e,[t]:n})),v(e=>({...e,[t]:!1})),n},[f,V,ne,d]);p.current||(p.current=!0,re());let oe=(0,H.useCallback)(e=>y[e]===!1,[y]),se=(0,H.useCallback)(e=>_[e]===!0,[_]),ce=(0,H.useCallback)(e=>{if(w[e])return{message:w[e],showMessage:!0,error:!0}},[w]),le=(0,H.useMemo)(()=>{let e=(t.fields??[]).filter(e=>e.type===`container`).map(e=>e.when),n=u.map(e=>e.when);return[...e,...n].filter(Boolean)},[t,u]),ue=(0,H.useMemo)(()=>u.reduce((e,t)=>(e[t.key]=t,e),{}),[u]),de=(0,H.useCallback)((e,t,n)=>{t.add(e);let r=ue[e];r?.dependencies?.length&&r.dependencies.forEach(e=>{n.has(e)||(n.add(e),de(e,t,n))})},[ue]),fe=(0,H.useMemo)(()=>u.map(e=>{let t=new Set,n=e.dependencies??[],r=new Set;return n.forEach(e=>{de(e,t,r)}),{...e,dependencies:Array.from(t)}}),[u,de]),pe=(0,H.useCallback)(e=>{fe.filter(t=>t.dependencies.length===0?!1:t.dependencies.includes(e)&&t.key!==e).forEach(e=>{A.current[e.key]?.()})},[fe]),me=(0,H.useCallback)(async()=>{let e=(await Promise.all(u.map(async e=>e.when?await R(e.when,{...d,...f})?e:null:e))).filter(Boolean),t=0;for(let n of e)n&&n.required&&!gr(n,f[n.key])?(T(e=>({...e,[n.key]:`This field is required`})),t++):n?.validation_pattern?new RegExp(n.validation_pattern).test(f[n.key]?.value??n.default??``)||(T(e=>({...e,[n.key]:`Value must match the pattern ${n.validation_pattern??``}`})),t++):n&&T(e=>({...e,[n.key]:void 0}));return{isValid:t===0,includedKeys:e.map(e=>e?.key).filter(e=>!!e)}},[f,u,d]);(0,H.useEffect)(()=>{V()},[V]);let W=Object.values(_).filter(Boolean).length;return!E&&le.length===0&&D(!0),E&&O&&W===0&&k(!1),(0,X.jsx)(mr,{value:{state:f,setState:M,interpolateValue:P,getNestedFields:ie,reInferFieldsForObject:ae,inferencePending:h,evaluateExpression:U,shouldHideField:oe,shouldDisableField:se,expressionsIdle:x,getFieldErrorState:ce,validateForm:me,waitingExpressionCount:W,initialExpressionsPending:O,flattenedFields:u,flattenedFieldsByKey:ue,afterFieldChange:pe,registerFieldResetter:j,disabledKeys:i??[]},children:e})},br=()=>{let e=(0,H.useContext)(pr);if(!e)throw Error(`useSetupAssistant must be used within a SetupAssistantController`);return e};function xr(e,t=!1){let n=br(),{evaluateExpression:r,shouldHideField:i,getFieldErrorState:a,disabledKeys:o}=n;(0,H.useEffect)(()=>{e.when&&r(e.when,e.key)},[e.when,e.key,r]);let s=i(e.key),c=o.includes(e.key)||t,l=a(e.key);return{...n,shouldHide:s,isDisabled:c,errorState:l}}var Sr=({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=xr(e,t),l=n[e.key]?.value??e.default??!1,u=l===!0||l===`true`,d=(0,H.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`boolean`,value:t}})),i(e.key)},[e.key,r,i]);return(0,H.useEffect)(()=>{a(e.key,()=>{d(void 0)})},[e.key,a,d]),s?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>{d(e.target.checked)},disabled:o,className:`h-3.5 w-3.5 cursor-pointer accent-blue-600`}),(0,X.jsxs)(`span`,{className:`text-[13px] ${o?`text-neutral-400`:`text-neutral-700`}`,children:[e.label,e.required&&(0,X.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`})]}),e.tooltip&&(0,X.jsx)(`span`,{className:`text-[11px] text-neutral-400`,title:e.tooltip,children:`?`})]}),c?.showMessage&&c.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},Cr=({field:e,pluginApiName:t,disabled:n=!1})=>{let{shouldHide:r}=xr(e,n),i=e.columns??1;return r?null:(0,X.jsxs)(`div`,{children:[e.label&&(0,X.jsx)(`h3`,{className:`text-[14px] font-semibold text-neutral-800 mb-3 mt-4`,children:e.label}),(0,X.jsx)(`div`,{className:`gap-4`,style:{display:`grid`,gridTemplateColumns:`repeat(${String(i)}, 1fr)`},children:e.fields?.map(e=>(0,X.jsx)(Er,{field:e,pluginApiName:t,disabled:n},e.key))})]})},$=({field:e})=>e.label?(0,X.jsxs)(`label`,{className:`text-[12px] font-medium text-neutral-600`,children:[e.label,e.required&&(0,X.jsx)(`span`,{className:`text-red-500 ml-0.5`,children:`*`}),e.tooltip&&(0,X.jsx)(`span`,{className:`ml-1 text-neutral-400 cursor-help`,title:e.tooltip,children:`?`})]}):null,wr=({label:e,value:t,onChange:n,onSelect:a,options:o,loading:s,placeholder:c,disabled:l,keepOpenOnSelect:u})=>{let[d,f]=(0,H.useState)(!1),p=(0,H.useRef)(null);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e&&(0,X.jsx)(`label`,{className:`text-[11px] font-semibold uppercase tracking-widest text-neutral-500`,children:e}),(0,X.jsxs)(`div`,{ref:p,className:`relative`,children:[(0,X.jsx)(r,{icon:i,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[10px] text-neutral-400`}),(0,X.jsx)(`input`,{type:`text`,className:`w-full rounded border border-black/10 bg-white py-1.5 pl-7 pr-2.5 font-mono text-[12px] text-neutral-800 focus:border-neutral-400 focus:outline-none disabled:opacity-50`,value:t,placeholder:c,disabled:l,onChange:e=>{n(e.target.value)},onFocus:()=>{f(!0)},onBlur:()=>{f(!1)}})]}),(0,X.jsxs)(D,{anchorRef:p,open:d,children:[s&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Loading…`}),!s&&o.length===0&&t.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Start typing to search…`}),!s&&o.length===0&&t.length>0&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`No results`}),!s&&o.map(e=>(0,X.jsx)(`div`,{className:`cursor-pointer px-3 py-2 text-[12px] text-neutral-800 hover:bg-neutral-100`,onClick:()=>{a(e.id,e.label),u||f(!1)},children:e.label},e.id))]})]})},Tr={container:Cr,custom_object:({field:e,disabled:t=!1})=>{let{state:n,setState:r,getNestedFields:i,reInferFieldsForObject:a,shouldDisableField:o,registerFieldResetter:s,afterFieldChange:c,isDisabled:l,shouldHide:u,errorState:d}=xr(e,t),f=o(e.key)||l,[p,m]=(0,H.useState)(``),[h,g]=(0,H.useState)([]),[_,v]=(0,H.useState)(!1),y=(0,H.useRef)(null),b=O(),x=T(),S=(0,H.useCallback)(async e=>{v(!0);try{let t=new URLSearchParams({page_size:`20`});e&&t.set(`search`,e);let n=await(await b(`/custom-objects?${t.toString()}`)).json(),r=(Array.isArray(n)?n:n.results??[]).map(e=>({id:e.id,label:e.object_name})),i=x?.business.client_object;i?.access&&(!e||i.object_name.toLowerCase().includes(e.toLowerCase()))&&r.unshift({id:i.id,label:i.object_name}),g(r)}catch{}finally{v(!1)}},[b,x]),C=e.allow_multiple?n[e.key]?.value??[]:[],w=(0,H.useCallback)((t,i)=>{let a=n[e.key]?.value??[];a.some(e=>e.id===t)||(r(n=>({...n,[e.key]:{type:`custom_object`,value:[...a,{id:t,objectName:i}]}})),c(e.key),m(``))},[n,e.key,r,c]),E=(0,H.useCallback)(t=>{let i=n[e.key]?.value??[];r(n=>({...n,[e.key]:{type:`custom_object`,value:i.filter(e=>e.id!==t)}})),c(e.key)},[n,e.key,r,c]),D=e.allow_multiple?void 0:n[e.key]?.value,k=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!e.allow_multiple&&D?.objectName&&!k.current&&(m(D.objectName),k.current=!0)},[e.allow_multiple,D]);let A=(0,H.useCallback)(t=>{m(t),D&&(r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),c(e.key)),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(t)},300)},[D,e.key,r,c,S]),j=(0,H.useCallback)((t,n)=>{m(n),r(r=>({...r,[e.key]:{type:`custom_object`,value:{id:t,objectName:n}}}));let o=i().filter(t=>t.object_id?.includes(e.key));for(let e of o)r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)));a(e.key),c(e.key)},[e.key,r,i,a,c]),M=(0,H.useCallback)(t=>{e.allow_multiple?(m(t),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{S(t)},300)):A(t)},[e.allow_multiple,A,S]),N=(0,H.useCallback)((t,n)=>{e.allow_multiple?w(t,n):j(t,n)},[e.allow_multiple,w,j]);if((0,H.useEffect)(()=>{s(e.key,()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),m(``),k.current=!1})},[e.key,s,r]),u)return null;if(e.allow_multiple){let t=h.filter(e=>!C.some(t=>t.id===e.id));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),C.length>0&&(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1 mb-1`,children:C.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded bg-neutral-100 px-2 py-0.5 text-[11px] text-neutral-700`,children:[e.objectName,(0,X.jsx)(`button`,{type:`button`,onClick:()=>{E(e.id)},disabled:f,className:`text-neutral-400 hover:text-neutral-600`,"aria-label":`Remove ${e.objectName}`,children:`×`})]},e.id))}),(0,X.jsx)(wr,{value:p,onChange:M,onSelect:N,options:t,loading:_,placeholder:e.placeholder??`Search for objects...`,disabled:f,keepOpenOnSelect:!0}),d?.showMessage&&d.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:d.message})]})}return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(wr,{value:p,onChange:M,onSelect:N,options:h,loading:_,placeholder:e.placeholder??`Search for an object...`,disabled:f}),D&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>{r(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),m(``),k.current=!1,c(e.key)},disabled:f,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-neutral-400 hover:text-neutral-600`,"aria-label":`Clear selection`,children:`×`})]}),d?.showMessage&&d.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:d.message})]})},field:({field:e,disabled:t=!1})=>{let{interpolateValue:n,state:r,setState:i,registerFieldResetter:a,afterFieldChange:o,isDisabled:s,shouldHide:c,errorState:l}=xr(e,t),u=n(e.object_id??``),[d,f]=(0,H.useState)([]),[p,m]=(0,H.useState)(``),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(null),y=O();(0,H.useEffect)(()=>{!u||u===_||c||(async()=>{g(!0);try{m((await(await y(`/custom-objects/${u}`)).json()).object_name??``);let e=await(await y(`/custom-objects/${u}/fields`)).json();f((Array.isArray(e)?e:e.results??[]).map(e=>({label:e.display_name,value:e.id}))),v(u)}catch{}finally{g(!1)}})()},[u,_,y,e.key,c]);let b=r[e.key]?.value,x=(0,H.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`field`,value:t,associatedObject:{id:u,name:p}}})),o(e.key)},[e.key,i,u,p,o]);if((0,H.useEffect)(()=>{a(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key)))})},[e.key,a,i]),c)return null;let S=!u||s;if(e.allow_multiple){let t=Array.isArray(b)?b:[];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${l?.error?`border-red-300`:`border-black/10`} ${S?`bg-neutral-50`:`bg-white`}`,children:h&&d.length===0?(0,X.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading fields...`}):u?d.length===0?(0,X.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No fields available`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto transition-opacity ${h?`opacity-60`:``}`,children:d.map(e=>{let n=t.some(t=>t.value===e.value);return(0,X.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:n,disabled:S,onChange:()=>{x(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,X.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})}):(0,X.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Select an object first`})}),l?.showMessage&&l.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:l.message})]})}let C=b&&!Array.isArray(b)?b.value:``;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),h&&d.length===0?(0,X.jsx)(`div`,{className:`w-full rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading fields...`}):(0,X.jsxs)(`select`,{value:C,onChange:e=>{let t=d.find(t=>t.value===e.target.value);t&&x(t)},disabled:S,className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 transition-opacity ${l?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${S?`bg-neutral-50 text-neutral-400`:`bg-white`} ${h?`opacity-60`:``}`,children:[(0,X.jsx)(`option`,{value:``,children:u?`Choose a field`:`Select an object first`}),d.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),l?.showMessage&&l.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:l.message})]})},text:({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=xr(e,t),[l,u]=(0,H.useState)(n[e.key]?.value??e.default??``),d=(0,H.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`text`,value:t}})),i(e.key)},[e.key,r,i]);return(0,H.useEffect)(()=>{a(e.key,()=>{u(``),d(``)})},[e.key,a,d]),(0,H.useEffect)(()=>{let e=setTimeout(()=>{d(l)},300);return()=>{clearTimeout(e)}},[l,d]),s?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsx)(`input`,{type:`text`,value:l,onChange:e=>{u(e.target.value)},placeholder:e.placeholder??e.default??`Enter text`,disabled:o,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${c?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${o?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),c?.showMessage&&c.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},description:({field:e})=>{let{shouldHide:t}=xr(e);return t?null:(0,X.jsx)(`div`,{className:`text-[13px] text-neutral-500 leading-relaxed`,children:e.content})},number:({field:e,disabled:t=!1})=>{let{state:n,setState:r,afterFieldChange:i,registerFieldResetter:a,isDisabled:o,shouldHide:s,errorState:c}=xr(e,t),l=n[e.key]?.value??e.default??``,[u,d]=(0,H.useState)(String(l)),f=(0,H.useCallback)(t=>{r(n=>({...n,[e.key]:{type:`number`,value:t}})),i(e.key)},[e.key,r,i]);return(0,H.useEffect)(()=>{a(e.key,()=>{d(``),f(``)})},[e.key,a,f]),(0,H.useEffect)(()=>{let e=setTimeout(()=>{f(u)},300);return()=>{clearTimeout(e)}},[u,f]),s?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsx)(`input`,{type:`number`,value:u,onChange:e=>{d(e.target.value)},placeholder:e.placeholder??e.default??`Enter a number`,disabled:o,className:`rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${c?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${o?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),c?.showMessage&&c.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:c.message})]})},select:({field:e,pluginApiName:t,disabled:n=!1})=>{let{state:r,setState:i,inferencePending:a,initialExpressionsPending:o,expressionsIdle:s,afterFieldChange:c,registerFieldResetter:l,isDisabled:u,shouldHide:d,errorState:f}=xr(e,n),p=!a&&!o&&s,[m,h]=(0,H.useState)([]),[g,_]=(0,H.useState)(!1),v=(0,H.useRef)(null),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(``),[C,w]=(0,H.useState)(!1),T=(0,H.useRef)(null),E=!!(e.getFetchUrl||e.optionMapper),k=r[e.key]?.value,A=O(),j=(0,H.useCallback)(t=>{i(n=>({...n,[e.key]:{type:`select`,value:t}})),c(e.key)},[c,e.key,i]);(0,H.useEffect)(()=>{l(e.key,()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),b(``),S(``)})},[e.key,l,i]),(0,H.useEffect)(()=>{if(!e.typeahead)return;let t=setTimeout(()=>{S(y)},300);return()=>{clearTimeout(t)}},[y,e.typeahead]);let M=(0,H.useMemo)(()=>e.typeahead?{...r,search:x}:r,[r,x,e.typeahead]),P=(0,H.useMemo)(()=>JSON.stringify(M),[M]),F=(0,H.useCallback)(async n=>{_(!0);try{let r={__kizen_state:{value:{...n,pluginApiName:t}}},i;if(e.getFetchUrl){let t=await re(e.getFetchUrl,r);if(t){let n=e.fetchMethod??`GET`,a={"Content-Type":`application/json`},o=null;if(e.getHeaders&&(a=await L(e.getHeaders,r)),n===`POST`&&e.getBody){let t=await L(e.getBody,r);o=JSON.stringify(t)}if(t.startsWith(`/`))i={data:await(await A(t,{method:n,headers:a,...o!=null&&{body:o}})).json()};else{let e=await fetch(t,{method:n,headers:a,...o!=null&&{body:o}});e.ok&&(i=await e.json())}}}if(e.optionMapper){let r=await N(e.optionMapper,{__kizen_state:{value:{...n,result:i,pluginApiName:t}}});h(structuredClone(r))}else Array.isArray(i)&&h(i)}catch{}finally{_(!1)}},[e,t,A]);if((0,H.useEffect)(()=>{!E||!p||d||e.typeahead||v.current!==P&&(v.current=P,F(M))},[E,p,P,M,e.typeahead,d,F]),(0,H.useEffect)(()=>{!E||!p||d||!e.typeahead||C&&v.current!==P&&(v.current=P,F(M))},[E,p,P,M,e.typeahead,C,d,F]),(0,H.useEffect)(()=>{!E||!e.autoSelect||e.typeahead||u||d||k||m.length===1&&m[0]&&(e.allow_multiple?j([m[0]]):j(m[0]))},[E,e.autoSelect,e.typeahead,e.allow_multiple,u,d,k,m,j]),d)return null;let I=E?m:e.options??[];if(e.allow_multiple){let t=Array.isArray(k)?k:[];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsx)(`div`,{className:`rounded border p-2 text-[13px] ${f?.error?`border-red-300`:`border-black/10`} ${u?`bg-neutral-50`:`bg-white`}`,children:g&&I.length===0?(0,X.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`Loading options...`}):I.length===0?(0,X.jsx)(`span`,{className:`text-neutral-400 text-[12px]`,children:`No options available`}):(0,X.jsx)(`div`,{className:`flex flex-col gap-1 max-h-48 overflow-y-auto transition-opacity ${g?`opacity-60`:``}`,children:I.map(e=>{let n=t.some(t=>t.value===e.value);return(0,X.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:n,disabled:u,onChange:()=>{j(n?t.filter(t=>t.value!==e.value):[...t,e])},className:`h-3 w-3 accent-blue-600`}),(0,X.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value)})})}),f?.showMessage&&f.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})}if(e.typeahead){let t=k&&!Array.isArray(k)?k.label:``;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),(0,X.jsxs)(`div`,{ref:T,className:`relative`,children:[(0,X.jsx)(`input`,{type:`text`,value:t&&!C?t:y,placeholder:e.placeholder??`Search...`,disabled:u,onChange:t=>{b(t.target.value),k&&(i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),c(e.key))},onFocus:()=>{w(!0),t&&b(t)},onBlur:()=>{w(!1)},className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 ${f?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${u?`bg-neutral-50 text-neutral-400`:`bg-white`}`}),t&&!C&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>{i(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.key))),b(``),S(``),c(e.key)},disabled:u,className:`absolute right-2 top-1/2 -translate-y-1/2 text-[11px] text-neutral-400 hover:text-neutral-600`,"aria-label":`Clear selection`,children:`×`})]}),(0,X.jsxs)(D,{anchorRef:T,open:C,children:[g&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Loading...`}),!g&&I.length===0&&y.length===0&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`Start typing to search...`}),!g&&I.length===0&&y.length>0&&(0,X.jsx)(`div`,{className:`px-3 py-2 text-[12px] text-neutral-400`,children:`No results`}),!g&&I.map(e=>(0,X.jsx)(`div`,{className:`cursor-pointer px-3 py-2 text-[12px] text-neutral-800 hover:bg-neutral-100`,onClick:()=>{j(e),b(e.label),w(!1)},children:e.label},e.value))]}),f?.showMessage&&f.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})}let R=k&&!Array.isArray(k)?I.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(k.value)):-1;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,X.jsx)($,{field:e}),g&&I.length===0?(0,X.jsx)(`div`,{className:`w-full rounded border border-black/10 px-2 py-1.5 text-[12px] text-neutral-400 bg-neutral-50`,children:`Loading options...`}):(0,X.jsxs)(`select`,{value:R>=0?String(R):``,onChange:e=>{let t=I[Number(e.target.value)];t&&j(t)},disabled:u,className:`w-full rounded border px-2 py-1.5 text-[13px] font-mono focus:outline-none focus:ring-1 transition-opacity ${f?.error?`border-red-300 focus:ring-red-400`:`border-black/10 focus:ring-blue-400`} ${u?`bg-neutral-50 text-neutral-400`:`bg-white`} ${g?`opacity-60`:``}`,children:[(0,X.jsx)(`option`,{value:``,children:e.placeholder??`Choose an option`}),I.map((e,t)=>(0,X.jsx)(`option`,{value:String(t),children:e.label},e.label))]}),f?.showMessage&&f.message&&(0,X.jsx)(`span`,{className:`text-[11px] text-red-500`,children:f.message})]})},boolean:Sr},Er=({field:e,pluginApiName:t,disabled:n=!1})=>{let r=Tr[e.type];return(0,X.jsx)(r,{field:e,pluginApiName:t,disabled:n})},Dr=new Set([`get`,`delete`,`head`]),Or=async(e,t,n,r,i)=>{let a=r!=null,o=r instanceof FormData||r instanceof Blob,s=a&&!o?{"Content-Type":`application/json`,...i?.headers}:i?.headers,c=await e(n,{method:t,...a&&{body:o?r:JSON.stringify(r)},...s&&{headers:s}});return c.status===204||c.headers.get(`content-length`)===`0`?{}:await c.json()};function kr(e){return{get:(t,n)=>Or(e,`GET`,t,void 0,n),delete:(t,n)=>Or(e,`DELETE`,t,void 0,n),head:(t,n)=>Or(e,`HEAD`,t,void 0,n),post:(t,n,r)=>Or(e,`POST`,t,n,r),put:(t,n,r)=>Or(e,`PUT`,t,n,r),patch:(t,n,r)=>Or(e,`PATCH`,t,n,r),request:(t,n,r,i)=>{let a=t.toLowerCase(),o=Dr.has(a)?r:i,s=Dr.has(a)?void 0:r;return Or(e,t.toUpperCase(),n,s,o)}}}var Ar=()=>{let e=O(),t=T();return{getObjectByAPIName:(0,H.useCallback)(async n=>{try{let t=await(await e(`/api/custom-objects?filters=${encodeURIComponent(JSON.stringify({api_name:n}))}`)).json(),r=Array.isArray(t)?t:t.results;if(r&&r.length>0)return r}catch{}let r=t?.business.client_object;if(r?.access&&r.name===n)return[{id:r.id,object_name:r.object_name}]},[e,t]),getCustomObjectDetails:(0,H.useCallback)(async t=>{try{let[n,r]=await Promise.all([e(`/api/custom-objects/${t}`),e(`/api/custom-objects/${t}/fields`)]),i=await n.json(),a=await r.json(),o=Array.isArray(a)?a:a.results??[];return{id:t,objectName:i.object_name??``,fields:o.map(e=>({id:e.id,name:e.name,displayName:e.display_name}))}}catch{return{id:t,objectName:``,fields:[]}}},[e])}},jr=({state:e,onDismiss:t})=>{let n=e.error?.message??`Unknown error`,r=e.context?.workerName,i=e.context?.pluginApiName;return(0,X.jsx)(w,{open:e.visible,size:`xl`,ariaModal:!0,fontMono:!1,onBackdropClick:t,header:(0,X.jsx)(C,{title:`Critical Exception`,statusDot:`red`}),footer:(0,X.jsx)(`button`,{onClick:t,className:`rounded bg-neutral-900 px-3 py-1.5 text-[12px] text-white transition-colors hover:bg-neutral-700`,children:`Dismiss`}),children:(0,X.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,X.jsx)(`p`,{className:`m-0 mb-3 text-[12px] leading-relaxed text-neutral-700`,children:`This error will be logged in Kizen's monitoring stack. Did you mean to throw it, or would you prefer to handle the error in your application code with a toast or other messaging?`}),(r??i)&&(0,X.jsxs)(`div`,{className:`mb-3 flex flex-wrap gap-2 text-[11px] text-neutral-600`,children:[r&&(0,X.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 font-mono`,children:[`worker: `,r]}),i&&(0,X.jsxs)(`span`,{className:`rounded bg-neutral-100 px-2 py-0.5 font-mono`,children:[`plugin: `,i]})]}),(0,X.jsx)(`div`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wide text-neutral-500`,children:`Error`}),(0,X.jsx)(`div`,{className:`whitespace-pre-wrap break-words rounded border border-black/10 bg-neutral-950 px-3 py-2 font-mono text-[11px] leading-relaxed text-amber-300`,children:n})]})})};function Mr(){let[e,t]=(0,H.useState)({visible:!1});return{onMonitoringException:(0,H.useCallback)((e,n)=>{let r={};n.extra.workerName!==void 0&&(r.workerName=n.extra.workerName),n.extra.pluginApiName!==void 0&&(r.pluginApiName=n.extra.pluginApiName),t({visible:!0,error:e,context:r})},[]),dialog:(0,X.jsx)(jr,{state:e,onDismiss:(0,H.useCallback)(()=>{t(e=>({...e,visible:!1}))},[])})}}export{wr as a,tr as c,cr as d,Zn as f,Er as i,Yn as l,br as m,Ar as n,fr as o,Qn as p,kr as r,yr as s,Mr as t,Gn as u};
|