@ziila/sdk 0.1.7 → 0.1.50
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/entries/index.d.ts +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +48 -46
- package/dist/src/ZiilaWidget.d.ts +1 -1
- package/dist/src/types.d.ts +74 -16
- package/dist/widget.iife.js +1 -1
- package/package.json +1 -2
package/dist/entries/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ZiilaWidget } from '../src/ZiilaWidget';
|
|
2
2
|
export { isZiilaError } from '../src/utils';
|
|
3
|
-
export type { ThemeTokens, ThemeStyles,
|
|
3
|
+
export type { ThemeTokens, ThemeStyles, ButtonElementStyle, ButtonVariant, ButtonSize, ButtonVariantStyle, ButtonSizeStyle, InputElementStyle, ThemeElement, ZiilaConfig, WidgetInitConfig, ZiilaEvent, ZiilaCommand, EventPayloadMap, CommandPayloadMap, AddToCartPayload, RemoveFromCartPayload, CartUpdatedItem, CartUpdatedPayload, ProductViewedPayload, SearchPayload, ErrorPayload, ParentMessage, WidgetMessage, HandshakeMessage, ConfirmKind, } from '../src/types';
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e,t){this.iframe=null,this.port=null,this.handleHandshake=e=>{let t=this.iframe?.contentWindow;if(!t||e.source!==t||e.origin!==new URL(this.url).origin)return;let n=e.data;if(typeof n!=`object`||!n||n.type!==`HANDSHAKE`)return;let r=new MessageChannel;t.postMessage({type:`HANDSHAKE_ACK`},new URL(this.url).origin,[r.port2]),this.port=r.port1,this.port.start(),window.removeEventListener(`message`,this.handleHandshake),this.onPortReady(r.port1)},this.onPortReady=e,this.url=t??`https://widget.ziila.com`}mount(e){this.iframe=document.createElement(`iframe`),this.iframe.src=this.url,this.iframe.title=`Ziila Shopping Assistant`,this.iframe.style.cssText=`width:100%;height:100%;border:none;`,e.appendChild(this.iframe),window.addEventListener(`message`,this.handleHandshake)}send(e){this.port?.postMessage(e)}destroy(){window.removeEventListener(`message`,this.handleHandshake),this.port?.close(),this.iframe?.remove(),this.iframe=null,this.port=null}},t=class{constructor(){this.handlers=new Map}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){this.handlers.get(e)?.forEach(e=>e(t))}destroy(){this.handlers.clear()}},n=`position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.4);padding:24px;font-family:system-ui,-apple-system,sans-serif;`,r=`width:100%;max-width:24rem;border-radius:12px;background:#fff;padding:16px;box-shadow:2px 4px 2px rgba(0,0,0,0.1);display:flex;flex-direction:column;gap:16px;`,i=`display:flex;justify-content:flex-end;`,a=`border:none;background:#f0f0f0;border-radius:12px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;color:#555;line-height:1;padding:0;`,o=`display:flex;flex-direction:column;gap:16px;align-items:center;`,ee=`margin:0;font-size:24px;font-weight:700;color:#195f6b;text-align:center;`,s=`margin:0;font-size:16px;color:#2d2d2d;font-weight:500;line-height:27px;text-align:center;max-width:345px;`,c=`display:flex;gap:16px;padding:0 16px;width:100%;box-sizing:border-box;`,te=`flex:1;border:1px solid #195f6b;border-radius:8px;background:#fff;color:#195f6b;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,ne=`flex:1;border:none;border-radius:8px;background:#cc0000;color:#fff;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,l=class{constructor(){this.overlay=null,this.pendingResolve=null,this.previousFocus=null}show(e){return this.pendingResolve?.(!1),this.pendingResolve=null,this.close(),new Promise(t=>{this.pendingResolve=t;let l=e=>{this.pendingResolve=null,this.close(),t(e)},u=document.createElement(`div`);u.style.cssText=n;let d=document.createElement(`div`);d.setAttribute(`role`,`dialog`),d.setAttribute(`aria-modal`,`true`),d.setAttribute(`aria-labelledby`,`ziila-confirm-title`),d.style.cssText=r,d.dir=e.dir;let f=document.createElement(`div`);f.style.cssText=i;let p=document.createElement(`button`);p.type=`button`,p.setAttribute(`aria-label`,e.closeLabel),p.textContent=`✕`,p.style.cssText=a,p.addEventListener(`click`,()=>l(!1)),f.appendChild(p);let m=document.createElement(`div`);m.style.cssText=o;let h=document.createElement(`h2`);h.id=`ziila-confirm-title`,h.textContent=e.title,h.style.cssText=ee;let g=document.createElement(`p`);g.textContent=e.message,g.style.cssText=s;let _=document.createElement(`button`);_.type=`button`,_.textContent=e.cancelLabel,_.style.cssText=te,_.addEventListener(`click`,()=>l(!1));let v=document.createElement(`button`);v.type=`button`,v.textContent=e.confirmLabel,v.style.cssText=ne,v.addEventListener(`click`,()=>l(!0));let y=document.createElement(`div`);y.style.cssText=c,y.append(_,v),m.append(h,g,y),d.append(f,m),u.appendChild(d);let b=[p,_,v];u.addEventListener(`keydown`,e=>{if(e.key===`Escape`){l(!1);return}e.key===`Tab`&&(e.preventDefault(),b[(b.indexOf(document.activeElement)+(e.shiftKey?-1:1)+b.length)%b.length].focus())}),this.previousFocus=document.activeElement,this.overlay=u,document.body.appendChild(u),_.focus()})}close(){this.overlay?.remove(),this.overlay=null,this.previousFocus?.focus(),this.previousFocus=null}},u={primaryColor:[`--primary`,`--primary-color`,`--color-primary`,`--brand`,`--brand-color`,`--accent-color`,`--bs-primary`,`--mui-palette-primary-main`,`--ant-color-primary`],borderRadius:[`--radius`,`--border-radius`,`--rounded`,`--bs-border-radius`]},d=new Set([``,`transparent`,`inherit`,`initial`,`unset`,`none`,`rgba(0, 0, 0, 0)`,`rgb(0, 0, 0)`,`depends on user agent`]);function f(e){return!!e&&!d.has(e.trim().toLowerCase())}function p(e=document){let t=e.defaultView??globalThis,n=t.getComputedStyle(e.documentElement),r=e.body?t.getComputedStyle(e.body):null,i={};r&&(f(r.fontFamily)&&(i.fontFamily=r.fontFamily),f(r.backgroundColor)&&(i.backgroundColor=r.backgroundColor),f(r.color)&&(i.foregroundColor=r.color));for(let[e,t]of Object.entries(u))for(let r of t){let t=n.getPropertyValue(r).trim();if(f(t)){i[e]=t;break}}return i}function m(e,t={}){let n={...p(t.doc??document),...e?.tokens},r={};return Object.keys(n).length>0&&(r.tokens=n),e?.elements&&Object.keys(e.elements).length>0&&(r.elements=e.elements),r}var h={},g=[`en`,`ar`],_=[`baseLocale`],v=[],y,b;function x(e){if(v.length===0)return;let t=typeof e==`string`?e:e.href;if(y===t)return b;let n=new URL(t,`http://dummy.com`),r;for(let e of v)if(new h(e.match,n.href).exec(n.href)){r=e;break}return y=t,b=r,r}function S(e){let t=x(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:_}var C=void 0;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var w=!1,T=()=>{if(C){let e=C?.getStore()?.locale;if(e)return e}let e=_;typeof window<`u`&&window.location?.href&&(e=S(window.location.href));let t=E(e,typeof window<`u`?window.location?.href:void 0);if(t)return w||(w=!0,k(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found`)};function E(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(N(t)&&M.has(t)){let e=M.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return j(t)}}let e=A(n);if(e)return e}}var D=e=>{T=e},O=e=>{e?window.location.href=e:window.location.reload()},k=(e,t)=>{let n={reload:!0,...t},r;try{r=T()}catch{}let i=[],a=_;typeof window<`u`&&window.location?.href&&(a=S(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(N(t)&&M.has(t)){let n=M.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{n.reload&&window.location&&e!==r&&O(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function A(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of g)if(e.toLowerCase()===t)return e}function j(e){let t=A(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${g.join(`, `)}`)}var M=new Map;function N(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var P=()=>`End Chat`,F=()=>`إنهاء المحادثة`,I=((e={},t={})=>(t.locale??T())===`en`?P(e):F(e)),L=()=>`Are you sure you want to end this chat?`,R=()=>`هل أنت متأكد أنك تريد إنهاء هذه المحادثة؟`,z=((e={},t={})=>(t.locale??T())===`en`?L(e):R(e)),B=()=>`End Chat`,V=()=>`إنهاء المحادثة`,H=((e={},t={})=>(t.locale??T())===`en`?B(e):V(e)),U=()=>`Cancel`,W=()=>`إلغاء`,G=((e={},t={})=>(t.locale??T())===`en`?U(e):W(e)),re=()=>`Leave Chat`,K=()=>`مغادرة المحادثة`,q=((e={},t={})=>(t.locale??T())===`en`?re(e):K(e)),J=()=>`If you leave now, your chat will end. Are you sure you want to leave?`,Y=()=>`إذا غادرت الآن، ستنتهي محادثتك. هل أنت متأكد أنك تريد المغادرة؟`,X=((e={},t={})=>(t.locale??T())===`en`?J(e):Y(e)),ie=()=>`Leave`,ae=()=>`مغادرة`,oe=((e={},t={})=>(t.locale??T())===`en`?ie(e):ae(e)),se=()=>`Stay`,ce=()=>`البقاء`,le=((e={},t={})=>(t.locale??T())===`en`?se(e):ce(e)),ue=()=>`Close`,de=()=>`إغلاق`,fe=((e={},t={})=>(t.locale??T())===`en`?ue(e):de(e)),pe=new Set(g),Z=`en`;D(()=>Z);function me(){return Z}function Q(e){Z=e&&pe.has(e)?e:`en`}function he(e){return e===`ar`?`rtl`:`ltr`}function ge(e){let t=he(me()),n=fe();return e===`endChat`?{title:I(),message:z(),confirmLabel:H(),cancelLabel:G(),closeLabel:n,dir:t}:{title:q(),message:X(),confirmLabel:oe(),cancelLabel:le(),closeLabel:n,dir:t}}var $=class{get isDirty(){return this._isDirty}constructor(e){this.bridge=null,this.bus=new t,this.confirmDialog=new l,this._isDirty=!1,this.handleBeforeUnload=e=>{this._isDirty&&(e.preventDefault(),e.returnValue=``)},this.handleMessage=e=>{let t=e.data;t.type===`READY`?this.bus.emit(`ready`):t.type===`EVENT`?this.bus.emit(t.event,t.payload):t.type===`DIRTY_STATE`?this._isDirty=t.isDirty:t.type===`CONFIRM_REQUEST`&&this.handleConfirmRequest(t.kind)},this.config=e,Q(e.locale)}mount(){if(this.bridge)return;let t=typeof this.config.container==`string`?document.querySelector(this.config.container):this.config.container;if(!t)throw Error(`Ziila: container not found: ${this.config.container}`);this.bridge=new e(e=>{e.onmessage=this.handleMessage;let{container:t,...n}=this.config,r=m(this.config.theme);this.bridge?.send({type:`INIT`,payload:{...n,theme:r}})},this.config.widgetUrl),this.bridge.mount(t),window.addEventListener(`beforeunload`,this.handleBeforeUnload)}handleConfirmRequest(e){this.confirmDialog.show(ge(e)).then(t=>{this.bridge?.send({type:`CONFIRM_RESULT`,kind:e,confirmed:t})})}on(e,t){return this.bus.on(e,t)}off(e,t){this.bus.off(e,t)}emit(e,t){this.bridge?.send({type:`COMMAND`,command:e,payload:t})}update(e){this.config={...this.config,...e},e.locale!==void 0&&Q(e.locale),this.bridge?.send({type:`UPDATE`,payload:e})}destroy(){window.removeEventListener(`beforeunload`,this.handleBeforeUnload),this.confirmDialog.close(),this.bridge?.destroy(),this.bus.destroy(),this.bridge=null}};function _e(e){return typeof e==`object`&&!!e&&typeof e.code==`string`&&typeof e.message==`string`}exports.ZiilaWidget=$,exports.isZiilaError=_e;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class{constructor(e,t){this.iframe=null,this.port=null,this.handleHandshake=e=>{let t=this.iframe?.contentWindow;if(!t||e.source!==t||e.origin!==new URL(this.url).origin)return;let n=e.data;if(typeof n!=`object`||!n||n.type!==`HANDSHAKE`)return;let r=new MessageChannel;t.postMessage({type:`HANDSHAKE_ACK`},new URL(this.url).origin,[r.port2]),this.port=r.port1,this.port.start(),window.removeEventListener(`message`,this.handleHandshake),this.onPortReady(r.port1)},this.onPortReady=e,this.url=t??`https://widget.ziila.com`}mount(e){let t=new URL(this.url);t.searchParams.set(`embedded`,`1`),this.iframe=document.createElement(`iframe`),this.iframe.src=t.toString(),this.iframe.title=`Ziila Shopping Assistant`,this.iframe.style.cssText=`width:100%;height:100%;border:none;`,e.appendChild(this.iframe),window.addEventListener(`message`,this.handleHandshake)}send(e){this.port?.postMessage(e)}destroy(){window.removeEventListener(`message`,this.handleHandshake),this.port?.close(),this.iframe?.remove(),this.iframe=null,this.port=null}},t=class{constructor(){this.handlers=new Map}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){this.handlers.get(e)?.forEach(e=>e(t))}destroy(){this.handlers.clear()}},n=`position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.4);padding:24px;font-family:system-ui,-apple-system,sans-serif;`,r=`width:100%;max-width:24rem;border-radius:12px;background:#fff;padding:16px;box-shadow:2px 4px 2px rgba(0,0,0,0.1);display:flex;flex-direction:column;gap:16px;`,i=`display:flex;justify-content:flex-end;`,a=`border:none;background:#f0f0f0;border-radius:12px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;color:#555;line-height:1;padding:0;`,o=`display:flex;flex-direction:column;gap:16px;align-items:center;`,ee=`margin:0;font-size:24px;font-weight:700;color:#195f6b;text-align:center;`,s=`margin:0;font-size:16px;color:#2d2d2d;font-weight:500;line-height:27px;text-align:center;max-width:345px;`,c=`display:flex;gap:16px;padding:0 16px;width:100%;box-sizing:border-box;`,te=`flex:1;border:1px solid #195f6b;border-radius:8px;background:#fff;color:#195f6b;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,ne=`flex:1;border:none;border-radius:8px;background:#cc0000;color:#fff;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,l=class{constructor(){this.overlay=null,this.pendingResolve=null,this.previousFocus=null}show(e){return this.pendingResolve?.(!1),this.pendingResolve=null,this.close(),new Promise(t=>{this.pendingResolve=t;let l=e=>{this.pendingResolve=null,this.close(),t(e)},u=document.createElement(`div`);u.style.cssText=n;let d=document.createElement(`div`);d.setAttribute(`role`,`dialog`),d.setAttribute(`aria-modal`,`true`),d.setAttribute(`aria-labelledby`,`ziila-confirm-title`),d.style.cssText=r,d.dir=e.dir;let f=document.createElement(`div`);f.style.cssText=i;let p=document.createElement(`button`);p.type=`button`,p.setAttribute(`aria-label`,e.closeLabel),p.textContent=`✕`,p.style.cssText=a,p.addEventListener(`click`,()=>l(!1)),f.appendChild(p);let m=document.createElement(`div`);m.style.cssText=o;let h=document.createElement(`h2`);h.id=`ziila-confirm-title`,h.textContent=e.title,h.style.cssText=ee;let g=document.createElement(`p`);g.textContent=e.message,g.style.cssText=s;let _=document.createElement(`button`);_.type=`button`,_.textContent=e.cancelLabel,_.style.cssText=te,_.addEventListener(`click`,()=>l(!1));let v=document.createElement(`button`);v.type=`button`,v.textContent=e.confirmLabel,v.style.cssText=ne,v.addEventListener(`click`,()=>l(!0));let y=document.createElement(`div`);y.style.cssText=c,y.append(_,v),m.append(h,g,y),d.append(f,m),u.appendChild(d);let b=[p,_,v];u.addEventListener(`keydown`,e=>{if(e.key===`Escape`){l(!1);return}if(e.key===`Tab`){e.preventDefault();let t=(b.indexOf(document.activeElement)+(e.shiftKey?-1:1)+b.length)%b.length;b[t].focus()}}),this.previousFocus=document.activeElement,this.overlay=u,document.body.appendChild(u),_.focus()})}close(){this.overlay?.remove(),this.overlay=null,this.previousFocus?.focus(),this.previousFocus=null}},u={primaryColor:[`--primary`,`--primary-color`,`--color-primary`,`--brand`,`--brand-color`,`--accent-color`,`--bs-primary`,`--mui-palette-primary-main`,`--ant-color-primary`],borderRadius:[`--radius`,`--border-radius`,`--rounded`,`--bs-border-radius`]},d=new Set([``,`transparent`,`inherit`,`initial`,`unset`,`none`,`rgba(0, 0, 0, 0)`,`rgb(0, 0, 0)`,`depends on user agent`]);function f(e){return!!e&&!d.has(e.trim().toLowerCase())}function p(e=document){let t=e.defaultView??globalThis,n=t.getComputedStyle(e.documentElement),r=e.body?t.getComputedStyle(e.body):null,i={};r&&(f(r.fontFamily)&&(i.fontFamily=r.fontFamily),f(r.backgroundColor)&&(i.backgroundColor=r.backgroundColor),f(r.color)&&(i.foregroundColor=r.color));for(let[e,t]of Object.entries(u))for(let r of t){let t=n.getPropertyValue(r).trim();if(f(t)){i[e]=t;break}}return i}function m(e,t={}){let n={...p(t.doc??document),...e?.tokens},r={};return Object.keys(n).length>0&&(r.tokens=n),e?.elements&&Object.keys(e.elements).length>0&&(r.elements=e.elements),r}var h={},g=[`en`,`ar`],_=`PARAGLIDE_LOCALE`,v=[`baseLocale`],y=[],b,x;function S(e){if(y.length===0)return;let t=typeof e==`string`?e:e.href;if(b===t)return x;let n=new URL(t,`http://dummy.com`),r;for(let e of y)if(new h(e.match,n.href).exec(n.href)){r=e;break}return b=t,x=r,r}function C(e){let t=S(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:v}globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var w=!1,T=()=>{let e=v;typeof window<`u`&&window.location?.href&&(e=C(window.location.href));let t=E(e,typeof window<`u`?window.location?.href:void 0);if(t)return w||(w=!0,k(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function E(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(P(t)&&N.has(t)){let e=N.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return j(t)}}let e=A(n);if(e)return e}}var D=e=>{T=e},O=e=>{e?window.location.href=e:window.location.reload()},k=(e,t)=>{let n={reload:!0,...t},r;try{r=T()}catch{}let i=[],a=v;typeof window<`u`&&window.location?.href&&(a=C(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(P(t)&&N.has(t)){let n=N.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{n.reload&&window.location&&e!==r&&O(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function A(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of g)if(e.toLowerCase()===t)return e}function j(e){let t=A(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${g.join(`, `)}`)}var M=_.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:^|;\\s*)${M}=([^;]*)`);var N=new Map;function P(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var F=()=>`End Chat`,I=()=>`إنهاء المحادثة`,L=((e={},t={})=>(t.locale??T())===`en`?F(e):I(e)),R=()=>`Are you sure you want to end this chat?`,z=()=>`هل أنت متأكد أنك تريد إنهاء هذه المحادثة؟`,B=((e={},t={})=>(t.locale??T())===`en`?R(e):z(e)),V=()=>`End Chat`,H=()=>`إنهاء المحادثة`,U=((e={},t={})=>(t.locale??T())===`en`?V(e):H(e)),W=()=>`Cancel`,G=()=>`إلغاء`,re=((e={},t={})=>(t.locale??T())===`en`?W(e):G(e)),K=()=>`Leave Chat`,q=()=>`مغادرة المحادثة`,J=((e={},t={})=>(t.locale??T())===`en`?K(e):q(e)),Y=()=>`If you leave now, your chat will end. Are you sure you want to leave?`,X=()=>`إذا غادرت الآن، ستنتهي محادثتك. هل أنت متأكد أنك تريد المغادرة؟`,ie=((e={},t={})=>(t.locale??T())===`en`?Y(e):X(e)),ae=()=>`Leave`,oe=()=>`مغادرة`,se=((e={},t={})=>(t.locale??T())===`en`?ae(e):oe(e)),ce=()=>`Stay`,le=()=>`البقاء`,ue=((e={},t={})=>(t.locale??T())===`en`?ce(e):le(e)),de=()=>`Close`,fe=()=>`إغلاق`,pe=((e={},t={})=>(t.locale??T())===`en`?de(e):fe(e)),me=new Set(g),Z=`en`;D(()=>Z);function Q(){return Z}function $(e){Z=e&&me.has(e)?e:`en`}function he(e){return e===`ar`?`rtl`:`ltr`}function ge(e){let t=he(Q()),n=pe();return e===`endChat`?{title:L(),message:B(),confirmLabel:U(),cancelLabel:re(),closeLabel:n,dir:t}:{title:J(),message:ie(),confirmLabel:se(),cancelLabel:ue(),closeLabel:n,dir:t}}var _e=class{get isDirty(){return this._isDirty}constructor(e){this.bridge=null,this.bus=new t,this.confirmDialog=new l,this._isDirty=!1,this.handleBeforeUnload=e=>{this._isDirty&&(e.preventDefault(),e.returnValue=``)},this.handleMessage=e=>{let t=e.data;t.type===`READY`?this.bus.emit(`ready`):t.type===`EVENT`?this.bus.emit(t.event,t.payload):t.type===`DIRTY_STATE`?this._isDirty=t.isDirty:t.type===`CONFIRM_REQUEST`&&this.handleConfirmRequest(t.kind)},this.config=e,$(e.locale)}mount(){if(this.bridge)return;let t=typeof this.config.container==`string`?document.querySelector(this.config.container):this.config.container;if(!t)throw Error(`Ziila: container not found: ${this.config.container}`);this.bridge=new e(e=>{e.onmessage=this.handleMessage;let{container:t,...n}=this.config,r=m(this.config.theme);this.bridge?.send({type:`INIT`,payload:{...n,theme:r}})},this.config.widgetUrl),this.bridge.mount(t),window.addEventListener(`beforeunload`,this.handleBeforeUnload)}handleConfirmRequest(e){this.confirmDialog.show(ge(e)).then(t=>{this.bridge?.send({type:`CONFIRM_RESULT`,kind:e,confirmed:t})})}on(e,t){return this.bus.on(e,t)}off(e,t){this.bus.off(e,t)}emit(e,t){this.bridge?.send({type:`COMMAND`,command:e,payload:t})}update(e){this.config={...this.config,...e},e.locale!==void 0&&$(e.locale),this.bridge?.send({type:`UPDATE`,payload:e})}destroy(){window.removeEventListener(`beforeunload`,this.handleBeforeUnload),this.confirmDialog.close(),this.bridge?.destroy(),this.bus.destroy(),this.bridge=null}};function ve(e){return typeof e==`object`&&!!e&&typeof e.code==`string`&&typeof e.message==`string`}exports.ZiilaWidget=_e,exports.isZiilaError=ve;
|
package/dist/index.esm.js
CHANGED
|
@@ -10,7 +10,8 @@ var e = class {
|
|
|
10
10
|
}, this.onPortReady = e, this.url = t ?? "https://widget.ziila.com";
|
|
11
11
|
}
|
|
12
12
|
mount(e) {
|
|
13
|
-
|
|
13
|
+
let t = new URL(this.url);
|
|
14
|
+
t.searchParams.set("embedded", "1"), this.iframe = document.createElement("iframe"), this.iframe.src = t.toString(), this.iframe.title = "Ziila Shopping Assistant", this.iframe.style.cssText = "width:100%;height:100%;border:none;", e.appendChild(this.iframe), window.addEventListener("message", this.handleHandshake);
|
|
14
15
|
}
|
|
15
16
|
send(e) {
|
|
16
17
|
this.port?.postMessage(e);
|
|
@@ -73,7 +74,11 @@ var e = class {
|
|
|
73
74
|
l(!1);
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
e.key === "Tab"
|
|
77
|
+
if (e.key === "Tab") {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
let t = (b.indexOf(document.activeElement) + (e.shiftKey ? -1 : 1) + b.length) % b.length;
|
|
80
|
+
b[t].focus();
|
|
81
|
+
}
|
|
77
82
|
}), this.previousFocus = document.activeElement, this.overlay = u, document.body.appendChild(u), _.focus();
|
|
78
83
|
});
|
|
79
84
|
}
|
|
@@ -98,7 +103,7 @@ var e = class {
|
|
|
98
103
|
"--rounded",
|
|
99
104
|
"--bs-border-radius"
|
|
100
105
|
]
|
|
101
|
-
}, d = new Set([
|
|
106
|
+
}, d = /* @__PURE__ */ new Set([
|
|
102
107
|
"",
|
|
103
108
|
"transparent",
|
|
104
109
|
"inherit",
|
|
@@ -135,41 +140,36 @@ function m(e, t = {}) {
|
|
|
135
140
|
}
|
|
136
141
|
//#endregion
|
|
137
142
|
//#region src/paraglide/runtime.js
|
|
138
|
-
var h = {}, g = ["en", "ar"], _ = ["baseLocale"],
|
|
139
|
-
function
|
|
140
|
-
if (
|
|
143
|
+
var h = {}, g = ["en", "ar"], _ = "PARAGLIDE_LOCALE", v = ["baseLocale"], y = [], b, x;
|
|
144
|
+
function S(e) {
|
|
145
|
+
if (y.length === 0) return;
|
|
141
146
|
let t = typeof e == "string" ? e : e.href;
|
|
142
|
-
if (
|
|
147
|
+
if (b === t) return x;
|
|
143
148
|
let n = new URL(t, "http://dummy.com"), r;
|
|
144
|
-
for (let e of
|
|
149
|
+
for (let e of y) if (new h(e.match, n.href).exec(n.href)) {
|
|
145
150
|
r = e;
|
|
146
151
|
break;
|
|
147
152
|
}
|
|
148
|
-
return
|
|
153
|
+
return b = t, x = r, r;
|
|
149
154
|
}
|
|
150
|
-
function
|
|
151
|
-
let t =
|
|
152
|
-
return t && t.exclude !== !0 && Array.isArray(t.strategy) ? t.strategy :
|
|
155
|
+
function C(e) {
|
|
156
|
+
let t = S(e);
|
|
157
|
+
return t && t.exclude !== !0 && Array.isArray(t.strategy) ? t.strategy : v;
|
|
153
158
|
}
|
|
154
|
-
var C = void 0;
|
|
155
159
|
globalThis.__paraglide = globalThis.__paraglide ?? {}, globalThis.__paraglide.ssr = globalThis.__paraglide.ssr ?? {};
|
|
156
160
|
var w = !1, T = () => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (e) return e;
|
|
160
|
-
}
|
|
161
|
-
let e = _;
|
|
162
|
-
typeof window < "u" && window.location?.href && (e = S(window.location.href));
|
|
161
|
+
let e = v;
|
|
162
|
+
typeof window < "u" && window.location?.href && (e = C(window.location.href));
|
|
163
163
|
let t = E(e, typeof window < "u" ? window.location?.href : void 0);
|
|
164
164
|
if (t) return w || (w = !0, k(t, { reload: !1 })), t;
|
|
165
|
-
throw Error("No locale found. Read the docs https://
|
|
165
|
+
throw Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
166
166
|
};
|
|
167
167
|
function E(e, t) {
|
|
168
168
|
let n;
|
|
169
169
|
for (let t of e) {
|
|
170
170
|
if (t === "baseLocale") n = "en";
|
|
171
|
-
else if (
|
|
172
|
-
let e =
|
|
171
|
+
else if (P(t) && N.has(t)) {
|
|
172
|
+
let e = N.get(t);
|
|
173
173
|
if (e) {
|
|
174
174
|
let t = e.getLocale();
|
|
175
175
|
if (t instanceof Promise) continue;
|
|
@@ -192,11 +192,11 @@ var D = (e) => {
|
|
|
192
192
|
try {
|
|
193
193
|
r = T();
|
|
194
194
|
} catch {}
|
|
195
|
-
let i = [], a =
|
|
196
|
-
typeof window < "u" && window.location?.href && (a =
|
|
195
|
+
let i = [], a = v;
|
|
196
|
+
typeof window < "u" && window.location?.href && (a = C(window.location.href));
|
|
197
197
|
for (let t of a) if (t === "baseLocale") continue;
|
|
198
|
-
else if (
|
|
199
|
-
let n =
|
|
198
|
+
else if (P(t) && N.has(t)) {
|
|
199
|
+
let n = N.get(t);
|
|
200
200
|
if (n) {
|
|
201
201
|
let r = n.setLocale(e);
|
|
202
202
|
r instanceof Promise && (r = r.catch((e) => {
|
|
@@ -222,19 +222,21 @@ function j(e) {
|
|
|
222
222
|
if (t) return t;
|
|
223
223
|
throw Error(`Invalid locale: ${e}. Expected one of: ${g.join(", ")}`);
|
|
224
224
|
}
|
|
225
|
-
var M =
|
|
226
|
-
|
|
225
|
+
var M = _.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
226
|
+
RegExp(`(?:^|;\\s*)${M}=([^;]*)`);
|
|
227
|
+
var N = /* @__PURE__ */ new Map();
|
|
228
|
+
function P(e) {
|
|
227
229
|
return typeof e == "string" && /^custom-[A-Za-z0-9_-]+$/.test(e);
|
|
228
230
|
}
|
|
229
231
|
//#endregion
|
|
230
232
|
//#region src/paraglide/messages/dialog_end_title.js
|
|
231
|
-
var
|
|
233
|
+
var F = () => "End Chat", I = () => "إنهاء المحادثة", L = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? F(e) : I(e)), R = () => "Are you sure you want to end this chat?", z = () => "هل أنت متأكد أنك تريد إنهاء هذه المحادثة؟", B = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? R(e) : z(e)), V = () => "End Chat", H = () => "إنهاء المحادثة", U = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? V(e) : H(e)), W = () => "Cancel", G = () => "إلغاء", re = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? W(e) : G(e)), K = () => "Leave Chat", q = () => "مغادرة المحادثة", J = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? K(e) : q(e)), Y = () => "If you leave now, your chat will end. Are you sure you want to leave?", X = () => "إذا غادرت الآن، ستنتهي محادثتك. هل أنت متأكد أنك تريد المغادرة؟", ie = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? Y(e) : X(e)), ae = () => "Leave", oe = () => "مغادرة", se = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? ae(e) : oe(e)), ce = () => "Stay", le = () => "البقاء", ue = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? ce(e) : le(e)), de = () => "Close", fe = () => "إغلاق", pe = ((e = {}, t = {}) => (t.locale ?? T()) === "en" ? de(e) : fe(e)), me = new Set(g), Z = "en";
|
|
232
234
|
D(() => Z);
|
|
233
|
-
function
|
|
235
|
+
function Q() {
|
|
234
236
|
return Z;
|
|
235
237
|
}
|
|
236
|
-
function
|
|
237
|
-
Z = e &&
|
|
238
|
+
function $(e) {
|
|
239
|
+
Z = e && me.has(e) ? e : "en";
|
|
238
240
|
}
|
|
239
241
|
function he(e) {
|
|
240
242
|
return e === "ar" ? "rtl" : "ltr";
|
|
@@ -242,24 +244,24 @@ function he(e) {
|
|
|
242
244
|
//#endregion
|
|
243
245
|
//#region src/ZiilaWidget.ts
|
|
244
246
|
function ge(e) {
|
|
245
|
-
let t = he(
|
|
247
|
+
let t = he(Q()), n = pe();
|
|
246
248
|
return e === "endChat" ? {
|
|
247
|
-
title:
|
|
248
|
-
message:
|
|
249
|
-
confirmLabel:
|
|
250
|
-
cancelLabel:
|
|
249
|
+
title: L(),
|
|
250
|
+
message: B(),
|
|
251
|
+
confirmLabel: U(),
|
|
252
|
+
cancelLabel: re(),
|
|
251
253
|
closeLabel: n,
|
|
252
254
|
dir: t
|
|
253
255
|
} : {
|
|
254
|
-
title:
|
|
255
|
-
message:
|
|
256
|
-
confirmLabel:
|
|
257
|
-
cancelLabel:
|
|
256
|
+
title: J(),
|
|
257
|
+
message: ie(),
|
|
258
|
+
confirmLabel: se(),
|
|
259
|
+
cancelLabel: ue(),
|
|
258
260
|
closeLabel: n,
|
|
259
261
|
dir: t
|
|
260
262
|
};
|
|
261
263
|
}
|
|
262
|
-
var
|
|
264
|
+
var _e = class {
|
|
263
265
|
get isDirty() {
|
|
264
266
|
return this._isDirty;
|
|
265
267
|
}
|
|
@@ -269,7 +271,7 @@ var $ = class {
|
|
|
269
271
|
}, this.handleMessage = (e) => {
|
|
270
272
|
let t = e.data;
|
|
271
273
|
t.type === "READY" ? this.bus.emit("ready") : t.type === "EVENT" ? this.bus.emit(t.event, t.payload) : t.type === "DIRTY_STATE" ? this._isDirty = t.isDirty : t.type === "CONFIRM_REQUEST" && this.handleConfirmRequest(t.kind);
|
|
272
|
-
}, this.config = e,
|
|
274
|
+
}, this.config = e, $(e.locale);
|
|
273
275
|
}
|
|
274
276
|
mount() {
|
|
275
277
|
if (this.bridge) return;
|
|
@@ -313,7 +315,7 @@ var $ = class {
|
|
|
313
315
|
this.config = {
|
|
314
316
|
...this.config,
|
|
315
317
|
...e
|
|
316
|
-
}, e.locale !== void 0 &&
|
|
318
|
+
}, e.locale !== void 0 && $(e.locale), this.bridge?.send({
|
|
317
319
|
type: "UPDATE",
|
|
318
320
|
payload: e
|
|
319
321
|
});
|
|
@@ -324,8 +326,8 @@ var $ = class {
|
|
|
324
326
|
};
|
|
325
327
|
//#endregion
|
|
326
328
|
//#region src/utils.ts
|
|
327
|
-
function
|
|
329
|
+
function ve(e) {
|
|
328
330
|
return typeof e == "object" && !!e && typeof e.code == "string" && typeof e.message == "string";
|
|
329
331
|
}
|
|
330
332
|
//#endregion
|
|
331
|
-
export {
|
|
333
|
+
export { _e as ZiilaWidget, ve as isZiilaError };
|
|
@@ -14,6 +14,6 @@ export declare class ZiilaWidget {
|
|
|
14
14
|
on<K extends ZiilaEvent>(event: K, handler: (data: EventPayloadMap[K]) => void): () => void;
|
|
15
15
|
off<K extends ZiilaEvent>(event: K, handler: (data: EventPayloadMap[K]) => void): void;
|
|
16
16
|
emit<K extends ZiilaCommand>(command: K, payload?: CommandPayloadMap[K]): void;
|
|
17
|
-
update(updates: Partial<Pick<ZiilaConfig, 'locale'>>): void;
|
|
17
|
+
update(updates: Partial<Pick<ZiilaConfig, 'locale' | 'theme' | 'cartId'>>): void;
|
|
18
18
|
destroy(): void;
|
|
19
19
|
}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -5,30 +5,70 @@ export interface ThemeTokens {
|
|
|
5
5
|
foregroundColor?: string;
|
|
6
6
|
borderColor?: string;
|
|
7
7
|
borderRadius?: string;
|
|
8
|
+
buttonRadius?: string;
|
|
8
9
|
fontFamily?: string;
|
|
10
|
+
buttonFontWeight?: string;
|
|
9
11
|
mutedColor?: string;
|
|
10
12
|
mutedFg?: string;
|
|
11
13
|
}
|
|
12
|
-
export type ThemeElement = 'button' | '
|
|
13
|
-
export type
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
export type ThemeElement = 'button' | 'input';
|
|
15
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'link' | 'destructive' | 'success' | 'warning';
|
|
16
|
+
export type ButtonSize = 'default' | 'xs' | 'sm' | 'lg' | 'icon' | 'icon-sm' | 'icon-lg';
|
|
17
|
+
export interface ButtonVariantStyle {
|
|
18
|
+
background?: string;
|
|
19
|
+
foreground?: string;
|
|
20
|
+
hoverBackground?: string;
|
|
21
|
+
hoverForeground?: string;
|
|
22
|
+
activeBackground?: string;
|
|
23
|
+
activeForeground?: string;
|
|
24
|
+
disabledBackground?: string;
|
|
25
|
+
disabledForeground?: string;
|
|
26
|
+
iconColor?: string;
|
|
27
|
+
border?: string;
|
|
28
|
+
borderWidth?: string;
|
|
29
|
+
borderStyle?: 'solid' | 'dashed' | 'dotted';
|
|
30
|
+
shadow?: string;
|
|
31
|
+
hoverShadow?: string;
|
|
32
|
+
ringColor?: string;
|
|
33
|
+
underlineOffset?: string;
|
|
34
|
+
hoverTextDecoration?: 'none' | 'underline';
|
|
35
|
+
}
|
|
36
|
+
export interface ButtonSizeStyle {
|
|
37
|
+
height?: string;
|
|
38
|
+
width?: string;
|
|
39
|
+
paddingX?: string;
|
|
40
|
+
paddingY?: string;
|
|
41
|
+
gap?: string;
|
|
42
|
+
fontSize?: string;
|
|
43
|
+
minWidth?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ButtonElementStyle {
|
|
46
|
+
variant?: Partial<Record<ButtonVariant, ButtonVariantStyle>>;
|
|
47
|
+
size?: Partial<Record<ButtonSize, ButtonSizeStyle>>;
|
|
48
|
+
}
|
|
49
|
+
export interface InputElementStyle {
|
|
50
|
+
background?: string;
|
|
51
|
+
foreground?: string;
|
|
52
|
+
border?: string;
|
|
53
|
+
borderWidth?: string;
|
|
54
|
+
paddingX?: string;
|
|
55
|
+
paddingY?: string;
|
|
56
|
+
shadow?: string;
|
|
57
|
+
focusBorder?: string;
|
|
58
|
+
ringColor?: string;
|
|
25
59
|
}
|
|
26
60
|
export interface ThemeStyles {
|
|
27
61
|
tokens?: Partial<ThemeTokens>;
|
|
28
|
-
elements?:
|
|
62
|
+
elements?: {
|
|
63
|
+
button?: ButtonElementStyle;
|
|
64
|
+
input?: InputElementStyle;
|
|
65
|
+
};
|
|
29
66
|
}
|
|
30
67
|
export interface ZiilaConfig {
|
|
31
68
|
apiKey: string;
|
|
69
|
+
agentId: string;
|
|
70
|
+
/** Merchant cart id — required; all cart mutations target this cart. */
|
|
71
|
+
cartId: string;
|
|
32
72
|
container: string | HTMLElement;
|
|
33
73
|
locale?: string;
|
|
34
74
|
widgetTitle?: string;
|
|
@@ -36,8 +76,24 @@ export interface ZiilaConfig {
|
|
|
36
76
|
widgetUrl?: string;
|
|
37
77
|
}
|
|
38
78
|
export interface AddToCartPayload {
|
|
79
|
+
sku: string;
|
|
80
|
+
/** The sku's new total quantity in the cart — never a delta. */
|
|
81
|
+
quantity: number;
|
|
82
|
+
}
|
|
83
|
+
export interface RemoveFromCartPayload {
|
|
84
|
+
sku: string;
|
|
85
|
+
/** The sku's new total quantity; 0 means fully removed. */
|
|
86
|
+
quantity: number;
|
|
87
|
+
}
|
|
88
|
+
export interface CartUpdatedItem {
|
|
39
89
|
sku: string;
|
|
40
90
|
quantity: number;
|
|
91
|
+
price: number;
|
|
92
|
+
}
|
|
93
|
+
export interface CartUpdatedPayload {
|
|
94
|
+
items: CartUpdatedItem[];
|
|
95
|
+
totalItems: number;
|
|
96
|
+
grandTotal: number;
|
|
41
97
|
}
|
|
42
98
|
export interface ProductViewedPayload {
|
|
43
99
|
sku: string;
|
|
@@ -49,11 +105,13 @@ export interface ErrorPayload {
|
|
|
49
105
|
code: string;
|
|
50
106
|
message: string;
|
|
51
107
|
}
|
|
52
|
-
export type ZiilaEvent = 'ready' | 'addToCart' | 'productViewed' | 'search' | 'error';
|
|
108
|
+
export type ZiilaEvent = 'ready' | 'addToCart' | 'removeFromCart' | 'cartUpdated' | 'productViewed' | 'search' | 'error';
|
|
53
109
|
export type ZiilaCommand = 'clear';
|
|
54
110
|
export interface EventPayloadMap {
|
|
55
111
|
ready: undefined;
|
|
56
112
|
addToCart: AddToCartPayload;
|
|
113
|
+
removeFromCart: RemoveFromCartPayload;
|
|
114
|
+
cartUpdated: CartUpdatedPayload;
|
|
57
115
|
productViewed: ProductViewedPayload;
|
|
58
116
|
search: SearchPayload;
|
|
59
117
|
error: ErrorPayload;
|
|
@@ -77,7 +135,7 @@ export type ParentMessage = {
|
|
|
77
135
|
payload?: unknown;
|
|
78
136
|
} | {
|
|
79
137
|
type: 'UPDATE';
|
|
80
|
-
payload: Partial<Pick<ZiilaConfig, 'locale'>>;
|
|
138
|
+
payload: Partial<Pick<ZiilaConfig, 'locale' | 'theme' | 'cartId'>>;
|
|
81
139
|
} | {
|
|
82
140
|
type: 'THEME_UPDATE';
|
|
83
141
|
payload: Partial<ThemeTokens>;
|
package/dist/widget.iife.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e=class{constructor(e,t){this.iframe=null,this.port=null,this.handleHandshake=e=>{let t=this.iframe?.contentWindow;if(!t||e.source!==t||e.origin!==new URL(this.url).origin)return;let n=e.data;if(typeof n!=`object`||!n||n.type!==`HANDSHAKE`)return;let r=new MessageChannel;t.postMessage({type:`HANDSHAKE_ACK`},new URL(this.url).origin,[r.port2]),this.port=r.port1,this.port.start(),window.removeEventListener(`message`,this.handleHandshake),this.onPortReady(r.port1)},this.onPortReady=e,this.url=t??`https://widget.ziila.com`}mount(e){this.iframe=document.createElement(`iframe`),this.iframe.src=this.url,this.iframe.title=`Ziila Shopping Assistant`,this.iframe.style.cssText=`width:100%;height:100%;border:none;`,e.appendChild(this.iframe),window.addEventListener(`message`,this.handleHandshake)}send(e){this.port?.postMessage(e)}destroy(){window.removeEventListener(`message`,this.handleHandshake),this.port?.close(),this.iframe?.remove(),this.iframe=null,this.port=null}},t=class{constructor(){this.handlers=new Map}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){this.handlers.get(e)?.forEach(e=>e(t))}destroy(){this.handlers.clear()}},n=`position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.4);padding:24px;font-family:system-ui,-apple-system,sans-serif;`,r=`width:100%;max-width:24rem;border-radius:12px;background:#fff;padding:16px;box-shadow:2px 4px 2px rgba(0,0,0,0.1);display:flex;flex-direction:column;gap:16px;`,i=`display:flex;justify-content:flex-end;`,a=`border:none;background:#f0f0f0;border-radius:12px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;color:#555;line-height:1;padding:0;`,o=`display:flex;flex-direction:column;gap:16px;align-items:center;`,ee=`margin:0;font-size:24px;font-weight:700;color:#195f6b;text-align:center;`,s=`margin:0;font-size:16px;color:#2d2d2d;font-weight:500;line-height:27px;text-align:center;max-width:345px;`,c=`display:flex;gap:16px;padding:0 16px;width:100%;box-sizing:border-box;`,te=`flex:1;border:1px solid #195f6b;border-radius:8px;background:#fff;color:#195f6b;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,ne=`flex:1;border:none;border-radius:8px;background:#cc0000;color:#fff;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,l=class{constructor(){this.overlay=null,this.pendingResolve=null,this.previousFocus=null}show(e){return this.pendingResolve?.(!1),this.pendingResolve=null,this.close(),new Promise(t=>{this.pendingResolve=t;let l=e=>{this.pendingResolve=null,this.close(),t(e)},u=document.createElement(`div`);u.style.cssText=n;let d=document.createElement(`div`);d.setAttribute(`role`,`dialog`),d.setAttribute(`aria-modal`,`true`),d.setAttribute(`aria-labelledby`,`ziila-confirm-title`),d.style.cssText=r,d.dir=e.dir;let f=document.createElement(`div`);f.style.cssText=i;let p=document.createElement(`button`);p.type=`button`,p.setAttribute(`aria-label`,e.closeLabel),p.textContent=`✕`,p.style.cssText=a,p.addEventListener(`click`,()=>l(!1)),f.appendChild(p);let m=document.createElement(`div`);m.style.cssText=o;let h=document.createElement(`h2`);h.id=`ziila-confirm-title`,h.textContent=e.title,h.style.cssText=ee;let g=document.createElement(`p`);g.textContent=e.message,g.style.cssText=s;let _=document.createElement(`button`);_.type=`button`,_.textContent=e.cancelLabel,_.style.cssText=te,_.addEventListener(`click`,()=>l(!1));let v=document.createElement(`button`);v.type=`button`,v.textContent=e.confirmLabel,v.style.cssText=ne,v.addEventListener(`click`,()=>l(!0));let y=document.createElement(`div`);y.style.cssText=c,y.append(_,v),m.append(h,g,y),d.append(f,m),u.appendChild(d);let b=[p,_,v];u.addEventListener(`keydown`,e=>{if(e.key===`Escape`){l(!1);return}e.key===`Tab`&&(e.preventDefault(),b[(b.indexOf(document.activeElement)+(e.shiftKey?-1:1)+b.length)%b.length].focus())}),this.previousFocus=document.activeElement,this.overlay=u,document.body.appendChild(u),_.focus()})}close(){this.overlay?.remove(),this.overlay=null,this.previousFocus?.focus(),this.previousFocus=null}},u={primaryColor:[`--primary`,`--primary-color`,`--color-primary`,`--brand`,`--brand-color`,`--accent-color`,`--bs-primary`,`--mui-palette-primary-main`,`--ant-color-primary`],borderRadius:[`--radius`,`--border-radius`,`--rounded`,`--bs-border-radius`]},d=new Set([``,`transparent`,`inherit`,`initial`,`unset`,`none`,`rgba(0, 0, 0, 0)`,`rgb(0, 0, 0)`,`depends on user agent`]);function f(e){return!!e&&!d.has(e.trim().toLowerCase())}function p(e=document){let t=e.defaultView??globalThis,n=t.getComputedStyle(e.documentElement),r=e.body?t.getComputedStyle(e.body):null,i={};r&&(f(r.fontFamily)&&(i.fontFamily=r.fontFamily),f(r.backgroundColor)&&(i.backgroundColor=r.backgroundColor),f(r.color)&&(i.foregroundColor=r.color));for(let[e,t]of Object.entries(u))for(let r of t){let t=n.getPropertyValue(r).trim();if(f(t)){i[e]=t;break}}return i}function m(e,t={}){let n={...p(t.doc??document),...e?.tokens},r={};return Object.keys(n).length>0&&(r.tokens=n),e?.elements&&Object.keys(e.elements).length>0&&(r.elements=e.elements),r}var h={},g=[`en`,`ar`],_=[`baseLocale`],v=[],y,b;function x(e){if(v.length===0)return;let t=typeof e==`string`?e:e.href;if(y===t)return b;let n=new URL(t,`http://dummy.com`),r;for(let e of v)if(new h(e.match,n.href).exec(n.href)){r=e;break}return y=t,b=r,r}function S(e){let t=x(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:_}var C=void 0;globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var w=!1,T=()=>{if(C){let e=C?.getStore()?.locale;if(e)return e}let e=_;typeof window<`u`&&window.location?.href&&(e=S(window.location.href));let t=re(e,typeof window<`u`?window.location?.href:void 0);if(t)return w||(w=!0,E(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://inlang.com/m/gerre34r/library-inlang-paraglideJs/errors#no-locale-found`)};function re(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(A(t)&&k.has(t)){let e=k.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return O(t)}}let e=D(n);if(e)return e}}var ie=e=>{T=e},ae=e=>{e?window.location.href=e:window.location.reload()},E=(e,t)=>{let n={reload:!0,...t},r;try{r=T()}catch{}let i=[],a=_;typeof window<`u`&&window.location?.href&&(a=S(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(A(t)&&k.has(t)){let n=k.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{n.reload&&window.location&&e!==r&&ae(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function D(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of g)if(e.toLowerCase()===t)return e}function O(e){let t=D(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${g.join(`, `)}`)}var k=new Map;function A(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var j=()=>`End Chat`,M=()=>`إنهاء المحادثة`,N=((e={},t={})=>(t.locale??T())===`en`?j(e):M(e)),P=()=>`Are you sure you want to end this chat?`,F=()=>`هل أنت متأكد أنك تريد إنهاء هذه المحادثة؟`,I=((e={},t={})=>(t.locale??T())===`en`?P(e):F(e)),L=()=>`End Chat`,R=()=>`إنهاء المحادثة`,z=((e={},t={})=>(t.locale??T())===`en`?L(e):R(e)),B=()=>`Cancel`,V=()=>`إلغاء`,H=((e={},t={})=>(t.locale??T())===`en`?B(e):V(e)),U=()=>`Leave Chat`,W=()=>`مغادرة المحادثة`,G=((e={},t={})=>(t.locale??T())===`en`?U(e):W(e)),oe=()=>`If you leave now, your chat will end. Are you sure you want to leave?`,K=()=>`إذا غادرت الآن، ستنتهي محادثتك. هل أنت متأكد أنك تريد المغادرة؟`,q=((e={},t={})=>(t.locale??T())===`en`?oe(e):K(e)),se=()=>`Leave`,ce=()=>`مغادرة`,le=((e={},t={})=>(t.locale??T())===`en`?se(e):ce(e)),ue=()=>`Stay`,de=()=>`البقاء`,fe=((e={},t={})=>(t.locale??T())===`en`?ue(e):de(e)),pe=()=>`Close`,me=()=>`إغلاق`,he=((e={},t={})=>(t.locale??T())===`en`?pe(e):me(e)),ge=new Set(g),J=`en`;ie(()=>J);function _e(){return J}function Y(e){J=e&&ge.has(e)?e:`en`}function ve(e){return e===`ar`?`rtl`:`ltr`}function ye(e){let t=ve(_e()),n=he();return e===`endChat`?{title:N(),message:I(),confirmLabel:z(),cancelLabel:H(),closeLabel:n,dir:t}:{title:G(),message:q(),confirmLabel:le(),cancelLabel:fe(),closeLabel:n,dir:t}}var X=class{get isDirty(){return this._isDirty}constructor(e){this.bridge=null,this.bus=new t,this.confirmDialog=new l,this._isDirty=!1,this.handleBeforeUnload=e=>{this._isDirty&&(e.preventDefault(),e.returnValue=``)},this.handleMessage=e=>{let t=e.data;t.type===`READY`?this.bus.emit(`ready`):t.type===`EVENT`?this.bus.emit(t.event,t.payload):t.type===`DIRTY_STATE`?this._isDirty=t.isDirty:t.type===`CONFIRM_REQUEST`&&this.handleConfirmRequest(t.kind)},this.config=e,Y(e.locale)}mount(){if(this.bridge)return;let t=typeof this.config.container==`string`?document.querySelector(this.config.container):this.config.container;if(!t)throw Error(`Ziila: container not found: ${this.config.container}`);this.bridge=new e(e=>{e.onmessage=this.handleMessage;let{container:t,...n}=this.config,r=m(this.config.theme);this.bridge?.send({type:`INIT`,payload:{...n,theme:r}})},this.config.widgetUrl),this.bridge.mount(t),window.addEventListener(`beforeunload`,this.handleBeforeUnload)}handleConfirmRequest(e){this.confirmDialog.show(ye(e)).then(t=>{this.bridge?.send({type:`CONFIRM_RESULT`,kind:e,confirmed:t})})}on(e,t){return this.bus.on(e,t)}off(e,t){this.bus.off(e,t)}emit(e,t){this.bridge?.send({type:`COMMAND`,command:e,payload:t})}update(e){this.config={...this.config,...e},e.locale!==void 0&&Y(e.locale),this.bridge?.send({type:`UPDATE`,payload:e})}destroy(){window.removeEventListener(`beforeunload`,this.handleBeforeUnload),this.confirmDialog.close(),this.bridge?.destroy(),this.bus.destroy(),this.bridge=null}},Z=null,be=window.Ziila?.q??[];function Q(e){Z?.destroy(),Z=new X(e),Z.mount()}var $=function(e){Q(e)};$.on=function(e,t){if(!Z)throw Error(`Ziila: call Ziila(config) before Ziila.on()`);return Z.on(e,t)},$.off=function(e,t){Z?.off(e,t)},$.emit=function(e,t){Z?.emit(e,t)},$.update=function(e){Z?.update(e)},$.mount=function(){Z?.mount()},$.destroy=function(){Z?.destroy(),Z=null},Object.defineProperty($,"isDirty",{get:()=>Z?.isDirty??!1,enumerable:!0,configurable:!1}),window.Ziila=$,be.forEach(Q)})();
|
|
1
|
+
(function(){var e=class{constructor(e,t){this.iframe=null,this.port=null,this.handleHandshake=e=>{let t=this.iframe?.contentWindow;if(!t||e.source!==t||e.origin!==new URL(this.url).origin)return;let n=e.data;if(typeof n!=`object`||!n||n.type!==`HANDSHAKE`)return;let r=new MessageChannel;t.postMessage({type:`HANDSHAKE_ACK`},new URL(this.url).origin,[r.port2]),this.port=r.port1,this.port.start(),window.removeEventListener(`message`,this.handleHandshake),this.onPortReady(r.port1)},this.onPortReady=e,this.url=t??`https://widget.ziila.com`}mount(e){let t=new URL(this.url);t.searchParams.set(`embedded`,`1`),this.iframe=document.createElement(`iframe`),this.iframe.src=t.toString(),this.iframe.title=`Ziila Shopping Assistant`,this.iframe.style.cssText=`width:100%;height:100%;border:none;`,e.appendChild(this.iframe),window.addEventListener(`message`,this.handleHandshake)}send(e){this.port?.postMessage(e)}destroy(){window.removeEventListener(`message`,this.handleHandshake),this.port?.close(),this.iframe?.remove(),this.iframe=null,this.port=null}},t=class{constructor(){this.handlers=new Map}on(e,t){return this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){this.handlers.get(e)?.delete(t)}emit(e,t){this.handlers.get(e)?.forEach(e=>e(t))}destroy(){this.handlers.clear()}},n=`position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,0.4);padding:24px;font-family:system-ui,-apple-system,sans-serif;`,r=`width:100%;max-width:24rem;border-radius:12px;background:#fff;padding:16px;box-shadow:2px 4px 2px rgba(0,0,0,0.1);display:flex;flex-direction:column;gap:16px;`,i=`display:flex;justify-content:flex-end;`,a=`border:none;background:#f0f0f0;border-radius:12px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:14px;color:#555;line-height:1;padding:0;`,o=`display:flex;flex-direction:column;gap:16px;align-items:center;`,ee=`margin:0;font-size:24px;font-weight:700;color:#195f6b;text-align:center;`,s=`margin:0;font-size:16px;color:#2d2d2d;font-weight:500;line-height:27px;text-align:center;max-width:345px;`,c=`display:flex;gap:16px;padding:0 16px;width:100%;box-sizing:border-box;`,te=`flex:1;border:1px solid #195f6b;border-radius:8px;background:#fff;color:#195f6b;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,ne=`flex:1;border:none;border-radius:8px;background:#cc0000;color:#fff;padding:16px;font-size:16px;font-weight:500;cursor:pointer;`,l=class{constructor(){this.overlay=null,this.pendingResolve=null,this.previousFocus=null}show(e){return this.pendingResolve?.(!1),this.pendingResolve=null,this.close(),new Promise(t=>{this.pendingResolve=t;let l=e=>{this.pendingResolve=null,this.close(),t(e)},u=document.createElement(`div`);u.style.cssText=n;let d=document.createElement(`div`);d.setAttribute(`role`,`dialog`),d.setAttribute(`aria-modal`,`true`),d.setAttribute(`aria-labelledby`,`ziila-confirm-title`),d.style.cssText=r,d.dir=e.dir;let f=document.createElement(`div`);f.style.cssText=i;let p=document.createElement(`button`);p.type=`button`,p.setAttribute(`aria-label`,e.closeLabel),p.textContent=`✕`,p.style.cssText=a,p.addEventListener(`click`,()=>l(!1)),f.appendChild(p);let m=document.createElement(`div`);m.style.cssText=o;let h=document.createElement(`h2`);h.id=`ziila-confirm-title`,h.textContent=e.title,h.style.cssText=ee;let g=document.createElement(`p`);g.textContent=e.message,g.style.cssText=s;let _=document.createElement(`button`);_.type=`button`,_.textContent=e.cancelLabel,_.style.cssText=te,_.addEventListener(`click`,()=>l(!1));let v=document.createElement(`button`);v.type=`button`,v.textContent=e.confirmLabel,v.style.cssText=ne,v.addEventListener(`click`,()=>l(!0));let y=document.createElement(`div`);y.style.cssText=c,y.append(_,v),m.append(h,g,y),d.append(f,m),u.appendChild(d);let b=[p,_,v];u.addEventListener(`keydown`,e=>{if(e.key===`Escape`){l(!1);return}if(e.key===`Tab`){e.preventDefault();let t=(b.indexOf(document.activeElement)+(e.shiftKey?-1:1)+b.length)%b.length;b[t].focus()}}),this.previousFocus=document.activeElement,this.overlay=u,document.body.appendChild(u),_.focus()})}close(){this.overlay?.remove(),this.overlay=null,this.previousFocus?.focus(),this.previousFocus=null}},u={primaryColor:[`--primary`,`--primary-color`,`--color-primary`,`--brand`,`--brand-color`,`--accent-color`,`--bs-primary`,`--mui-palette-primary-main`,`--ant-color-primary`],borderRadius:[`--radius`,`--border-radius`,`--rounded`,`--bs-border-radius`]},d=new Set([``,`transparent`,`inherit`,`initial`,`unset`,`none`,`rgba(0, 0, 0, 0)`,`rgb(0, 0, 0)`,`depends on user agent`]);function f(e){return!!e&&!d.has(e.trim().toLowerCase())}function p(e=document){let t=e.defaultView??globalThis,n=t.getComputedStyle(e.documentElement),r=e.body?t.getComputedStyle(e.body):null,i={};r&&(f(r.fontFamily)&&(i.fontFamily=r.fontFamily),f(r.backgroundColor)&&(i.backgroundColor=r.backgroundColor),f(r.color)&&(i.foregroundColor=r.color));for(let[e,t]of Object.entries(u))for(let r of t){let t=n.getPropertyValue(r).trim();if(f(t)){i[e]=t;break}}return i}function m(e,t={}){let n={...p(t.doc??document),...e?.tokens},r={};return Object.keys(n).length>0&&(r.tokens=n),e?.elements&&Object.keys(e.elements).length>0&&(r.elements=e.elements),r}var h={},g=[`en`,`ar`],_=`PARAGLIDE_LOCALE`,v=[`baseLocale`],y=[],b,x;function S(e){if(y.length===0)return;let t=typeof e==`string`?e:e.href;if(b===t)return x;let n=new URL(t,`http://dummy.com`),r;for(let e of y)if(new h(e.match,n.href).exec(n.href)){r=e;break}return b=t,x=r,r}function C(e){let t=S(e);return t&&t.exclude!==!0&&Array.isArray(t.strategy)?t.strategy:v}globalThis.__paraglide=globalThis.__paraglide??{},globalThis.__paraglide.ssr=globalThis.__paraglide.ssr??{};var w=!1,T=()=>{let e=v;typeof window<`u`&&window.location?.href&&(e=C(window.location.href));let t=re(e,typeof window<`u`?window.location?.href:void 0);if(t)return w||(w=!0,oe(t,{reload:!1})),t;throw Error(`No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found`)};function re(e,t){let n;for(let t of e){if(t===`baseLocale`)n=`en`;else if(A(t)&&k.has(t)){let e=k.get(t);if(e){let t=e.getLocale();if(t instanceof Promise)continue;if(t!==void 0)return D(t)}}let e=E(n);if(e)return e}}var ie=e=>{T=e},ae=e=>{e?window.location.href=e:window.location.reload()},oe=(e,t)=>{let n={reload:!0,...t},r;try{r=T()}catch{}let i=[],a=v;typeof window<`u`&&window.location?.href&&(a=C(window.location.href));for(let t of a)if(t===`baseLocale`)continue;else if(A(t)&&k.has(t)){let n=k.get(t);if(n){let r=n.setLocale(e);r instanceof Promise&&(r=r.catch(e=>{throw Error(`Custom strategy "${t}" setLocale failed.`,{cause:e})}),i.push(r))}}let o=()=>{n.reload&&window.location&&e!==r&&ae(void 0)};if(i.length)return Promise.all(i).then(()=>{o()});o()};function E(e){if(typeof e!=`string`)return;let t=e.toLowerCase();for(let e of g)if(e.toLowerCase()===t)return e}function D(e){let t=E(e);if(t)return t;throw Error(`Invalid locale: ${e}. Expected one of: ${g.join(`, `)}`)}var O=_.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);RegExp(`(?:^|;\\s*)${O}=([^;]*)`);var k=new Map;function A(e){return typeof e==`string`&&/^custom-[A-Za-z0-9_-]+$/.test(e)}var j=()=>`End Chat`,M=()=>`إنهاء المحادثة`,N=((e={},t={})=>(t.locale??T())===`en`?j(e):M(e)),P=()=>`Are you sure you want to end this chat?`,F=()=>`هل أنت متأكد أنك تريد إنهاء هذه المحادثة؟`,I=((e={},t={})=>(t.locale??T())===`en`?P(e):F(e)),L=()=>`End Chat`,R=()=>`إنهاء المحادثة`,z=((e={},t={})=>(t.locale??T())===`en`?L(e):R(e)),B=()=>`Cancel`,V=()=>`إلغاء`,H=((e={},t={})=>(t.locale??T())===`en`?B(e):V(e)),U=()=>`Leave Chat`,W=()=>`مغادرة المحادثة`,G=((e={},t={})=>(t.locale??T())===`en`?U(e):W(e)),se=()=>`If you leave now, your chat will end. Are you sure you want to leave?`,K=()=>`إذا غادرت الآن، ستنتهي محادثتك. هل أنت متأكد أنك تريد المغادرة؟`,ce=((e={},t={})=>(t.locale??T())===`en`?se(e):K(e)),le=()=>`Leave`,ue=()=>`مغادرة`,de=((e={},t={})=>(t.locale??T())===`en`?le(e):ue(e)),fe=()=>`Stay`,pe=()=>`البقاء`,me=((e={},t={})=>(t.locale??T())===`en`?fe(e):pe(e)),he=()=>`Close`,ge=()=>`إغلاق`,_e=((e={},t={})=>(t.locale??T())===`en`?he(e):ge(e)),ve=new Set(g),q=`en`;ie(()=>q);function J(){return q}function Y(e){q=e&&ve.has(e)?e:`en`}function ye(e){return e===`ar`?`rtl`:`ltr`}function be(e){let t=ye(J()),n=_e();return e===`endChat`?{title:N(),message:I(),confirmLabel:z(),cancelLabel:H(),closeLabel:n,dir:t}:{title:G(),message:ce(),confirmLabel:de(),cancelLabel:me(),closeLabel:n,dir:t}}var xe=class{get isDirty(){return this._isDirty}constructor(e){this.bridge=null,this.bus=new t,this.confirmDialog=new l,this._isDirty=!1,this.handleBeforeUnload=e=>{this._isDirty&&(e.preventDefault(),e.returnValue=``)},this.handleMessage=e=>{let t=e.data;t.type===`READY`?this.bus.emit(`ready`):t.type===`EVENT`?this.bus.emit(t.event,t.payload):t.type===`DIRTY_STATE`?this._isDirty=t.isDirty:t.type===`CONFIRM_REQUEST`&&this.handleConfirmRequest(t.kind)},this.config=e,Y(e.locale)}mount(){if(this.bridge)return;let t=typeof this.config.container==`string`?document.querySelector(this.config.container):this.config.container;if(!t)throw Error(`Ziila: container not found: ${this.config.container}`);this.bridge=new e(e=>{e.onmessage=this.handleMessage;let{container:t,...n}=this.config,r=m(this.config.theme);this.bridge?.send({type:`INIT`,payload:{...n,theme:r}})},this.config.widgetUrl),this.bridge.mount(t),window.addEventListener(`beforeunload`,this.handleBeforeUnload)}handleConfirmRequest(e){this.confirmDialog.show(be(e)).then(t=>{this.bridge?.send({type:`CONFIRM_RESULT`,kind:e,confirmed:t})})}on(e,t){return this.bus.on(e,t)}off(e,t){this.bus.off(e,t)}emit(e,t){this.bridge?.send({type:`COMMAND`,command:e,payload:t})}update(e){this.config={...this.config,...e},e.locale!==void 0&&Y(e.locale),this.bridge?.send({type:`UPDATE`,payload:e})}destroy(){window.removeEventListener(`beforeunload`,this.handleBeforeUnload),this.confirmDialog.close(),this.bridge?.destroy(),this.bus.destroy(),this.bridge=null}},X=null,Se=window.Ziila?.q??[],Z=document.currentScript,Ce=Z instanceof HTMLScriptElement&&Z.src?new URL(`..`,Z.src).toString():void 0;function Q(e){X?.destroy(),X=new xe(e.widgetUrl?e:{...e,widgetUrl:Ce}),X.mount()}var $=function(e){Q(e)};$.on=function(e,t){if(!X)throw Error(`Ziila: call Ziila(config) before Ziila.on()`);return X.on(e,t)},$.off=function(e,t){X?.off(e,t)},$.emit=function(e,t){X?.emit(e,t)},$.update=function(e){X?.update(e)},$.mount=function(){X?.mount()},$.destroy=function(){X?.destroy(),X=null},Object.defineProperty($,"isDirty",{get:()=>X?.isDirty??!1,enumerable:!0,configurable:!1}),window.Ziila=$,Se.forEach(Q)})();
|