mfm-widget-newer 14.5.1 → 14.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{g as it,r as Be,j as Ue,c as Ze,G as ot,a as rt,F as nt}from"./widget-B8TRg0gv.js";var Ke={exports:{}};/*!
1
+ import{g as it,r as Be,j as Ue,c as Ze,G as ot,a as rt,F as nt}from"./widget-DorTwZXr.js";var Ke={exports:{}};/*!
2
2
  * jsoneditor.js
3
3
  *
4
4
  * @brief
@@ -224,7 +224,7 @@ Ended at ${s}
224
224
  Duration ${u}ms`}function Wm(n){if(n==null||n==="")return null;if(typeof n=="number")return Number.isFinite(n)?n:null;if(typeof n!="string")return null;const i=Number(n);if(Number.isFinite(i)&&/^\d+$/.test(n))return i;const a=Date.parse(n);return Number.isFinite(a)?a:null}function jm(n,i){const a=new Date(n),s=String(a.getHours()).padStart(2,"0"),u=String(a.getMinutes()).padStart(2,"0"),f=String(a.getSeconds()).padStart(2,"0"),g=String(a.getMilliseconds()).padStart(3,"0");return i.replace(/mmm|HH|MM|SS/g,x=>x==="mmm"?g:x==="HH"?s:x==="MM"?u:x==="SS"?f:x)}function Zw(n){if(!Number.isFinite(n)||n<0)return"\u2014";if(n<1e3)return`${Math.round(n)}ms`;if(n<6e4)return`${(n/1e3).toFixed(1)}s`;const i=Math.floor(n/6e4),a=Math.round(n%6e4/1e3);return`${i}m${a}s`}function Qw({body:n,sizeBytes:i,downloadName:a="response.json"}){const s=Y(),[u,f]=m.useState("placeholder"),g=tS(n),x=5*1024*1024,y=()=>{try{const h=new Blob([g],{type:"application/json"}),w=URL.createObjectURL(h),S=document.createElement("a");S.href=w,S.download=a,S.click(),setTimeout(()=>URL.revokeObjectURL(w),1e3)}catch{}};return u==="text"?C("div",{children:[d(Km,{sizeBytes:i,onDownload:y}),d("textarea",{readOnly:!0,value:g,spellCheck:!1,css:b("width:100%;min-height:320px;font-family:",s.typography.fontFamilyMono,";font-size:",s.typography.fontSizeBase,";color:",s.color.text,";background:",s.color.bg,";border:1px solid ",s.color.border,";border-radius:",s.radius.md,";padding:",s.spacing.md,";outline:none;resize:vertical;white-space:pre;overscroll-behavior:contain;&:focus{border-color:",s.color.primary,";}","")})]}):u==="json"?C("div",{children:[d(Km,{sizeBytes:i,onDownload:y}),d(ko,{value:n})]}):C("div",{role:"status",css:b("border:1px dashed ",s.color.warning,";background:",s.color.surface,";border-radius:",s.radius.md,";padding:",s.spacing.xl,";display:flex;flex-direction:column;gap:",s.spacing.md,";",""),children:[C("div",{children:[C("div",{css:b("font-weight:",s.typography.fontWeightSemibold,";color:",s.color.text,";font-size:",s.typography.fontSizeBase,";",""),children:["Response is ",Ni(i)]}),d("div",{css:b("color:",s.color.textDim,";font-size:",s.typography.fontSizeSm,";margin-top:",s.spacing.xs,";line-height:1.4;",""),children:"Rendering large responses as a JSON tree can freeze the widget. Pick a safer view first; you can still open the tree if you really need it."})]}),C("div",{css:b("display:flex;flex-wrap:wrap;gap:",s.spacing.sm,";",""),children:[d(zu,{primary:!0,onClick:()=>f("text"),children:"Show as text"}),C(zu,{onClick:y,children:[d(ge,{icon:"Download",size:14,title:"Download body"}),d("span",{children:"Download"})]}),C(zu,{onClick:()=>f("json"),title:i>=x?`This is ${Ni(i)} \u2014 likely to freeze the widget for several seconds.`:`This is ${Ni(i)} \u2014 may stutter while mounting.`,children:["Try as JSON tree ",i>=x?"(likely to freeze)":"(may be slow)"]})]})]})}var eS={name:"82a6rk",styles:"flex:1"};function Km({sizeBytes:n,onDownload:i}){const a=Y();return C("div",{css:b("display:flex;align-items:center;gap:",a.spacing.md,";margin-bottom:",a.spacing.sm,";color:",a.color.textDim,";font-size:",a.typography.fontSizeSm,";",""),children:[C("span",{children:["Body: ",Ni(n)]}),d("div",{css:eS}),C("button",{type:"button",onClick:i,css:b("appearance:none;background:transparent;color:",a.color.primary,";border:1px solid ",a.color.primary,";padding:2px ",a.spacing.md,";border-radius:",a.radius.sm,";cursor:pointer;font-family:inherit;font-size:",a.typography.fontSizeSm,";display:inline-flex;align-items:center;gap:",a.spacing.xs,";&:hover{background:",a.color.methodBlueBg,";}",""),children:[d(ge,{icon:"Download",size:12,title:"Download body"}),"Download"]})]})}function zu({children:n,onClick:i,primary:a,title:s}){const u=Y();return d("button",{type:"button",onClick:i,title:s,css:b("appearance:none;border:1px solid ",a?u.color.primary:u.color.border,";background:",a?u.color.primary:u.color.bg,";color:",a?"#fff":u.color.text,";font-family:inherit;font-weight:",a?u.typography.fontWeightSemibold:u.typography.fontWeightRegular,";font-size:",u.typography.fontSizeBase,";padding:",u.spacing.sm," ",u.spacing.lg,";border-radius:",u.radius.md,";cursor:pointer;display:inline-flex;align-items:center;gap:",u.spacing.xs,";&:hover{filter:brightness(0.95);}",""),children:n})}function tS(n){if(n==null)return"";if(typeof n=="string")return n;try{return JSON.stringify(n,null,2)}catch{return String(n)}}function nS(n){if(!n)return null;for(const[i,a]of Object.entries(n))if(i.toLowerCase()==="content-type")return a==null?null:String(a).toLowerCase();return null}function rS(n){const i=nS(n);return i!=null&&i.includes("application/x-www-form-urlencoded")}function oS(n){if(!n)return{};try{const i=new URLSearchParams(n);return iS(i.entries())}catch{const i={};for(const a of n.split("&")){if(!a)continue;const s=a.indexOf("="),u=s===-1?a:a.slice(0,s),f=s===-1?"":a.slice(s+1);Vm(i,Gm(u),Gm(f))}return i}}function iS(n){const i={};for(const[a,s]of n)Vm(i,a,s);return i}function Vm(n,i,a){const s=n[i];s===void 0?n[i]=a:Array.isArray(s)?s.push(a):n[i]=[s,a]}function Gm(n){try{return decodeURIComponent(n.replace(/\+/g," "))}catch{return n}}function aS({request:n,tab:i}){const a=Y(),{closeRequestDetail:s,detailTab:u,setDetailTab:f}=Qe();return C("div",{role:"dialog","aria-label":"Request details",css:b("position:absolute;inset:0;background:",a.color.bg,";display:flex;flex-direction:column;font-family:inherit;",""),children:[C("div",{css:b("display:flex;align-items:center;gap:",a.spacing.md,";padding:",a.spacing.md," ",a.spacing.lg,";border-bottom:1px solid ",a.color.border,";",""),children:[d("button",{type:"button","aria-label":"Back",onClick:()=>s(i),css:b("appearance:none;background:transparent;border:none;color:",a.color.text,";cursor:pointer;padding:4px;border-radius:",a.radius.sm,";display:inline-flex;&:hover{background:",a.color.surfaceBright,";}",""),children:d(ge,{icon:"ChevronLeft",size:20,title:"Back"})}),d(nn,{method:n.request.method,compact:!0}),d(Hm,{status:n.response?.statusCode??null}),d("span",{title:n.request.url,css:b("color:",a.color.textDim,";font-family:",a.typography.fontFamilyMono,";font-size:",a.typography.fontSizeSm,";white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0;",""),children:n.request.url})]}),C("div",{role:"tablist",css:b("display:flex;align-items:stretch;border-bottom:1px solid ",a.color.border,";padding:0 ",a.spacing.lg,";",""),children:[d(Mu,{id:"HEADERS",label:"Headers",active:u==="HEADERS",onSelect:f}),d(Mu,{id:"REQ_BODY",label:"Request",active:u==="REQ_BODY",onSelect:f}),d(Mu,{id:"RES_BODY",label:"Response",active:u==="RES_BODY",onSelect:f})]}),d("div",{role:"tabpanel",css:b("flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:",a.spacing.lg,";",""),children:u==="HEADERS"?d(sS,{request:n}):u==="REQ_BODY"?d(Ym,{title:"REQUEST BODY",body:n.request.body,headers:n.request.headers,downloadName:`request-${n.requestId}.json`}):d(Ym,{title:"RESPONSE BODY",body:n.response?.body??null,sizeBytes:n.response?.sizeBytes,downloadName:`response-${n.requestId}.json`})})]})}function Mu({id:n,label:i,active:a,onSelect:s}){const u=Y();return d("button",{type:"button",role:"tab","aria-selected":a,onClick:()=>s(n),css:b("appearance:none;background:transparent;border:none;border-bottom:2px solid ",a?u.color.primary:"transparent",";color:",a?u.color.primary:u.color.text,";font-weight:",a?u.typography.fontWeightSemibold:u.typography.fontWeightMedium,";font-family:inherit;font-size:",u.typography.fontSizeLg,";padding:",u.spacing.lg," ",u.spacing.md,";margin-right:",u.spacing.xl,";cursor:pointer;&:hover{color:",u.color.primary,";}",""),children:i})}var lS={name:"tw4sx",styles:"display:flex;flex-direction:column;gap:12px"};function sS({request:n}){return C("div",{css:lS,children:[d($i,{label:"RESPONSE HEADERS",children:d(ko,{value:n.response?.headers??{},defaultExpandDepth:3,height:250})}),d($i,{label:"REQUEST HEADERS",children:d(ko,{value:n.request.headers??{},defaultExpandDepth:3,height:200})})]})}function $i({label:n,children:i}){const a=Y();return C("div",{children:[d("div",{css:b("font-size:",a.typography.fontSizeSm,";color:",a.color.textDim,";font-weight:",a.typography.fontWeightSemibold,";letter-spacing:0.04em;margin-bottom:",a.spacing.sm,";",""),children:n}),i]})}const cS=50*1024;function Ym({title:n,body:i,headers:a,sizeBytes:s,downloadName:u}){const f=Y(),g=uS(i,a);if(g==null||typeof g=="string"&&g.trim()==="")return d($i,{label:n,children:d("div",{css:b("color:",f.color.textDim,";font-size:",f.typography.fontSizeSm,";padding:",f.spacing.md,";border:1px dashed ",f.color.border,";border-radius:",f.radius.md,";",""),children:"(empty)"})});const x=s??om(g);return x>cS?d($i,{label:n,children:d(Qw,{body:g,sizeBytes:x,downloadName:u})}):d($i,{label:n,children:d(ko,{value:g})})}function uS(n,i){return typeof n=="string"&&rS(i)?oS(n):n}var dS={name:"1fttcpj",styles:"display:flex;flex-direction:column"},fS={name:"69do8t",styles:"position:relative;height:100%;display:flex;flex-direction:column;min-height:0"};function Jm({tab:n,requests:i,renderMenu:a,getEditLabel:s,getDebugLabel:u,emptyHint:f="Nothing here yet."}){const g=Y(),{tabPrefs:x,selectedRequestIdByTab:y,openRequestDetail:h}=Qe(),w=x[n].searchText.trim().toLowerCase(),S=y[n],R=m.useRef(null);m.useEffect(()=>{if(!S||!R.current)return;let M=R.current.parentElement;for(;M;){const z=getComputedStyle(M);if(z.overflowY==="auto"||z.overflowY==="scroll"){try{M.scrollTo({top:0,behavior:"smooth"})}catch{M.scrollTop=0}break}M=M.parentElement}},[S]);const D=m.useMemo(()=>w?i.filter(M=>{const z=M.request.url.toLowerCase(),P=M.request.method.toLowerCase(),U=String(M.response?.statusCode??"");return z.includes(w)||P.includes(w)||U.includes(w)}):i,[i,w]),_=S?i.find(M=>M.requestId===S):void 0;return C("div",{ref:R,css:fS,children:[D.length===0?d("div",{css:b("padding:",g.spacing.xxl,";color:",g.color.textDim,";font-size:",g.typography.fontSizeSm,";text-align:center;",""),children:f}):d("div",{css:dS,children:D.map(M=>d(Vw,{request:M,isActive:M.requestId===S,onClick:()=>h(n,M.requestId),renderMenu:a?()=>a(M):void 0,editLabel:s?.(M)??null,debugLabel:u?.(M)??null},M.requestId))}),_?d(aS,{request:_,tab:n}):null]})}function Xm(n,i){switch(i){case"curl":return pS(n.request);case"fetch":return gS(n.request);case"xhr":return hS(n.request);default:return i}}function Tu(n){if(n==null)return null;if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}function _u(n){return n?Object.entries(n).map(([i,a])=>[i,String(a??"")]):[]}function Ru(n){return`'${n.replace(/'/g,"'\\''")}'`}function pS(n){const i=[`curl -X ${n.method.toUpperCase()} ${Ru(n.url)}`];for(const[s,u]of _u(n.headers))i.push(` -H ${Ru(`${s}: ${u}`)}`);const a=Tu(n.body);return a!==null&&i.push(` --data-raw ${Ru(a)}`),i.join(` \\
225
225
  `)}function gS(n){const i=[` method: '${n.method.toUpperCase()}',`],a=_u(n.headers);if(a.length){i.push(" headers: {");for(const[u,f]of a)i.push(` ${JSON.stringify(u)}: ${JSON.stringify(f)},`);i.push(" },")}const s=Tu(n.body);return s!==null&&i.push(` body: ${JSON.stringify(s)},`),[`await fetch(${JSON.stringify(n.url)}, {`,...i,"});"].join(`
226
226
  `)}function hS(n){const i=["const xhr = new XMLHttpRequest();",`xhr.open(${JSON.stringify(n.method.toUpperCase())}, ${JSON.stringify(n.url)});`];for(const[s,u]of _u(n.headers))i.push(`xhr.setRequestHeader(${JSON.stringify(s)}, ${JSON.stringify(u)});`);const a=Tu(n.body);return a!==null?i.push(`xhr.send(${JSON.stringify(a)});`):i.push("xhr.send();"),i.join(`
227
- `)}function mS(){const{mocked:n}=Di();return d(Jm,{tab:"MOCKED",requests:n,renderMenu:i=>d(yS,{request:i}),emptyHint:"No mocked requests yet."})}function yS({request:n}){const{showSnackbar:i}=bt(),a=Y(),s=async(u,f)=>{const g=Xm(n,u);await kl(g)?i(`${f} copied to clipboard`,"success"):i("Copy failed \u2014 clipboard unavailable","error")};return d(xu,{minWidth:160,align:"right",renderTrigger:(u,f)=>d("button",{type:"button","aria-label":"Row actions","aria-expanded":f,onClick:u,css:b("appearance:none;border:none;background:",f?a.color.surfaceBright:"transparent",";color:",a.color.textDim,";cursor:pointer;padding:4px;border-radius:",a.radius.sm,";&:hover{background:",a.color.surfaceBright,";color:",a.color.text,";}",""),children:d(ge,{icon:"MoreVertical",size:16,title:"More options"})}),items:[{label:"Copy as cURL",onSelect:()=>s("curl","cURL")},{label:"Copy as Fetch",onSelect:()=>s("fetch","fetch")},{label:"Copy as XHR",onSelect:()=>s("xhr","XHR")}]})}function Pu({error:n,onSwitchToText:i}){const a=Y();return C("div",{role:"status",css:b("border:1px dashed ",a.color.warning,";border-radius:",a.radius.md,";background:",a.color.surface,";padding:",a.spacing.xl,";display:flex;flex-direction:column;align-items:flex-start;gap:",a.spacing.sm,";",""),children:[d("div",{css:b("color:",a.color.text,";font-weight:",a.typography.fontWeightSemibold,";font-size:",a.typography.fontSizeBase,";",""),children:"Not a valid JSON"}),n?d("div",{css:b("color:",a.color.textDim,";font-size:",a.typography.fontSizeSm,";font-family:",a.typography.fontFamilyMono,";word-break:break-word;",""),children:n}):null,d("div",{css:b("color:",a.color.textDim,";font-size:",a.typography.fontSizeSm,";",""),children:"The visual editor can only render JSON. Use the text editor to keep editing the value as-is \u2014 it will be sent as plain text."}),d("button",{type:"button",onClick:i,css:b("appearance:none;background:transparent;border:none;color:",a.color.primary,";text-decoration:underline;cursor:pointer;font-family:inherit;font-size:",a.typography.fontSizeSm,";padding:0;",""),children:"Switch to Text Editor"})]})}const bS=m.lazy(()=>import("./JsonEditorLazyBundle-B-Hu2lPz.js"));var vS={name:"5cqyai",styles:"flex:1;min-height:0;overflow:hidden;overscroll-behavior:contain;display:flex;flex-direction:column;&>div{flex:1;height:auto!important;min-height:0;}"};function Nu(n){const i=Y(),{fullscreenSlotRef:a}=Qe(),[s,u]=m.useState(!1),f=n.height??350,g=C("div",{css:b("display:flex;flex-direction:column;background:",i.color.bg,";border:1px solid ",i.color.primary,";border-radius:",i.radius.md,";overflow:hidden;",s?`
227
+ `)}function mS(){const{mocked:n}=Di();return d(Jm,{tab:"MOCKED",requests:n,renderMenu:i=>d(yS,{request:i}),emptyHint:"No mocked requests yet."})}function yS({request:n}){const{showSnackbar:i}=bt(),a=Y(),s=async(u,f)=>{const g=Xm(n,u);await kl(g)?i(`${f} copied to clipboard`,"success"):i("Copy failed \u2014 clipboard unavailable","error")};return d(xu,{minWidth:160,align:"right",renderTrigger:(u,f)=>d("button",{type:"button","aria-label":"Row actions","aria-expanded":f,onClick:u,css:b("appearance:none;border:none;background:",f?a.color.surfaceBright:"transparent",";color:",a.color.textDim,";cursor:pointer;padding:4px;border-radius:",a.radius.sm,";&:hover{background:",a.color.surfaceBright,";color:",a.color.text,";}",""),children:d(ge,{icon:"MoreVertical",size:16,title:"More options"})}),items:[{label:"Copy as cURL",onSelect:()=>s("curl","cURL")},{label:"Copy as Fetch",onSelect:()=>s("fetch","fetch")},{label:"Copy as XHR",onSelect:()=>s("xhr","XHR")}]})}function Pu({error:n,onSwitchToText:i}){const a=Y();return C("div",{role:"status",css:b("border:1px dashed ",a.color.warning,";border-radius:",a.radius.md,";background:",a.color.surface,";padding:",a.spacing.xl,";display:flex;flex-direction:column;align-items:flex-start;gap:",a.spacing.sm,";",""),children:[d("div",{css:b("color:",a.color.text,";font-weight:",a.typography.fontWeightSemibold,";font-size:",a.typography.fontSizeBase,";",""),children:"Not a valid JSON"}),n?d("div",{css:b("color:",a.color.textDim,";font-size:",a.typography.fontSizeSm,";font-family:",a.typography.fontFamilyMono,";word-break:break-word;",""),children:n}):null,d("div",{css:b("color:",a.color.textDim,";font-size:",a.typography.fontSizeSm,";",""),children:"The visual editor can only render JSON. Use the text editor to keep editing the value as-is \u2014 it will be sent as plain text."}),d("button",{type:"button",onClick:i,css:b("appearance:none;background:transparent;border:none;color:",a.color.primary,";text-decoration:underline;cursor:pointer;font-family:inherit;font-size:",a.typography.fontSizeSm,";padding:0;",""),children:"Switch to Text Editor"})]})}const bS=m.lazy(()=>import("./JsonEditorLazyBundle-BN6B4Qj4.js"));var vS={name:"5cqyai",styles:"flex:1;min-height:0;overflow:hidden;overscroll-behavior:contain;display:flex;flex-direction:column;&>div{flex:1;height:auto!important;min-height:0;}"};function Nu(n){const i=Y(),{fullscreenSlotRef:a}=Qe(),[s,u]=m.useState(!1),f=n.height??350,g=C("div",{css:b("display:flex;flex-direction:column;background:",i.color.bg,";border:1px solid ",i.color.primary,";border-radius:",i.radius.md,";overflow:hidden;",s?`
228
228
  position: absolute;
229
229
  inset: 0;
230
230
  border-radius: 0;
@@ -239,4 +239,4 @@ Duration ${u}ms`}function Wm(n){if(n==null||n==="")return null;if(typeof n=="n
239
239
  0% { transform: translateX(-100%) scaleX(0.4); }
240
240
  50% { transform: translateX(20%) scaleX(0.6); }
241
241
  100% { transform: translateX(100%) scaleX(0.4); }
242
- `;function f2({message:n,theme:i}){return C("div",{role:"alert",css:b("background:#fef2f2;border:1px solid #fecaca;border-left:3px solid ",i.color.error,";color:",i.color.error,";padding:",i.spacing.md," ",i.spacing.lg,";border-radius:",i.radius.md,";font-size:",i.typography.fontSizeBase,";line-height:1.5;display:flex;align-items:flex-start;gap:",i.spacing.sm,";",""),children:[d("strong",{css:b("font-weight:",i.typography.fontWeightBold,";",""),children:"\u2717"}),d("span",{children:n})]})}function p2(n){if(!n||typeof n!="object")return null;const i=n;return i.status===0?typeof i.message=="string"?i.message:"AI service could not fulfill the request.":i.result==null?typeof i.message=="string"?i.message:"AI returned no result.":null}function g2(n){return n.replace(/^\s*```[a-zA-Z]*\s*\n?/,"").replace(/\n?```\s*$/,"")}function h2(n){const i=n.x+n.width/2,a=n.y+n.height/2,s=m2(i,a);if(!s)return null;let u=s;for(;u.parentElement&&u.parentElement.getBoundingClientRect().width<=n.width*1.5&&u.parentElement.getBoundingClientRect().height<=n.height*1.5;)u=u.parentElement;return Ju(u)?null:u}function m2(n,i){const a=document.getElementById("mfm-root"),s=a?.style.visibility??"",u=a?.style.pointerEvents??"";a&&(a.style.visibility="hidden",a.style.pointerEvents="none");let f=null;try{f=document.elementFromPoint(n,i)}finally{a&&(a.style.visibility=s,a.style.pointerEvents=u)}if(f instanceof HTMLElement&&!Ju(f))return f;const g=document.elementsFromPoint(n,i);for(const x of g)if(x instanceof HTMLElement&&!Ju(x))return x;return null}function Ju(n){const i=document.getElementById("mfm-root");return i?i===n||i.contains(n):!1}function y2(n){if(!n)return"";if(n.length<=by)return n;const i="\u2026[truncated]";return n.slice(0,by-i.length)+i}function b2(n){if(!n||typeof n!="object")return null;const i=n.result?.content;if(typeof i!="string")return null;try{const a=JSON.parse(i);return a&&typeof a=="object"?a:null}catch{return null}}function Cy(){const n=Y(),{confirmState:i,dismissConfirm:a}=Qe();if(m.useEffect(()=>{if(!i)return;const w=S=>{S.key==="Escape"&&a()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i,a]),!i)return null;const{title:s,message:u,confirmLabel:f,cancelLabel:g,danger:x,onConfirm:y}=i,h=()=>{a(),y()};return d("div",{role:"dialog","aria-label":s??"Confirm","aria-modal":"true",onClick:w=>{w.target===w.currentTarget&&a()},css:b("position:absolute;inset:0;background:rgba(15, 23, 42, 0.5);z-index:",n.z.confirm,";display:flex;align-items:center;justify-content:center;padding:",n.spacing.xl,";",""),children:C("div",{css:b("background:",n.color.bg,";border-radius:",n.radius.lg,";box-shadow:",n.shadow.lg,";padding:",n.spacing.xl,";max-width:360px;width:100%;display:flex;flex-direction:column;gap:",n.spacing.md,";",""),children:[s?d("h3",{css:b("margin:0;font-size:",n.typography.fontSizeLg,";font-weight:",n.typography.fontWeightBold,";color:",n.color.text,";",""),children:s}):null,d("p",{css:b("margin:0;color:",n.color.text,";font-size:",n.typography.fontSizeBase,";line-height:1.5;",""),children:u}),C("div",{css:b("display:flex;justify-content:flex-end;gap:",n.spacing.md,";margin-top:",n.spacing.sm,";",""),children:[d("button",{type:"button",onClick:a,css:b("appearance:none;background:transparent;border:1px solid ",n.color.border,";color:",n.color.text,";font-family:inherit;font-size:",n.typography.fontSizeBase,";padding:",n.spacing.sm," ",n.spacing.lg,";border-radius:",n.radius.md,";cursor:pointer;&:hover{background:",n.color.surfaceBright,";}",""),children:g??"Cancel"}),d("button",{type:"button",autoFocus:!0,onClick:h,css:b("appearance:none;border:none;background:",x?n.color.error:n.color.primary,";color:#fff;font-family:inherit;font-weight:",n.typography.fontWeightSemibold,";font-size:",n.typography.fontSizeBase,";padding:",n.spacing.sm," ",n.spacing.lg,";border-radius:",n.radius.md,";cursor:pointer;&:hover{filter:brightness(0.95);}",""),children:f??"Confirm"})]})]})})}function v2(){const{analyticsEnabled:n}=du(),{token:i,organisationId:a}=vt();return m.useEffect(()=>{Me.setEnabled(n)},[n]),m.useEffect(()=>{Me.setToken(i)},[i]),m.useEffect(()=>{Me.setOrganisationId(a)},[a]),null}function x2({clientType:n,version:i}={}){return C(sv,{initialMode:"light",children:[d(w2,{}),d(fv,{children:d(Iv,{clientType:n,version:i,children:d(Av,{children:d(Lv,{children:d(qv,{children:d(Hv,{children:d(Kv,{children:d(Uv,{children:C(Jv,{children:[d(v2,{}),d(fw,{}),d(S2,{})]})})})})})})})})})]})}function w2(){const n=Y();return d($h,{styles:b(":host,[data-mfm-mount]{all:initial;color:",n.color.text,";font-family:",n.typography.fontFamily,";font-size:",n.typography.fontSizeBase,";line-height:1.4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;}*,*::before,*::after{box-sizing:border-box;}::-webkit-scrollbar{width:8px;height:8px;}::-webkit-scrollbar-thumb{background:",n.color.border,";border-radius:",n.radius.pill,";}::-webkit-scrollbar-thumb:hover{background:",n.color.textDim,";}","")})}function S2(){const{setOpen:n,isInterceptEnabled:i,toggleIntercept:a,isSettingsOpen:s,openSettings:u,startSnipping:f,requestConfirm:g}=Qe(),{token:x,isTokenValidated:y,isValidating:h,isLoading:w,reloadMappings:S,deleteToken:R}=vt(),{debugRules:D,editRules:_}=So(),{globalDelay:M}=du(),z=()=>{g({title:"Delete token?",message:"Are you sure you want to delete token? API interception will stop once the token is removed.",confirmLabel:"Delete",danger:!0,onConfirm:R})},P=()=>{if(!i){a();return}g({title:"Disable interception?",message:"Once disabled, the widget will stop intercepting requests and disappear from the page. Please refresh the page after disabling it. You can re-enable it anytime from the MockForMe settings page via the extension icon in tray or the right-click menu. You can also re-enable it from inside Widget Settings \u2192 Whitelisted Hosts.",confirmLabel:"Disable",danger:!0,onConfirm:a})};if(!y&&(h||x))return C(Yt,{children:[d(bu,{children:d(Xu,{children:d(E2,{})})}),d(Gu,{})]});if(!x)return C(Yt,{children:[d(bu,{children:C(Xu,{children:[d(Lk,{}),d(Cy,{})]})}),d(Gu,{})]});const U=s||D.length>0||_.length>0||M.enabled;return C(Yt,{children:[C(bu,{children:[d(kw,{onSnip:f,onReload:S,onOpenSettings:u,onDeleteToken:z,isInterceptEnabled:i,onToggleIntercept:P,onClose:()=>n(!1),isSettingsActive:U,isReloading:w,isAuthenticated:!0}),d(Cw,{}),C(Xu,{children:[d(Nk,{}),d($k,{}),d(Bk,{}),d(Uk,{}),d(Gk,{}),d(e2,{}),d(Cy,{}),d(C2,{})]})]}),d(Gu,{})]})}var k2={name:"3kwpv8",styles:"flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center"};function E2(){const n=Y();return C("div",{css:k2,children:[d(rn,{size:26,color:n.color.primary,label:"Validating token"}),d("div",{css:b("font-size:",n.typography.fontSizeBase,";font-weight:600;color:",n.color.text,";",""),children:"Validating your token\u2026"}),d("div",{css:b("font-size:12px;color:",n.color.textDim,";max-width:260px;line-height:1.5;",""),children:"Hang tight \u2014 we're verifying your session before loading the widget."})]})}function C2(){const{invalidatedMessage:n,acknowledgeInvalidation:i}=vt(),a=Y();return n==null?null:d(lr,{open:!0,hideClose:!0,title:"Token no longer valid",leadingDot:"live",onClose:()=>{},footer:d("button",{type:"button",onClick:i,css:b("appearance:none;border:none;border-radius:",a.radius.sm,";background:",a.color.primary,";color:#fff;font-size:",a.typography.fontSizeBase,";font-weight:",a.typography.fontWeightBold,";padding:8px 20px;cursor:pointer;&:hover{background:",a.color.primaryHover,";}",""),children:"OK"}),children:d("p",{css:b("margin:0;font-size:",a.typography.fontSizeBase,";line-height:1.5;color:",a.color.text,";",""),children:n})})}var z2={name:"4oq8x6",styles:"position:absolute;inset:0;pointer-events:none;z-index:1500;&:empty{display:none;}&>*{pointer-events:auto;}"},M2={name:"p72qif",styles:"flex:1;min-height:0;position:relative;display:flex;flex-direction:column;overflow:hidden"};function Xu({children:n}){const{fullscreenSlotRef:i}=Qe();return C("div",{css:M2,children:[n,d("div",{ref:i,"data-mfm-fullscreen-slot":!0,css:z2})]})}class T2 extends m.Component{constructor(){super(...arguments),ar(this,"state",{hasError:!1})}static getDerivedStateFromError(){return wl(),{hasError:!0}}componentDidCatch(i,a){try{this.props.onError(i,a)}catch{}}render(){return this.state.hasError?null:this.props.children}}function _2(){if(typeof document>"u"||!document.body)return{dismiss(){}};const n=document.createElement("div");n.id="mfm-error-snackbar",n.style.cssText=["all: initial","position: fixed","right: 16px","bottom: 16px","z-index: 2147483646"].join(";"),document.body.appendChild(n);const i=n.attachShadow({mode:"closed"}),a=document.createElement("div");a.style.cssText=["box-sizing: border-box","display: flex","align-items: center","gap: 10px","min-width: 280px","max-width: 380px","padding: 10px 12px","background: #1f2937","color: #f9fafb","border: 1px solid #374151","border-radius: 8px","box-shadow: 0 8px 24px rgba(0,0,0,0.25)",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 13px","line-height: 1.4"].join(";");const s=document.createElement("div");s.style.cssText=["flex: 1 1 auto","min-width: 0"].join(";");const u=document.createElement("div");u.textContent="MockForMe is unable to load.",u.style.cssText="font-weight: 500";const f=document.createElement("div");f.textContent="The issue has been reported.",f.style.cssText=["margin-top: 2px","color: #9ca3af","font-size: 12px"].join(";"),s.appendChild(u),s.appendChild(f);const g=document.createElement("button");g.type="button",g.setAttribute("aria-label","Dismiss"),g.textContent="\xD7",g.style.cssText=["flex: 0 0 auto","width: 24px","height: 24px","padding: 0","background: transparent","color: #9ca3af","border: 0","border-radius: 4px","cursor: pointer","font-size: 18px","line-height: 1"].join(";");let x=!1;const y=()=>{if(!x){x=!0;try{n.remove()}catch{}}};return g.addEventListener("click",y),a.appendChild(s),a.appendChild(g),i.appendChild(a),{dismiss:y}}const R2="MFM_TOKEN";function P2(n){try{Me.init(),Me.setClientType(n);const i=ht().read(R2);i&&Me.setToken(i)}catch{}}const Mo=(()=>{try{const n=import.meta.url,i=n.lastIndexOf("/");return i>0?n.slice(0,i+1):n}catch{return""}})();function zy(n,i){return!Mo||!N2()?!1:!!(n&&n.startsWith(Mo)||i&&i.indexOf(Mo)!==-1)}function N2(){try{const n=typeof document<"u"&&(document.baseURI||document.location&&document.location.href)||"";return n?!n.startsWith(Mo):!1}catch{return!1}}let cr=null;const My="data-mfm-mount";function Ty(n){return n||document.getElementById("mfm-root")||(document.body?document.body:null)}function _y(n,i){let a;n.id==="mfm-root"?a=n:(a=document.createElement("div"),a.id="mfm-root",n.appendChild(a)),a.style.cssText="all: initial; display: block;",P2(i.clientType);const s=["click","dblclick","mousedown","mouseup","mousemove","pointerdown","pointerup","pointermove","contextmenu","wheel","touchstart","touchend","touchmove"],u=z=>z.stopPropagation();for(const z of s){const P=z==="wheel"||z==="touchstart"||z==="touchend"||z==="touchmove";a.addEventListener(z,u,{passive:P})}const f=a.shadowRoot??a.attachShadow({mode:"open"});let g=f.querySelector(`[${My}]`);g||(g=document.createElement("div"),g.setAttribute(My,""),f.appendChild(g));const x=kh({key:"mfm",container:f,prepend:!0}),y={run:()=>{}},h=c1.createRoot(g);h.render(m.createElement(m.StrictMode,null,m.createElement(X1,{value:x},m.createElement(T2,{onError:z=>{setTimeout(()=>y.run(z),0)}},m.createElement(x2,{clientType:i.clientType,version:i.version})))));const w=z=>{const P=z.error;zy(z.filename,P?.stack)&&(wl(),z.preventDefault(),y.run(z.error))},S=z=>{const P=z.reason,U=P?.stack??(P?String(P):void 0);zy(void 0,U)&&(wl(),z.preventDefault(),y.run(z.reason))};window.addEventListener("error",w),window.addEventListener("unhandledrejection",S);const R=console.error;console.error=function(...z){if(!Tx()){if(Mo)for(let P=0;P<z.length;P++){const U=z[P];if(((U&&typeof U=="object"&&"stack"in U?String(U.stack??""):"")||String(U)).indexOf(Mo)!==-1)return}R.apply(console,z)}};let D=!1,_=null;const M=z=>{if(!D){if(D=!0,window.removeEventListener("error",w),window.removeEventListener("unhandledrejection",S),console.error!==R)try{console.error=R}catch{}try{h.unmount()}catch{}try{a.remove()}catch{}cr=null;try{if(z!==void 0){const P=z,U=P&&typeof P.message=="string"?P.message:typeof z=="string"?z:String(z),H=P&&typeof P.stack=="string"?P.stack:"",X=P&&typeof P.name=="string"?P.name:"Error";Pm("widget_load_failed",{errorName:X,errorMessage:U,errorStack:H.slice(0,4e3),userAgent:typeof navigator<"u"?navigator.userAgent:"",url:typeof location<"u"?location.href:""})}else Me.track("widget_destroyed");Sl()}catch{}if(z!==void 0)try{_=_2()}catch{}}};return y.run=M,{destroy(){if(M(),_){try{_.dismiss()}catch{}_=null}}}}const Ry={run(n,i={}){if(cr)return cr;if(typeof document<"u"&&document.readyState==="loading"){let s=!1;const u=()=>{if(s)return;const f=Ty(n);f&&(cr=_y(f,i))};return document.addEventListener("DOMContentLoaded",u,{once:!0}),{destroy(){s=!0,document.removeEventListener("DOMContentLoaded",u),cr&&cr.destroy()}}}const a=Ty(n);return a?(cr=_y(a,i),cr):(console.warn("[MockForMeWidget] no mount target available"),{destroy(){}})}};typeof window<"u"&&(window.MockForMeWidget=Ry);export{Yt as F,$h as G,Ry as M,C as a,Mv as b,b as c,Tv as d,ml as e,ht as f,Zg as g,_v as h,Rv as i,d as j,Gh as l,m as r,zv as s};
242
+ `;function f2({message:n,theme:i}){return C("div",{role:"alert",css:b("background:#fef2f2;border:1px solid #fecaca;border-left:3px solid ",i.color.error,";color:",i.color.error,";padding:",i.spacing.md," ",i.spacing.lg,";border-radius:",i.radius.md,";font-size:",i.typography.fontSizeBase,";line-height:1.5;display:flex;align-items:flex-start;gap:",i.spacing.sm,";",""),children:[d("strong",{css:b("font-weight:",i.typography.fontWeightBold,";",""),children:"\u2717"}),d("span",{children:n})]})}function p2(n){if(!n||typeof n!="object")return null;const i=n;return i.status===0?typeof i.message=="string"?i.message:"AI service could not fulfill the request.":i.result==null?typeof i.message=="string"?i.message:"AI returned no result.":null}function g2(n){return n.replace(/^\s*```[a-zA-Z]*\s*\n?/,"").replace(/\n?```\s*$/,"")}function h2(n){const i=n.x+n.width/2,a=n.y+n.height/2,s=m2(i,a);if(!s)return null;let u=s;for(;u.parentElement&&u.parentElement.getBoundingClientRect().width<=n.width*1.5&&u.parentElement.getBoundingClientRect().height<=n.height*1.5;)u=u.parentElement;return Ju(u)?null:u}function m2(n,i){const a=document.getElementById("mfm-root"),s=a?.style.visibility??"",u=a?.style.pointerEvents??"";a&&(a.style.visibility="hidden",a.style.pointerEvents="none");let f=null;try{f=document.elementFromPoint(n,i)}finally{a&&(a.style.visibility=s,a.style.pointerEvents=u)}if(f instanceof HTMLElement&&!Ju(f))return f;const g=document.elementsFromPoint(n,i);for(const x of g)if(x instanceof HTMLElement&&!Ju(x))return x;return null}function Ju(n){const i=document.getElementById("mfm-root");return i?i===n||i.contains(n):!1}function y2(n){if(!n)return"";if(n.length<=by)return n;const i="\u2026[truncated]";return n.slice(0,by-i.length)+i}function b2(n){if(!n||typeof n!="object")return null;const i=n.result?.content;if(typeof i!="string")return null;try{const a=JSON.parse(i);return a&&typeof a=="object"?a:null}catch{return null}}function Cy(){const n=Y(),{confirmState:i,dismissConfirm:a}=Qe();if(m.useEffect(()=>{if(!i)return;const w=S=>{S.key==="Escape"&&a()};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i,a]),!i)return null;const{title:s,message:u,confirmLabel:f,cancelLabel:g,danger:x,onConfirm:y}=i,h=()=>{a(),y()};return d("div",{role:"dialog","aria-label":s??"Confirm","aria-modal":"true",onClick:w=>{w.target===w.currentTarget&&a()},css:b("position:absolute;inset:0;background:rgba(15, 23, 42, 0.5);z-index:",n.z.confirm,";display:flex;align-items:center;justify-content:center;padding:",n.spacing.xl,";",""),children:C("div",{css:b("background:",n.color.bg,";border-radius:",n.radius.lg,";box-shadow:",n.shadow.lg,";padding:",n.spacing.xl,";max-width:360px;width:100%;display:flex;flex-direction:column;gap:",n.spacing.md,";",""),children:[s?d("h3",{css:b("margin:0;font-size:",n.typography.fontSizeLg,";font-weight:",n.typography.fontWeightBold,";color:",n.color.text,";",""),children:s}):null,d("p",{css:b("margin:0;color:",n.color.text,";font-size:",n.typography.fontSizeBase,";line-height:1.5;",""),children:u}),C("div",{css:b("display:flex;justify-content:flex-end;gap:",n.spacing.md,";margin-top:",n.spacing.sm,";",""),children:[d("button",{type:"button",onClick:a,css:b("appearance:none;background:transparent;border:1px solid ",n.color.border,";color:",n.color.text,";font-family:inherit;font-size:",n.typography.fontSizeBase,";padding:",n.spacing.sm," ",n.spacing.lg,";border-radius:",n.radius.md,";cursor:pointer;&:hover{background:",n.color.surfaceBright,";}",""),children:g??"Cancel"}),d("button",{type:"button",autoFocus:!0,onClick:h,css:b("appearance:none;border:none;background:",x?n.color.error:n.color.primary,";color:#fff;font-family:inherit;font-weight:",n.typography.fontWeightSemibold,";font-size:",n.typography.fontSizeBase,";padding:",n.spacing.sm," ",n.spacing.lg,";border-radius:",n.radius.md,";cursor:pointer;&:hover{filter:brightness(0.95);}",""),children:f??"Confirm"})]})]})})}function v2(){const{analyticsEnabled:n}=du(),{token:i,organisationId:a}=vt();return m.useEffect(()=>{Me.setEnabled(n)},[n]),m.useEffect(()=>{Me.setToken(i)},[i]),m.useEffect(()=>{Me.setOrganisationId(a)},[a]),null}function x2({clientType:n,version:i}={}){return C(sv,{initialMode:"light",children:[d(w2,{}),d(fv,{children:d(Iv,{clientType:n,version:i,children:d(Av,{children:d(Lv,{children:d(qv,{children:d(Hv,{children:d(Kv,{children:d(Uv,{children:C(Jv,{children:[d(v2,{}),d(fw,{}),d(S2,{})]})})})})})})})})})]})}function w2(){const n=Y();return d($h,{styles:b(":host,[data-mfm-mount]{all:initial;color:",n.color.text,";font-family:",n.typography.fontFamily,";font-size:",n.typography.fontSizeBase,";line-height:1.4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;}*,*::before,*::after{box-sizing:border-box;}::-webkit-scrollbar{width:8px;height:8px;}::-webkit-scrollbar-thumb{background:",n.color.border,";border-radius:",n.radius.pill,";}::-webkit-scrollbar-thumb:hover{background:",n.color.textDim,";}","")})}function S2(){const{setOpen:n,isInterceptEnabled:i,toggleIntercept:a,isSettingsOpen:s,openSettings:u,startSnipping:f,requestConfirm:g}=Qe(),{token:x,isTokenValidated:y,isValidating:h,isLoading:w,reloadMappings:S,deleteToken:R}=vt(),{debugRules:D,editRules:_}=So(),{globalDelay:M}=du(),z=()=>{g({title:"Delete token?",message:"Are you sure you want to delete token? API interception will stop once the token is removed.",confirmLabel:"Delete",danger:!0,onConfirm:R})},P=()=>{if(!i){a();return}g({title:"Disable interception?",message:"Once disabled, the widget will stop intercepting requests and disappear from the page. You can re-enable it anytime from the MockForMe settings page via the extension icon in tray or the right-click menu. You can also re-enable it from inside Widget Settings \u2192 Whitelisted Hosts.",confirmLabel:"Disable",danger:!0,onConfirm:a})};if(!y&&(h||x))return C(Yt,{children:[d(bu,{children:d(Xu,{children:d(E2,{})})}),d(Gu,{})]});if(!x)return C(Yt,{children:[d(bu,{children:C(Xu,{children:[d(Lk,{}),d(Cy,{})]})}),d(Gu,{})]});const U=s||D.length>0||_.length>0||M.enabled;return C(Yt,{children:[C(bu,{children:[d(kw,{onSnip:f,onReload:S,onOpenSettings:u,onDeleteToken:z,isInterceptEnabled:i,onToggleIntercept:P,onClose:()=>n(!1),isSettingsActive:U,isReloading:w,isAuthenticated:!0}),d(Cw,{}),C(Xu,{children:[d(Nk,{}),d($k,{}),d(Bk,{}),d(Uk,{}),d(Gk,{}),d(e2,{}),d(Cy,{}),d(C2,{})]})]}),d(Gu,{})]})}var k2={name:"3kwpv8",styles:"flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center"};function E2(){const n=Y();return C("div",{css:k2,children:[d(rn,{size:26,color:n.color.primary,label:"Validating token"}),d("div",{css:b("font-size:",n.typography.fontSizeBase,";font-weight:600;color:",n.color.text,";",""),children:"Validating your token\u2026"}),d("div",{css:b("font-size:12px;color:",n.color.textDim,";max-width:260px;line-height:1.5;",""),children:"Hang tight \u2014 we're verifying your session before loading the widget."})]})}function C2(){const{invalidatedMessage:n,acknowledgeInvalidation:i}=vt(),a=Y();return n==null?null:d(lr,{open:!0,hideClose:!0,title:"Token no longer valid",leadingDot:"live",onClose:()=>{},footer:d("button",{type:"button",onClick:i,css:b("appearance:none;border:none;border-radius:",a.radius.sm,";background:",a.color.primary,";color:#fff;font-size:",a.typography.fontSizeBase,";font-weight:",a.typography.fontWeightBold,";padding:8px 20px;cursor:pointer;&:hover{background:",a.color.primaryHover,";}",""),children:"OK"}),children:d("p",{css:b("margin:0;font-size:",a.typography.fontSizeBase,";line-height:1.5;color:",a.color.text,";",""),children:n})})}var z2={name:"4oq8x6",styles:"position:absolute;inset:0;pointer-events:none;z-index:1500;&:empty{display:none;}&>*{pointer-events:auto;}"},M2={name:"p72qif",styles:"flex:1;min-height:0;position:relative;display:flex;flex-direction:column;overflow:hidden"};function Xu({children:n}){const{fullscreenSlotRef:i}=Qe();return C("div",{css:M2,children:[n,d("div",{ref:i,"data-mfm-fullscreen-slot":!0,css:z2})]})}class T2 extends m.Component{constructor(){super(...arguments),ar(this,"state",{hasError:!1})}static getDerivedStateFromError(){return wl(),{hasError:!0}}componentDidCatch(i,a){try{this.props.onError(i,a)}catch{}}render(){return this.state.hasError?null:this.props.children}}function _2(){if(typeof document>"u"||!document.body)return{dismiss(){}};const n=document.createElement("div");n.id="mfm-error-snackbar",n.style.cssText=["all: initial","position: fixed","right: 16px","bottom: 16px","z-index: 2147483646"].join(";"),document.body.appendChild(n);const i=n.attachShadow({mode:"closed"}),a=document.createElement("div");a.style.cssText=["box-sizing: border-box","display: flex","align-items: center","gap: 10px","min-width: 280px","max-width: 380px","padding: 10px 12px","background: #1f2937","color: #f9fafb","border: 1px solid #374151","border-radius: 8px","box-shadow: 0 8px 24px rgba(0,0,0,0.25)",'font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',"font-size: 13px","line-height: 1.4"].join(";");const s=document.createElement("div");s.style.cssText=["flex: 1 1 auto","min-width: 0"].join(";");const u=document.createElement("div");u.textContent="MockForMe is unable to load.",u.style.cssText="font-weight: 500";const f=document.createElement("div");f.textContent="The issue has been reported.",f.style.cssText=["margin-top: 2px","color: #9ca3af","font-size: 12px"].join(";"),s.appendChild(u),s.appendChild(f);const g=document.createElement("button");g.type="button",g.setAttribute("aria-label","Dismiss"),g.textContent="\xD7",g.style.cssText=["flex: 0 0 auto","width: 24px","height: 24px","padding: 0","background: transparent","color: #9ca3af","border: 0","border-radius: 4px","cursor: pointer","font-size: 18px","line-height: 1"].join(";");let x=!1;const y=()=>{if(!x){x=!0;try{n.remove()}catch{}}};return g.addEventListener("click",y),a.appendChild(s),a.appendChild(g),i.appendChild(a),{dismiss:y}}const R2="MFM_TOKEN";function P2(n){try{Me.init(),Me.setClientType(n);const i=ht().read(R2);i&&Me.setToken(i)}catch{}}const Mo=(()=>{try{const n=import.meta.url,i=n.lastIndexOf("/");return i>0?n.slice(0,i+1):n}catch{return""}})();function zy(n,i){return!Mo||!N2()?!1:!!(n&&n.startsWith(Mo)||i&&i.indexOf(Mo)!==-1)}function N2(){try{const n=typeof document<"u"&&(document.baseURI||document.location&&document.location.href)||"";return n?!n.startsWith(Mo):!1}catch{return!1}}let cr=null;const My="data-mfm-mount";function Ty(n){return n||document.getElementById("mfm-root")||(document.body?document.body:null)}function _y(n,i){let a;n.id==="mfm-root"?a=n:(a=document.createElement("div"),a.id="mfm-root",n.appendChild(a)),a.style.cssText="all: initial; display: block;",P2(i.clientType);const s=["click","dblclick","mousedown","mouseup","mousemove","pointerdown","pointerup","pointermove","contextmenu","wheel","touchstart","touchend","touchmove"],u=z=>z.stopPropagation();for(const z of s){const P=z==="wheel"||z==="touchstart"||z==="touchend"||z==="touchmove";a.addEventListener(z,u,{passive:P})}const f=a.shadowRoot??a.attachShadow({mode:"open"});let g=f.querySelector(`[${My}]`);g||(g=document.createElement("div"),g.setAttribute(My,""),f.appendChild(g));const x=kh({key:"mfm",container:f,prepend:!0}),y={run:()=>{}},h=c1.createRoot(g);h.render(m.createElement(m.StrictMode,null,m.createElement(X1,{value:x},m.createElement(T2,{onError:z=>{setTimeout(()=>y.run(z),0)}},m.createElement(x2,{clientType:i.clientType,version:i.version})))));const w=z=>{const P=z.error;zy(z.filename,P?.stack)&&(wl(),z.preventDefault(),y.run(z.error))},S=z=>{const P=z.reason,U=P?.stack??(P?String(P):void 0);zy(void 0,U)&&(wl(),z.preventDefault(),y.run(z.reason))};window.addEventListener("error",w),window.addEventListener("unhandledrejection",S);const R=console.error;console.error=function(...z){if(!Tx()){if(Mo)for(let P=0;P<z.length;P++){const U=z[P];if(((U&&typeof U=="object"&&"stack"in U?String(U.stack??""):"")||String(U)).indexOf(Mo)!==-1)return}R.apply(console,z)}};let D=!1,_=null;const M=z=>{if(!D){if(D=!0,window.removeEventListener("error",w),window.removeEventListener("unhandledrejection",S),console.error!==R)try{console.error=R}catch{}try{h.unmount()}catch{}try{a.remove()}catch{}cr=null;try{if(z!==void 0){const P=z,U=P&&typeof P.message=="string"?P.message:typeof z=="string"?z:String(z),H=P&&typeof P.stack=="string"?P.stack:"",X=P&&typeof P.name=="string"?P.name:"Error";Pm("widget_load_failed",{errorName:X,errorMessage:U,errorStack:H.slice(0,4e3),userAgent:typeof navigator<"u"?navigator.userAgent:"",url:typeof location<"u"?location.href:""})}else Me.track("widget_destroyed");Sl()}catch{}if(z!==void 0)try{_=_2()}catch{}}};return y.run=M,{destroy(){if(M(),_){try{_.dismiss()}catch{}_=null}}}}const Ry={run(n,i={}){if(cr)return cr;if(typeof document<"u"&&document.readyState==="loading"){let s=!1;const u=()=>{if(s)return;const f=Ty(n);f&&(cr=_y(f,i))};return document.addEventListener("DOMContentLoaded",u,{once:!0}),{destroy(){s=!0,document.removeEventListener("DOMContentLoaded",u),cr&&cr.destroy()}}}const a=Ty(n);return a?(cr=_y(a,i),cr):(console.warn("[MockForMeWidget] no mount target available"),{destroy(){}})}};typeof window<"u"&&(window.MockForMeWidget=Ry);export{Yt as F,$h as G,Ry as M,C as a,Mv as b,b as c,Tv as d,ml as e,ht as f,Zg as g,_v as h,Rv as i,d as j,Gh as l,m as r,zv as s};
@@ -1 +1 @@
1
- import{M as a,b as e,d as t,M as s,e as o,f as r,l as g,s as S,h as l,i as y}from"./chunks/widget-B8TRg0gv.js";export{a as MockForMeWidget,e as cookieStorageStrategy,t as createChromeStorageStrategyTemplate,s as default,o as getFlowRunStore,r as getStorage,g as localStorageStrategy,S as sessionStorageStrategy,l as setFlowRunStore,y as setStorageStrategy};
1
+ import{M as a,b as e,d as t,M as s,e as o,f as r,l as g,s as S,h as l,i as y}from"./chunks/widget-DorTwZXr.js";export{a as MockForMeWidget,e as cookieStorageStrategy,t as createChromeStorageStrategyTemplate,s as default,o as getFlowRunStore,r as getStorage,g as localStorageStrategy,S as sessionStorageStrategy,l as setFlowRunStore,y as setStorageStrategy};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mfm-widget-newer",
3
- "version": "14.5.1",
3
+ "version": "14.6.0",
4
4
  "type": "module",
5
5
  "description": "mfm-w",
6
6
  "main": "./dist/mfm-widget-new.es.js",