@arcgis/portal-components 5.2.0-next.53 → 5.2.0-next.54
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/cdn/{AGVSKS3A.js → KH6T7CDO.js} +19 -19
- package/dist/cdn/{XVFCF4AX.js → NADYAODN.js} +34 -34
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +222 -222
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
|
@@ -360,12 +360,7 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
|
|
|
360
360
|
_example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
|
|
361
361
|
_example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
|
|
362
362
|
_example: "Find John Smith and all people he has made phone calls to in the last year"_
|
|
363
|
-
_example: "What is the average age of all people who work for Esri?"_`;var It=ps;var Ae=oe;var _s=()=>Oa(),qa=async(t,e)=>await ve(t,e),Ba=async({modelTier:t="default",temperature:e=0,config:r}={})=>await al({modelTier:t,temperature:e,config:r});var ym=t=>{let{portal:e,user:r}=t??{};return!!t&&!!e&&!!r};function jr(t){if(!ym(t))throw new Error("Invalid context: PortalAssistantContext with portal and user is required.")}var Vx
|
|
364
|
-
|
|
365
|
-
${n.map(p=>`- **@${p}**`).join(`
|
|
366
|
-
`)}
|
|
367
|
-
|
|
368
|
-
Do you want to continue?`,{hitlResponse:s}=e?.configurable??{};if(s?.agentId!==dm||s.id!==pm){let p={agentId:dm,id:pm,kind:"booleanChoice",message:o,metadata:{action:"addMembers",groupId:r,members:[...n]}};throw new ws(p)}if(s.payload!==!0)return{status:"success",outputMessage:"Okay, I cancelled adding members to the group."};await Ae({text:`Adding members ${Vx(n)}...`,agentName:"group-creation"},e);let a=e?.configurable?.context;jr(a);let{result:i,error:u}=await cu(a.portal,r,n);if(u||!i)return{status:"success",outputMessage:"I could not add members to that group. Please confirm group access and user accounts, then try again."};let{addedUsernames:l,notAddedUsers:c}=i;try{let p=(await It({promptText:Zx,schema:Hx,modelTier:"fast",inputVariables:{addedMembers:l.join(", "),notAddedMembers:JSON.stringify(c.map(d=>({username:d.username,reason:d.error.message})))}})).successMessage;if(p)return{status:"success",outputMessage:p}}catch(p){console.error("Error generating add-members success message:",p)}return{}},Zx=`
|
|
363
|
+
_example: "What is the average age of all people who work for Esri?"_`;var It=ps;var Ae=oe;var _s=()=>Oa(),qa=async(t,e)=>await ve(t,e),Ba=async({modelTier:t="default",temperature:e=0,config:r}={})=>await al({modelTier:t,temperature:e,config:r});var ym=t=>{let{portal:e,user:r}=t??{};return!!t&&!!e&&!!r};function jr(t){if(!ym(t))throw new Error("Invalid context: PortalAssistantContext with portal and user is required.")}var Vx=`
|
|
369
364
|
Write a concise, friendly success message for adding members to a group.
|
|
370
365
|
|
|
371
366
|
Rules:
|
|
@@ -380,7 +375,12 @@ Added members:
|
|
|
380
375
|
|
|
381
376
|
Not added members:
|
|
382
377
|
{notAddedMembers}
|
|
383
|
-
`,
|
|
378
|
+
`,Hx=t=>t.map(e=>`"${e}"`).join(", "),Jx=m.object({successMessage:m.string().default("")}),dm="portal-group-creation",pm="approveAddMembers",Zx=async(t,e)=>{if(t.intentParams.intent!=="addMembers")return{status:"success",outputMessage:"Use @mention usernames for the members you want to add."};let r=t.agentExecutionContext.sharedState.createdGroupId?.value;if(!r)return{status:"success",outputMessage:"Create a group first, then add members using @mention usernames."};let n=t.intentParams.memberInfo.memberIdentifiers.map(p=>p.trim()).filter(Boolean);if(!n.length)return{status:"success",outputMessage:"Use @mention usernames for the members you want to add."};let o=`The following member(s) will be added to the newly created group:
|
|
379
|
+
|
|
380
|
+
${n.map(p=>`- **@${p}**`).join(`
|
|
381
|
+
`)}
|
|
382
|
+
|
|
383
|
+
Do you want to continue?`,{hitlResponse:s}=e?.configurable??{};if(s?.agentId!==dm||s.id!==pm){let p={agentId:dm,id:pm,kind:"booleanChoice",message:o,metadata:{action:"addMembers",groupId:r,members:[...n]}};throw new ws(p)}if(s.payload!==!0)return{status:"success",outputMessage:"Okay, I cancelled adding members to the group."};await Ae({text:`Adding members ${Hx(n)}...`,agentName:"group-creation"},e);let a=e?.configurable?.context;jr(a);let{result:i,error:u}=await cu(a.portal,r,n);if(u||!i)return{status:"success",outputMessage:"I could not add members to that group. Please confirm group access and user accounts, then try again."};let{addedUsernames:l,notAddedUsers:c}=i;try{let p=(await It({promptText:Vx,schema:Jx,modelTier:"fast",inputVariables:{addedMembers:l.join(", "),notAddedMembers:JSON.stringify(c.map(d=>({username:d.username,reason:d.error.message})))}})).successMessage;if(p)return{status:"success",outputMessage:p}}catch(p){console.error("Error generating add-members success message:",p)}return{}},Qx=`
|
|
384
384
|
Write a concise, friendly success message after creating a portal group.
|
|
385
385
|
|
|
386
386
|
Rules:
|
|
@@ -391,7 +391,7 @@ Rules:
|
|
|
391
391
|
|
|
392
392
|
Group title:
|
|
393
393
|
{groupTitle}
|
|
394
|
-
`,
|
|
394
|
+
`,Yx=`
|
|
395
395
|
Write a concise, friendly failure message after an attempt to create a portal group.
|
|
396
396
|
|
|
397
397
|
Rules:
|
|
@@ -406,7 +406,7 @@ Group title:
|
|
|
406
406
|
|
|
407
407
|
Failure reason:
|
|
408
408
|
{failureReason}
|
|
409
|
-
`,
|
|
409
|
+
`,mm="portal-group-creation",fm="approveCreateGroup",Xx=m.object({successMessage:m.string().default("")}),eA=m.object({failureMessage:m.string().default("")}),tA=async(t,e)=>{if(t.intentParams.intent!=="create")return{status:"success",outputMessage:"Tell me the group title you want to use."};let r=t.intentParams.title.trim();if(!r)return{status:"success",outputMessage:"What title would you like for the new group?"};let n=`A group with the title **${r}** will be created. Do you want to continue?`,{hitlResponse:o}=e?.configurable;if(o?.agentId!==mm||o.id!==fm){let l={agentId:mm,id:fm,kind:"booleanChoice",message:n,metadata:{action:"createGroup",title:r,access:"private"}};throw new ws(l)}if(o.payload!==!0)return{status:"success",outputMessage:`Okay, I cancelled creating **${r}**.`};await Ae({text:`Creating group "${r}"...`,agentName:"group-creation"},e);let s=e?.configurable?.context;jr(s);let{result:a,error:i}=await uu(s.portal,{title:r,access:"private"});if(i||!a){let l=i?.message?.trim()||"No additional details were provided.";try{let c=(await It({promptText:Yx,schema:eA,modelTier:"fast",inputVariables:{groupTitle:r,failureReason:l}})).failureMessage.trim();if(c)return{status:"success",outputMessage:c}}catch(c){console.error("Error generating create-group failure message:",c)}return{status:"success",outputMessage:"I could not create that group. Please confirm your permissions and try again with the group title."}}let u=a.id;try{let l=(await It({promptText:Qx,schema:Xx,modelTier:"fast",inputVariables:{groupTitle:r}})).successMessage.trim();if(l)return{status:"success",outputMessage:l,sharedStatePatch:{createdGroupId:{value:u}},createdGroupId:u}}catch(l){console.error("Error generating create-group success message:",l)}return{}},Lr=t=>{for(let e=t.length-1;e>=0;e-=1){let r=t[e];if(r.type!=="human")continue;let n=r.content;if(typeof n=="string")return n;if(Array.isArray(n))return n.map(o=>typeof o=="string"?o:"text"in o&&typeof o.text=="string"?o.text:"").join(" ").trim()}return""},rA=`
|
|
410
410
|
You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
|
|
411
411
|
|
|
412
412
|
Rules:
|
|
@@ -432,7 +432,7 @@ Examples:
|
|
|
432
432
|
|
|
433
433
|
User message:
|
|
434
434
|
{userMessage}
|
|
435
|
-
`,sA=m.enum(["portal-content","portal-content-favorites","portal-content-group","portal-content-living-atlas","portal-content-organization","portal-gallery","portal-groups","portal-groups-featured","portal-groups-my","portal-groups-organization","portal-map-viewer","portal-notebooks","portal-scene-viewer","portal-settings-security"]),aA=m.object({destinationType:sA}),iA=m.union([aA,m.object({destinationType:m.literal("portal-item"),itemId:m.string().trim().min(1)}),m.object({destinationType:m.literal("portal-group"),groupId:m.string().trim().min(1)})]),_m="portal-navigation",vl=async(t,e)=>{let r=e?.configurable?.context;!ym(r)||!r.navigationTargetMap?.[t.destinationType]||await qa({type:_m,data:{...t}},e)},lA=async(t,e)=>{let r=t.createdGroupId??t.agentExecutionContext.sharedState.createdGroupId?.value;return r?(await Ae({text:"Preparing navigation...",agentName:"group-creation"},e),await vl({destinationType:"portal-group",groupId:r},e),{}):{}},hm=(t,e)=>e??t,wm=M.Root({..._s(),intentParams:M({reducer:hm,default:()=>({intent:"clarify"})}),createdGroupId:M({reducer:hm,default:()=>""})}),uA=()=>new _e(wm).addNode("detectGroupCreationIntent",
|
|
435
|
+
`,nA=m.object({intent:m.enum(["clarify","create","addMembers"]).default("clarify"),title:m.string().default(""),memberIdentifiers:m.array(m.string()).default([]),clarifyMessage:m.string().default("")}),oA=async(t,e)=>{await Ae({text:"Thinking about groups...",agentName:"group-creation"},e);let r=Lr(t.agentExecutionContext.messages).trim(),n=await It({promptText:rA,schema:nA,modelTier:"default",inputVariables:{userMessage:r}}),o=n.title.trim(),s=n.memberIdentifiers.filter(Boolean),a=n.clarifyMessage.trim(),i=n.intent==="create"&&!!o,u=n.intent==="addMembers"&&s.length>0;return{intentParams:i?{intent:"create",title:o}:u?{intent:"addMembers",memberInfo:{memberIdentifiers:s}}:{intent:"clarify"},status:"success",outputMessage:!i&&!u?a:""}},sA=m.enum(["portal-content","portal-content-favorites","portal-content-group","portal-content-living-atlas","portal-content-organization","portal-gallery","portal-groups","portal-groups-featured","portal-groups-my","portal-groups-organization","portal-map-viewer","portal-notebooks","portal-scene-viewer","portal-settings-security"]),aA=m.object({destinationType:sA}),iA=m.union([aA,m.object({destinationType:m.literal("portal-item"),itemId:m.string().trim().min(1)}),m.object({destinationType:m.literal("portal-group"),groupId:m.string().trim().min(1)})]),_m="portal-navigation",vl=async(t,e)=>{let r=e?.configurable?.context;!ym(r)||!r.navigationTargetMap?.[t.destinationType]||await qa({type:_m,data:{...t}},e)},lA=async(t,e)=>{let r=t.createdGroupId??t.agentExecutionContext.sharedState.createdGroupId?.value;return r?(await Ae({text:"Preparing navigation...",agentName:"group-creation"},e),await vl({destinationType:"portal-group",groupId:r},e),{}):{}},hm=(t,e)=>e??t,wm=M.Root({..._s(),intentParams:M({reducer:hm,default:()=>({intent:"clarify"})}),createdGroupId:M({reducer:hm,default:()=>""})}),uA=()=>new _e(wm).addNode("detectGroupCreationIntent",oA).addNode("createPortalGroup",tA).addNode("addMembersToPortalGroup",Zx).addNode("suggestCreatedGroupNavigation",lA).addEdge(ge,"detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent",t=>{switch(t.intentParams.intent){case"create":return"createPortalGroup";case"addMembers":return"addMembersToPortalGroup";default:return L}}).addEdge("createPortalGroup","suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup","suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation",L),cA=String.raw`- **portal-group-creation** - Portal group creation assistant:
|
|
436
436
|
- creates a new ArcGIS Portal group for the signed-in user
|
|
437
437
|
- adds users to the newly created group using @mention usernames
|
|
438
438
|
`,dA={id:"portal-group-creation",name:"Portal Group Creation",description:cA,createGraph:uA,workspace:wm},bm="portalDocAssistantMemory",pA=()=>({conversationId:""}),mA=t=>{let e=t?.[bm]?.value;if(!e||typeof e!="object")return pA();let r=e;return{conversationId:typeof r.conversationId=="string"?r.conversationId:""}},fA=t=>({[bm]:{value:t}});async function hA({portal:t,question:e,persona:r,previousConversationId:n,signal:o,skillId:s}){s??="doc_ai_assistant";let a=await gA({portal:t,skillId:s,message:e,options:{context:{kind:"DocAIAssistantRequest",filters:{persona:{persona:r}}},previousConversationId:n,signal:o}});return{reply:yA(a,s),conversationId:a[0]?.conversationId??""}}async function gA({portal:t,skillId:e,message:r,options:n}){let o=`${t.helperServices.aiAssistantServices.url}/skills/${e}/chat`,s={"Content-Type":"application/json",token:Wx.findCredential(t.url)?.token??""},a=await cm(o,{method:"post",body:JSON.stringify({message:r,context:n.context,conversationId:n.previousConversationId}),headers:s,signal:n.signal});if(a.httpStatus!==200)throw new Error(`Doc assistant chat failed (${a.httpStatus})`,{cause:a.data});let i=a.data,u=[i],{conversationId:l,inquiryId:c}=i,p=async(d,g)=>{if(!g)return;await Ml(1e3);let y=await cm(o,{method:"post",body:JSON.stringify({conversationId:l,inquiryId:c,ackSequenceNumber:d}),headers:s,signal:n.signal});if(y.httpStatus!==200)throw new Error(`Doc assistant poll failed (${y.httpStatus})`,{cause:y.data});let w=y.data;u.push(w),await p(w.sequenceNumber,w.hasMore)};return i.hasMore&&await p(i.sequenceNumber,i.hasMore),u}function yA(t,e){switch(e){case"doc_chat":return t.find(r=>r.message!=null)?.message??"";case"doc_ai_assistant":for(let r=t.length-1;r>=0;r-=1){let n=t[r];if(n.context?.kind==="DocAIAssistantContext"){let o=n.context.results?.[0]?.reply;if(o)return o}}return"";default:return To(e)}}var _A=async(t,e)=>{await Ae({text:"Asking documentation assistant...",agentName:"doc-assistant"},e);let r=Lr(t.agentExecutionContext.messages).trim();if(!r)return{status:"success",outputMessage:"Please share your question and I can help with ArcGIS and Portal documentation."};let n=e?.configurable?.context;jr(n);let o=mA(t.agentExecutionContext.sharedState),{reply:s,conversationId:a}=await hA({portal:n.portal,question:r,previousConversationId:o.conversationId||void 0,skillId:"doc_ai_assistant",persona:"developers"});return{status:"success",outputMessage:s.trim()||"I could not retrieve a response from the documentation assistant.",sharedStatePatch:fA({conversationId:a||o.conversationId})}},xm=j(async({groupTitle:t},e)=>{let r=t.trim();if(!r)return null;let n=e?.configurable?.context;jr(n);try{return(await lu(n.portal,{query:`title:${r}`,num:1}))?.results[0]?.id||null}catch(o){return console.error("Error searching for portal group by title:",o),null}},{name:"resolvePortalGroupIdByTitle",description:"Resolves an ArcGIS Portal group title to the best-match group id. Use this when a user references a group by title instead of an explicit group id.",schema:m.object({groupTitle:m.string().describe("The portal group title to resolve to a group id.")})}),Am=j(async({itemTitle:t},e)=>{let r=t.trim();if(!r)return null;let n=e?.configurable?.context;jr(n);let{result:o,error:s}=await du(n.portal,r,{num:1});return s&&console.error("Error searching for portal item by title:",s),o?.results[0]?.id||null},{name:"resolvePortalItemIdByTitle",description:'Resolves an ArcGIS Portal item title to the best-match item id. Use this when a user references an item by title (including hash mentions like #title or #"title with spaces") instead of an explicit item id.',schema:m.object({itemTitle:m.string().describe("The portal item title to resolve to an item id.")})}),Im={"portal-content":{description:"The main content page of the portal.",hints:["My content","Content"],scope:"root"},"portal-content-favorites":{description:"The My favorites view under Content in the portal.",hints:["My favorites","Favorites","Content favorites"],scope:"collection"},"portal-content-group":{description:"The My groups view under Content in the portal.",hints:["Content my groups","My groups content","Group content"],scope:"collection"},"portal-content-living-atlas":{description:"The Living Atlas view under Content in the portal.",hints:["Living Atlas","Content Living Atlas"],scope:"collection"},"portal-content-organization":{description:"The My organization view under Content in the portal.",hints:["My organization content","Organization content","Content organization"],scope:"collection"},"portal-gallery":{description:"The gallery page of the portal.",hints:["Gallery","Featured content","Maps and apps"],scope:"collection"},"portal-group":{description:"A specific group page in the portal.",hints:["Group","group page"],scope:"entity"},"portal-groups":{description:"The groups listing page of the portal.",hints:["My groups","Groups"],scope:"collection"},"portal-groups-featured":{description:"The Featured groups view under Groups in the portal.",hints:["Featured groups","Groups featured"],scope:"collection"},"portal-groups-my":{description:"The My groups view under Groups in the portal.",hints:["My groups","Groups my"],scope:"collection"},"portal-groups-organization":{description:"The My organization's groups view under Groups in the portal.",hints:["Organization's groups","My organization's groups","Groups organization"],scope:"collection"},"portal-item":{description:"A specific item page in the portal.",hints:["Item","item page"],scope:"entity"},"portal-map-viewer":{description:"The Map Viewer app of the portal.",hints:["Map Viewer","Map","Open map"],scope:"entity"},"portal-notebooks":{description:"The Notebooks home page of the portal.",hints:["Notebooks","Notebook home","My notebooks"],scope:"collection"},"portal-scene-viewer":{description:"The Scene Viewer app of the portal.",hints:["Scene Viewer","Scene","3D scene"],scope:"entity"},"portal-settings-security":{description:"The Organization > Settings > Security page of the portal.",hints:["Organization settings","Security","Organization > Settings > Security"],scope:"entity"}},wA=Rl(Im),bA=Object.entries(Im).map(([t,{description:e,hints:r,scope:n}])=>` - ${t}: ${e} (scope: ${n}; hints: ${r.join(", ")})`).join(`
|
|
@@ -468,14 +468,14 @@ Assistant response:
|
|
|
468
468
|
`,gm=m.object({shouldSuggestNavigation:m.boolean().default(!1),destinationType:m.enum(["none",...wA]).default("none"),itemId:m.string().default(""),groupId:m.string().default(""),confidence:m.number().min(0).max(1).default(0)}),AA=async(t,e)=>{await Ae({text:"Extracting navigation intent...",agentName:"doc-assistant"},e);let r=t.outputMessage.trim();if(!r)return{};let n=Lr(t.agentExecutionContext.messages).trim(),o=await Gr.fromTemplate(xA).format({question:n,response:r}),s=await Jr({model:await Ba({modelTier:"default"}),tools:[Am,xm],systemPrompt:o,responseFormat:gm,checkpointer:!0}).invoke({messages:t.agentExecutionContext.messages},e),a=gm.parse(s.structuredResponse??{});if(!a.shouldSuggestNavigation||a.destinationType==="none")return{};let i=IA(a);return i?(await vl(i,e),{}):{}};function IA({destinationType:t,itemId:e,groupId:r}){switch(t){case"portal-content":case"portal-content-favorites":case"portal-content-group":case"portal-content-living-atlas":case"portal-content-organization":case"portal-gallery":case"portal-groups":case"portal-groups-featured":case"portal-groups-my":case"portal-groups-organization":case"portal-map-viewer":case"portal-notebooks":case"portal-scene-viewer":case"portal-settings-security":return{destinationType:t};case"portal-item":return e?{destinationType:"portal-item",itemId:e}:null;case"portal-group":return r?{destinationType:"portal-group",groupId:r}:null;case"none":return null;default:return To(t)}}var vm=M.Root({..._s()}),vA=()=>new _e(vm).addNode("answerDocQuestion",_A).addNode("extractNavigationIntent",AA).addEdge(ge,"answerDocQuestion").addEdge("answerDocQuestion","extractNavigationIntent").addEdge("extractNavigationIntent",L),TA=String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
|
|
469
469
|
- answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
|
|
470
470
|
- acts as a fallback when specialized agents are not applicable
|
|
471
|
-
`,SA={id:"portal-doc-assistant",name:"Portal Doc Assistant",description:TA,createGraph:vA,workspace:vm},Tm=`
|
|
471
|
+
`,SA={id:"portal-doc-assistant",name:"Portal Doc Assistant",description:TA,createGraph:vA,workspace:vm},kA=()=>({latestGroupId:null,memory:{}}),Ka=t=>{let e=t?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;return e?{latestGroupId:e.latestGroupId,memory:e.memory}:kA()},Tm=`
|
|
472
472
|
Shared markdown formatting rules:
|
|
473
473
|
- Use clear markdown headings (##) to separate sections.
|
|
474
474
|
- Use concise bullet points for lists of facts, counts, or signals.
|
|
475
475
|
- Emphasize key metrics with bold labels (for example: **Recent items:** 4).
|
|
476
476
|
- Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
|
|
477
477
|
- Do not include raw internal IDs unless explicitly requested.
|
|
478
|
-
`,
|
|
478
|
+
`,CA=`
|
|
479
479
|
You answer follow-up questions about ArcGIS group analytics.
|
|
480
480
|
|
|
481
481
|
${Tm}
|
|
@@ -500,7 +500,7 @@ Group full context:
|
|
|
500
500
|
|
|
501
501
|
Question:
|
|
502
502
|
{question}
|
|
503
|
-
`,
|
|
503
|
+
`,EA=async(t,e)=>{await Ae({text:"Answering group follow-up...",agentName:"group-analytics"},e);let r=Ka(t),n=t.groupSummaryGroupId??r.latestGroupId,o=n?r.memory[n]:void 0,s=t.groupSummaryQuestion||Lr(t.agentExecutionContext.messages);return o?{status:"success",outputMessage:(await It({promptText:CA,schema:PA,modelTier:"default",inputVariables:{summary:o.summary,question:s,fullContext:JSON.stringify(o.fullContext)}})).answer}:{status:"success",outputMessage:"I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."}},PA=m.object({answer:m.string(),isRelevant:m.boolean()}),OA=`
|
|
504
504
|
Classify the user's request for ArcGIS Portal group analytics.
|
|
505
505
|
|
|
506
506
|
Rules:
|
|
@@ -529,7 +529,7 @@ hasAnalyticsContext:
|
|
|
529
529
|
|
|
530
530
|
User message:
|
|
531
531
|
{userMessage}
|
|
532
|
-
|
|
532
|
+
`,MA=async(t,e)=>{await Ae({text:"Analyzing group-analytics intent...",agentName:"group-analytics"},e);let r=Lr(t.agentExecutionContext.messages),n=!!Ka(t).latestGroupId,o=await Gr.fromTemplate(OA).format({userMessage:r,hasAnalyticsContext:String(n)}),s=await Jr({model:await Ba({modelTier:"fast"}),tools:[xm],systemPrompt:o,responseFormat:RA,checkpointer:!0}).invoke({messages:t.agentExecutionContext.messages},e),{intent:a,groupId:i,question:u}=s.structuredResponse,l=a==="summarize"&&!i,c=a==="followUp"&&!(u??"").trim(),p=a==="clarify"||l||c;return{groupSummaryIntent:p?"clarify":a,groupSummaryGroupId:i||null,groupSummaryQuestion:u||"",status:"success",outputMessage:p?"Please clarify with a group id or title":""}},RA=m.object({intent:m.enum(["summarize","followUp","navigation","clarify"]),groupId:m.string().default(""),question:m.string().default("")}),$A=async(t,e)=>{let r=Ka(t),n=t.groupSummaryGroupId??r.latestGroupId;return await Ae({text:"Preparing navigation...",agentName:"group-analytics"},e),await vl(n?{destinationType:"portal-group",groupId:n}:{destinationType:"portal-groups"},e),{status:"success"}};function Sm({timestamp:t,now:e,windowMs:r}){return t?e-t<=r:!1}var NA=720*60*60*1e3;function zA(t){let e=mu(t);return{id:t.id??"",title:t.title??"",description:t.description??"",snippet:t.snippet??"",access:t.access??null,owner:t.owner??"",tags:t.tags??[],created:t.created?.getTime(),modified:t.modified?.getTime(),isInvitationOnly:t.isInvitationOnly,sourceSignals:{capabilities:fu(t),membershipAccess:hu(t),isOpenData:gu(t),isDistributedCollaborationGroup:yu(t),orgId:e.orgId,hiddenMembers:e.hiddenMembers,isViewOnly:e.isViewOnly,isReadOnly:e.isReadOnly,leavingDisallowed:e.leavingDisallowed}}}async function jA(t){let e={owner:t.owner??"",admins:[],users:[]};try{return await t.fetchMembers()}catch(r){return console.warn("Unable to fetch group members for analytics context",r),e}}function LA(t){return t.map(e=>({id:e.id??"",title:e.title??"Untitled",type:e.type??"Unknown",owner:e.owner??"",created:e.created?.getTime(),modified:e.modified?.getTime()}))}function DA(t,e){return t.filter(r=>r.modified?Sm({timestamp:r.modified,now:e,windowMs:NA}):!1)}function FA(t){let e=new Map;for(let r of t)e.set(r.type,(e.get(r.type)??0)+1);return[...e.entries()].sort((r,n)=>n[1]-r[1]||r[0].localeCompare(n[0])).slice(0,6).map(([r,n])=>({type:r,count:n}))}async function UA(t){let e=await t.queryItems({num:20,sortField:"modified",sortOrder:"desc"}),r=LA(e.results),n=Date.now();return{total:e.total,topItems:r,recentlyModifiedItems:DA(r,n),topItemTypes:FA(r)}}async function qA(t,e){if(!e)return{error:{code:"missingGroupId",message:"Group id is required."}};try{let r=(await t.queryGroups({query:`id:${e}`,num:1})).results[0];if(!r)return{error:{code:"groupNotFound",message:`No group found for id: ${e}`}};let n=zA(r),o=await jA(r),s=await UA(r);return{result:{group:n,members:o,items:s}}}catch(r){return console.error("Error fetching portal group analytics context:",r),{error:{code:"unhandledError"}}}}var BA=`
|
|
533
533
|
You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
|
|
534
534
|
|
|
535
535
|
${Tm}
|
|
@@ -568,11 +568,11 @@ Group context:
|
|
|
568
568
|
|
|
569
569
|
Deterministic signals:
|
|
570
570
|
{deterministicSignals}
|
|
571
|
-
`,xl=(t,e)=>e??t,km=M.Root({..._s(),groupSummaryIntent:M({reducer:xl,default:()=>"clarify"}),groupSummaryGroupId:M({reducer:xl,default:()=>null}),groupSummaryQuestion:M({reducer:xl,default:()=>""})}),VA=()=>new _e(km).addNode("detectGroupSummaryIntent",
|
|
571
|
+
`,KA=2160*60*60*1e3,GA=async(t,e)=>{let r=t.groupSummaryGroupId;if(!r)return{status:"success",outputMessage:'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'};await Ae({text:`Analyzing group ${r}...`,agentName:"group-analytics"},e);let n=e?.configurable?.context;jr(n);let{result:o,error:s}=await qA(n.portal,r);if(s||!o)return await Ae({text:"Failed to fetch group context",agentName:"group-analytics"},e),{status:"success",outputMessage:"Unable to retrieve group context for analytics."};let{group:a,items:i}=o,u=Date.now(),l=a.modified,c=l?Sm({timestamp:l,now:u,windowMs:KA}):!1,p=i.recentlyModifiedItems.length,d=p>0,g=c||d,y=await It({promptText:BA,schema:WA,modelTier:"default",inputVariables:{context:JSON.stringify(o),deterministicSignals:JSON.stringify({isGroupActive:g,isGroupRecentlyModified:c,hasRecentlyAddedOrUpdatedContent:d,recentItemCount:p})}}),{followUpQuestions:w,summary:_}=y,f=Ka(t),A={latestGroupId:r,memory:{...f.memory,[r]:{summary:_,followUpQuestions:w,fullContext:o}}};return w.length&&await qa({type:"suggested-prompts",data:{prompts:w}},e),{status:"success",outputMessage:_,sharedStatePatch:{portalGroupSummaryMemory:{value:A}}}},WA=m.object({summary:m.string(),followUpQuestions:m.array(m.string()).default([])}),xl=(t,e)=>e??t,km=M.Root({..._s(),groupSummaryIntent:M({reducer:xl,default:()=>"clarify"}),groupSummaryGroupId:M({reducer:xl,default:()=>null}),groupSummaryQuestion:M({reducer:xl,default:()=>""})}),VA=()=>new _e(km).addNode("detectGroupSummaryIntent",MA).addNode("summarizePortalGroup",GA).addNode("answerGroupSummaryFollowUp",EA).addNode("suggestGroupSummaryNavigation",$A).addEdge(ge,"detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent",t=>t.groupSummaryIntent==="summarize"?"summarizePortalGroup":t.groupSummaryIntent==="followUp"?"answerGroupSummaryFollowUp":t.groupSummaryIntent==="navigation"?"suggestGroupSummaryNavigation":L).addEdge("summarizePortalGroup",L).addEdge("answerGroupSummaryFollowUp",L).addEdge("suggestGroupSummaryNavigation",L),HA=String.raw`- **portal-group-analytics** - Portal group analytics assistant:
|
|
572
572
|
- summarizes ArcGIS portal groups from group context and sourceJSON details
|
|
573
573
|
- answers follow-up questions grounded in the summarized group
|
|
574
574
|
- suggests navigation to groups when relevant
|
|
575
|
-
`,JA={id:"portal-group-analytics",name:"Portal Group Analytics",description:HA,createGraph:VA,workspace:km},ZA=()=>({latestItemId:null,memory:{}}),Tl=t=>{let e=t?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;return e?{latestItemId:e.latestItemId,memory:e.memory}:ZA()},QA=m.object({intent:m.enum(["summarize","followUp","clarify"]),itemId:m.string().default(""),question:m.string().default("")}),YA=m.object({summary:m.string(),followUpQuestions:m.array(m.string()).default([])}),XA=m.object({answer:m.string(),isRelevant:m.boolean()}),eI
|
|
575
|
+
`,JA={id:"portal-group-analytics",name:"Portal Group Analytics",description:HA,createGraph:VA,workspace:km},ZA=()=>({latestItemId:null,memory:{}}),Tl=t=>{let e=t?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;return e?{latestItemId:e.latestItemId,memory:e.memory}:ZA()},QA=m.object({intent:m.enum(["summarize","followUp","clarify"]),itemId:m.string().default(""),question:m.string().default("")}),YA=m.object({summary:m.string(),followUpQuestions:m.array(m.string()).default([])}),XA=m.object({answer:m.string(),isRelevant:m.boolean()}),eI=`
|
|
576
576
|
You answer follow-up questions about an ArcGIS item.
|
|
577
577
|
|
|
578
578
|
Ground your answer in the provided item context.
|
|
@@ -592,7 +592,7 @@ Item full context
|
|
|
592
592
|
|
|
593
593
|
Question:
|
|
594
594
|
{question}
|
|
595
|
-
`,
|
|
595
|
+
`,tI=async(t,e)=>{await Ae({text:"Answering follow-up...",agentName:"analytics"},e);let r=Tl(t),n=t.analyticsItemId??r.latestItemId,o=n?r.memory[n]:void 0,s=t.analyticsQuestion||Lr(t.agentExecutionContext.messages);return o?{status:"success",outputMessage:(await It({promptText:eI,schema:XA,modelTier:"default",inputVariables:{summary:o.summary,question:s,fullContext:JSON.stringify(o.fullContext)}})).answer}:{status:"success",outputMessage:"I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."}},rI=`
|
|
596
596
|
Classify the user analytics request.
|
|
597
597
|
|
|
598
598
|
Rules:
|
|
@@ -622,7 +622,7 @@ hasSummaryContext:
|
|
|
622
622
|
|
|
623
623
|
User message:
|
|
624
624
|
{userMessage}
|
|
625
|
-
`,
|
|
625
|
+
`,nI=async(t,e)=>{await Ae({text:"Analyzing intent...",agentName:"analytics"},e);let r=Lr(t.agentExecutionContext.messages),n=!!Tl(t).latestItemId,o=await Gr.fromTemplate(rI).format({userMessage:r,hasSummaryContext:String(n)}),s=await Jr({model:await Ba({modelTier:"fast"}),tools:[Am],systemPrompt:o,responseFormat:QA,checkpointer:!0}).invoke({messages:t.agentExecutionContext.messages},e),{intent:a,itemId:i,question:u}=s.structuredResponse,l=a==="clarify"||a==="summarize"&&!i||a==="followUp"&&!u;return{agentExecutionContext:{...t.agentExecutionContext},analyticsIntent:l?"clarify":a,analyticsItemId:i||null,analyticsQuestion:u||"",status:"success",outputMessage:l?'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".':""}},oI=`
|
|
626
626
|
You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
|
|
627
627
|
Summary rules:
|
|
628
628
|
- The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
|
|
@@ -637,7 +637,7 @@ Do not include internal identifiers.
|
|
|
637
637
|
If the user asks for a detailed summary, you may expand the response up to 300 words.
|
|
638
638
|
Item context:
|
|
639
639
|
{context}
|
|
640
|
-
`,Al=(t,e)=>e??t,Cm=M.Root({..._s(),analyticsIntent:M({reducer:Al,default:()=>"clarify"}),analyticsItemId:M({reducer:Al,default:()=>null}),analyticsQuestion:M({reducer:Al,default:()=>""})}),aI=()=>new _e(Cm).addNode("detectAnalyticsIntent",
|
|
640
|
+
`,sI=async(t,e)=>{let r=t.analyticsItemId;if(!r)return{status:"success",outputMessage:'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'};await Ae({text:`Summarizing item ${r}...`,agentName:"analytics"},e);let n=e?.configurable?.context;jr(n);let{portal:o,user:s}=n,{result:a,error:i}=await pu(s,o,r);if(i||!a)return await Ae({text:"Failed to get item context for summarization",agentName:"analytics"},e),{status:"success",outputMessage:"Unable to retrieve item context for summarization."};let{context:u}=a,l=await It({promptText:oI,schema:YA,modelTier:"default",inputVariables:{context:JSON.stringify(u)}}),{followUpQuestions:c,summary:p}=l,d=Tl(t),g={latestItemId:r,memory:{...d.memory,[r]:{summary:p,followUpQuestions:c,fullContext:u}}};return c.length&&await qa({type:"suggested-prompts",data:{prompts:c}},e),{status:"success",outputMessage:p,sharedStatePatch:{portalItemAnalyticsSummaryMemory:{value:g}}}},Al=(t,e)=>e??t,Cm=M.Root({..._s(),analyticsIntent:M({reducer:Al,default:()=>"clarify"}),analyticsItemId:M({reducer:Al,default:()=>null}),analyticsQuestion:M({reducer:Al,default:()=>""})}),aI=()=>new _e(Cm).addNode("detectAnalyticsIntent",nI).addNode("summarizePortalItem",sI).addNode("answerAnalyticsFollowUp",tI).addEdge(ge,"detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent",t=>t.analyticsIntent==="summarize"?"summarizePortalItem":t.analyticsIntent==="followUp"?"answerAnalyticsFollowUp":L).addEdge("summarizePortalItem",L).addEdge("answerAnalyticsFollowUp",L),iI=String.raw`- **portal-item-analytics** - Portal item analytics assistant:
|
|
641
641
|
- answers questions about one specific ArcGIS portal item when item context is present
|
|
642
642
|
- summarizes item details, metadata, and context grounded in that item
|
|
643
643
|
- suggests follow-up prompts grounded in the same item
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as ce}from"./X6N7Y4IA.js";import{a as oe}from"./DFTUMKSN.js";import{a as le}from"./2GBRZSEC.js";import{a as ae}from"./OFDH6CTA.js";import"./BUKOHPY6.js";import"./XQJNAQVO.js";import{M as se,S as ie,h as ne,j as
|
|
3
|
-
]`).replace("lheading",me).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ne=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ge=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ye=/^( {2,}|\\)\n(?!\s*$)/,Xe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,We=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,D).getRegex(),$e=/(?!~)[\p{P}\p{S}]/u,Fe=/(?!~)[\s\p{P}\p{S}]/u,Ue=/(?:[^\s\p{P}\p{S}]|~)/u,Je=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",
|
|
4
|
-
`),t=e.length-1;for(;t>=0&&
|
|
5
|
-
`)}function kt(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function dt(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=n,t++;return s}function fe(r,e,t,s,n){let i=e.href,
|
|
6
|
-
`).map(i=>{let
|
|
2
|
+
import{a as ce}from"./X6N7Y4IA.js";import{a as oe}from"./DFTUMKSN.js";import{a as le}from"./2GBRZSEC.js";import{a as ae}from"./OFDH6CTA.js";import"./BUKOHPY6.js";import"./XQJNAQVO.js";import{M as se,S as ie,h as ne,j as R,w as Q}from"./STZRXY35.js";import"./UZLQALHY.js";function N(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var z=N();function xe(r){z=r}var S={exec:()=>null};function A(r){let e=[];return t=>{let s=Math.max(0,Math.min(3,t-1)),n=e[s];return n||(n=r(s),e[s]=n),n}}function u(r,e=""){let t=typeof r=="string"?r:r.source,s={replace:(n,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(f.caret,"$1"),t=t.replace(n,a),s},getRegex:()=>new RegExp(t,e)};return s}var Le=((r="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+r)}catch{return!1}})(),f={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:r=>new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:A(r=>new RegExp(`^ {0,${r}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:A(r=>new RegExp(`^ {0,${r}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:A(r=>new RegExp(`^ {0,${r}}(?:\`\`\`|~~~)`)),headingBeginRegex:A(r=>new RegExp(`^ {0,${r}}#`)),htmlBeginRegex:A(r=>new RegExp(`^ {0,${r}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:A(r=>new RegExp(`^ {0,${r}}>`))},Ie=/^(?:[ \t]*(?:\n|$))+/,Pe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ve=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,v=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ce=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,G=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,be=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,me=u(be).replace(/bull/g,G).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ee=u(be).replace(/bull/g,G).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),X=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Be=/^[^\n]+/,W=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qe=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",W).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ze=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,G).getRegex(),Z="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",F=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,De=u("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",F).replace("tag",Z).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),we=r=>u(X).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",r).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),Me=we(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Qe=we(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),He=u(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Qe).getRegex(),U={blockquote:He,code:Pe,def:qe,fences:ve,heading:Ce,hr:v,html:De,lheading:me,list:Ze,newline:Ie,paragraph:Me,table:S,text:Be},he=u("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex(),je={...U,lheading:Ee,table:he,paragraph:u(X).replace("hr",v).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",he).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Z).getRegex()},Oe={...U,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",F).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:S,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(X).replace("hr",v).replace("heading",` *#{1,6} *[^
|
|
3
|
+
]`).replace("lheading",me).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Ne=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ge=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ye=/^( {2,}|\\)\n(?!\s*$)/,Xe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,J=/[^\s\p{P}\p{S}]/u,We=u(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,D).getRegex(),$e=/(?!~)[\p{P}\p{S}]/u,Fe=/(?!~)[\s\p{P}\p{S}]/u,Ue=/(?:[^\s\p{P}\p{S}]|~)/u,Je=u(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Le?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Re=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ke=u(Re,"u").replace(/punct/g,_).getRegex(),Ve=u(Re,"u").replace(/punct/g,$e).getRegex(),Se="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ye=u(Se,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),et=u(Se,"gu").replace(/notPunctSpace/g,Ue).replace(/punctSpace/g,Fe).replace(/punct/g,$e).getRegex(),tt=u("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),rt=u(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_).getRegex(),nt="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",st=u(nt,"gu").replace(/notPunctSpace/g,J).replace(/punctSpace/g,D).replace(/punct/g,_).getRegex(),it=u(/\\(punct)/,"gu").replace(/punct/g,_).getRegex(),lt=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),at=u(F).replace("(?:-->|$)","-->").getRegex(),ot=u("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",at).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),E=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ct=u(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",E).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Te=u(/^!?\[(label)\]\[(ref)\]/).replace("label",E).replace("ref",W).getRegex(),ze=u(/^!?\[(ref)\](?:\[\])?/).replace("ref",W).getRegex(),ht=u("reflink|nolink(?!\\()","g").replace("reflink",Te).replace("nolink",ze).getRegex(),pe=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,K={_backpedal:S,anyPunctuation:it,autolink:lt,blockSkip:Je,br:ye,code:Ge,del:S,delLDelim:S,delRDelim:S,emStrongLDelim:Ke,emStrongRDelimAst:Ye,emStrongRDelimUnd:tt,escape:Ne,link:ct,nolink:ze,punctuation:We,reflink:Te,reflinkSearch:ht,tag:ot,text:Xe,url:S},pt={...K,link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",E).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",E).getRegex()},H={...K,emStrongRDelimAst:et,emStrongLDelim:Ve,delLDelim:rt,delRDelim:st,url:u(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",pe).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",pe).getRegex()},ut={...H,br:u(ye).replace("{2,}","*").getRegex(),text:u(H.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},C={normal:U,gfm:je,pedantic:Oe},I={normal:K,gfm:H,breaks:ut,pedantic:pt},gt={"&":"&","<":"<",">":">",'"':""","'":"'"},ue=r=>gt[r];function w(r,e){if(e){if(f.escapeTest.test(r))return r.replace(f.escapeReplace,ue)}else if(f.escapeTestNoEncode.test(r))return r.replace(f.escapeReplaceNoEncode,ue);return r}function ge(r){try{r=encodeURI(r).replace(f.percentDecode,"%")}catch{return null}return r}function ke(r,e){let t=r.replace(f.findPipe,(i,a,l)=>{let o=!1,c=a;for(;--c>=0&&l[c]==="\\";)o=!o;return o?"|":" |"}),s=t.split(f.splitPipe),n=0;if(s[0].trim()||s.shift(),s.length>0&&!s.at(-1)?.trim()&&s.pop(),e)if(s.length>e)s.splice(e);else for(;s.length<e;)s.push("");for(;n<s.length;n++)s[n]=s[n].trim().replace(f.slashPipe,"|");return s}function $(r,e,t){let s=r.length;if(s===0)return"";let n=0;for(;n<s;){let i=r.charAt(s-n-1);if(i===e&&!t)n++;else if(i!==e&&t)n++;else break}return r.slice(0,s-n)}function de(r){let e=r.split(`
|
|
4
|
+
`),t=e.length-1;for(;t>=0&&f.blankLine.test(e[t]);)t--;return e.length-t<=2?r:e.slice(0,t+1).join(`
|
|
5
|
+
`)}function kt(r,e){if(r.indexOf(e[1])===-1)return-1;let t=0;for(let s=0;s<r.length;s++)if(r[s]==="\\")s++;else if(r[s]===e[0])t++;else if(r[s]===e[1]&&(t--,t<0))return s;return t>0?-2:-1}function dt(r,e=0){let t=e,s="";for(let n of r)if(n===" "){let i=4-t%4;s+=" ".repeat(i),t+=i}else s+=n,t++;return s}function fe(r,e,t,s,n){let i=e.href,a=e.title||null,l=r[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:r[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:a,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}function ft(r,e,t){let s=r.match(t.other.indentCodeCompensation);if(s===null)return e;let n=s[1];return e.split(`
|
|
6
|
+
`).map(i=>{let a=i.match(t.other.beginningSpace);if(a===null)return i;let[l]=a;return l.length>=n.length?i.slice(n.length):i}).join(`
|
|
7
7
|
`)}var B=class{options;rules;lexer;constructor(r){this.options=r||z}space(r){let e=this.rules.block.newline.exec(r);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(r){let e=this.rules.block.code.exec(r);if(e){let t=this.options.pedantic?e[0]:de(e[0]),s=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:s}}}fences(r){let e=this.rules.block.fences.exec(r);if(e){let t=e[0],s=ft(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:s}}}heading(r){let e=this.rules.block.heading.exec(r);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let s=$(t,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(t=s.trim())}return{type:"heading",raw:$(e[0],`
|
|
8
8
|
`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(r){let e=this.rules.block.hr.exec(r);if(e)return{type:"hr",raw:$(e[0],`
|
|
9
9
|
`)}}blockquote(r){let e=this.rules.block.blockquote.exec(r);if(e){let t=$(e[0],`
|
|
10
10
|
`).split(`
|
|
11
|
-
`),s="",n="",i=[];for(;t.length>0;){let
|
|
12
|
-
`),p=
|
|
11
|
+
`),s="",n="",i=[];for(;t.length>0;){let a=!1,l=[],o;for(o=0;o<t.length;o++)if(this.rules.other.blockquoteStart.test(t[o]))l.push(t[o]),a=!0;else if(!a)l.push(t[o]);else break;t=t.slice(o);let c=l.join(`
|
|
12
|
+
`),p=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
13
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
14
|
-
${
|
|
15
|
-
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=h,t.length===0)break;let g=i.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let
|
|
14
|
+
${c}`:c,n=n?`${n}
|
|
15
|
+
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=h,t.length===0)break;let g=i.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){let x=g,d=x.raw+`
|
|
16
16
|
`+t.join(`
|
|
17
|
-
`),y=this.blockquote(d);i[i.length-1]=y,s=s.substring(0,s.length-
|
|
17
|
+
`),y=this.blockquote(d);i[i.length-1]=y,s=s.substring(0,s.length-x.raw.length)+y.raw,n=n.substring(0,n.length-x.text.length)+y.text;break}else if(g?.type==="list"){let x=g,d=x.raw+`
|
|
18
18
|
`+t.join(`
|
|
19
|
-
`),y=this.list(d);i[i.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,n=n.substring(0,n.length-
|
|
20
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),
|
|
19
|
+
`),y=this.list(d);i[i.length-1]=y,s=s.substring(0,s.length-g.raw.length)+y.raw,n=n.substring(0,n.length-x.raw.length)+y.raw,t=d.substring(i.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:n}}}list(r){let e=this.rules.block.list.exec(r);if(e){let t=e[1].trim(),s=t.length>1,n={type:"list",raw:"",ordered:s,start:s?+t.slice(0,-1):"",loose:!1,items:[]};t=s?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=s?t:"[*+-]");let i=this.rules.other.listItemRegex(t),a=!1;for(;r;){let o=!1,c="",p="";if(!(e=i.exec(r))||this.rules.block.hr.test(r))break;c=e[0],r=r.substring(c.length);let h=dt(e[2].split(`
|
|
21
21
|
`,1)[0],e[1].length),g=r.split(`
|
|
22
|
-
`,1)[0],
|
|
23
|
-
`,r=r.substring(g.length+1),
|
|
24
|
-
`,1)[0],
|
|
25
|
-
`+
|
|
26
|
-
`+g}
|
|
27
|
-
`,r=r.substring(M.length+1),h=
|
|
22
|
+
`,1)[0],x=!h.trim(),d=0;if(this.options.pedantic?(d=2,p=h.trimStart()):x?d=e[1].length+1:(d=h.search(this.rules.other.nonSpaceChar),d=d>4?1:d,p=h.slice(d),d+=e[1].length),x&&this.rules.other.blankLine.test(g)&&(c+=g+`
|
|
23
|
+
`,r=r.substring(g.length+1),o=!0),!o){let y=this.rules.other.nextBulletRegex(d),ee=this.rules.other.hrRegex(d),te=this.rules.other.fencesBeginRegex(d),re=this.rules.other.headingBeginRegex(d),Ae=this.rules.other.htmlBeginRegex(d),_e=this.rules.other.blockquoteBeginRegex(d);for(;r;){let M=r.split(`
|
|
24
|
+
`,1)[0],L;if(g=M,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),L=g):L=g.replace(this.rules.other.tabCharGlobal," "),te.test(g)||re.test(g)||Ae.test(g)||_e.test(g)||y.test(g)||ee.test(g))break;if(L.search(this.rules.other.nonSpaceChar)>=d||!g.trim())p+=`
|
|
25
|
+
`+L.slice(d);else{if(x||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(h)||re.test(h)||ee.test(h))break;p+=`
|
|
26
|
+
`+g}x=!g.trim(),c+=M+`
|
|
27
|
+
`,r=r.substring(M.length+1),h=L.slice(d)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0)),n.items.push({type:"list_item",raw:c,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),n.raw+=c}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let o of n.items){this.lexer.state.top=!1,o.tokens=this.lexer.blockTokens(o.text,[]);let c=o.tokens[0];if(o.task&&(c?.type==="text"||c?.type==="paragraph")){o.text=o.text.replace(this.rules.other.listReplaceTask,""),c.raw=c.raw.replace(this.rules.other.listReplaceTask,""),c.text=c.text.replace(this.rules.other.listReplaceTask,"");for(let h=this.lexer.inlineQueue.length-1;h>=0;h--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[h].src)){this.lexer.inlineQueue[h].src=this.lexer.inlineQueue[h].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(o.raw);if(p){let h={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};o.checked=h.checked,n.loose?o.tokens[0]&&["paragraph","text"].includes(o.tokens[0].type)&&"tokens"in o.tokens[0]&&o.tokens[0].tokens?(o.tokens[0].raw=h.raw+o.tokens[0].raw,o.tokens[0].text=h.raw+o.tokens[0].text,o.tokens[0].tokens.unshift(h)):o.tokens.unshift({type:"paragraph",raw:h.raw,text:h.raw,tokens:[h]}):o.tokens.unshift(h)}}else o.task&&(o.task=!1);if(!n.loose){let p=o.tokens.filter(g=>g.type==="space"),h=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));n.loose=h}}if(n.loose)for(let o of n.items){o.loose=!0;for(let c of o.tokens)c.type==="text"&&(c.type="paragraph")}return n}}html(r){let e=this.rules.block.html.exec(r);if(e){let t=de(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(r){let e=this.rules.block.def.exec(r);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:$(e[0],`
|
|
28
28
|
`),href:s,title:n}}}table(r){let e=this.rules.block.table.exec(r);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=ke(e[1]),s=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
29
29
|
`):[],i={type:"table",raw:$(e[0],`
|
|
30
|
-
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let
|
|
30
|
+
`),header:[],align:[],rows:[]};if(t.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<t.length;a++)i.header.push({text:t[a],tokens:this.lexer.inline(t[a]),header:!0,align:i.align[a]});for(let a of n)i.rows.push(ke(a,i.header.length).map((l,o)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[o]})));return i}}lheading(r){let e=this.rules.block.lheading.exec(r);if(e){let t=e[1].trim();return{type:"heading",raw:$(e[0],`
|
|
31
31
|
`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(r){let e=this.rules.block.paragraph.exec(r);if(e){let t=e[1].charAt(e[1].length-1)===`
|
|
32
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=$(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=kt(e[2],"()");if(i===-2)return;if(i>-1){let
|
|
33
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(
|
|
34
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let
|
|
32
|
+
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(r){let e=this.rules.block.text.exec(r);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(r){let e=this.rules.inline.escape.exec(r);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(r){let e=this.rules.inline.tag.exec(r);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(r){let e=this.rules.inline.link.exec(r);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let i=$(t.slice(0,-1),"\\");if((t.length-i.length)%2===0)return}else{let i=kt(e[2],"()");if(i===-2)return;if(i>-1){let a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let s=e[2],n="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],n=i[3])}else n=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?s=s.slice(1):s=s.slice(1,-1)),fe(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(r,e){let t;if((t=this.rules.inline.reflink.exec(r))||(t=this.rules.inline.nolink.exec(r))){let s=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=e[s.toLowerCase()];if(!n){let i=t[0].charAt(0);return{type:"text",raw:i,text:i}}return fe(t,n,t[0],this.lexer,this.rules)}}emStrong(r,e,t=""){let s=this.rules.inline.emStrongLDelim.exec(r);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,a,l=n,o=0,c=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,e=e.slice(-1*r.length+n);(s=c.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i)continue;if(a=[...i].length,s[3]||s[4]){l+=a;continue}else if((s[5]||s[6])&&n%3&&!((n+a)%3)){o+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+o);let p=[...s[0]][0].length,h=r.slice(0,n+s.index+p+a);if(Math.min(n,a)%2){let x=h.slice(1,-1);return{type:"em",raw:h,text:x,tokens:this.lexer.inlineTokens(x)}}let g=h.slice(2,-2);return{type:"strong",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(r){let e=this.rules.inline.code.exec(r);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(t),n=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return s&&n&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(r){let e=this.rules.inline.br.exec(r);if(e)return{type:"br",raw:e[0]}}del(r,e,t=""){let s=this.rules.inline.delLDelim.exec(r);if(s&&(!s[1]||!t||this.rules.inline.punctuation.exec(t))){let n=[...s[0]].length-1,i,a,l=n,o=this.rules.inline.delRDelim;for(o.lastIndex=0,e=e.slice(-1*r.length+n);(s=o.exec(e))!==null;){if(i=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!i||(a=[...i].length,a!==n))continue;if(s[3]||s[4]){l+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l);let c=[...s[0]][0].length,p=r.slice(0,n+s.index+c+a),h=p.slice(n,-n);return{type:"del",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}autolink(r){let e=this.rules.inline.autolink.exec(r);if(e){let t,s;return e[2]==="@"?(t=e[1],s="mailto:"+t):(t=e[1],s=t),{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}url(r){let e;if(e=this.rules.inline.url.exec(r)){let t,s;if(e[2]==="@")t=e[0],s="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:t,href:s,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(r){let e=this.rules.inline.text.exec(r);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}},b=class j{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||z,this.options.tokenizer=this.options.tokenizer||new B,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:f,block:C.normal,inline:I.normal};this.options.pedantic?(t.block=C.pedantic,t.inline=I.pedantic):this.options.gfm&&(t.block=C.gfm,this.options.breaks?t.inline=I.breaks:t.inline=I.gfm),this.tokenizer.rules=t}static get rules(){return{block:C,inline:I}}static lex(e,t){return new j(t).lex(e)}static lexInline(e,t){return new j(t).inlineTokens(e)}lex(e){e=e.replace(f.carriageReturn,`
|
|
33
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let s=this.inlineQueue[t];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],s=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(f.tabCharGlobal," ").replace(f.spaceLine,""));let n=1/0;for(;e;){if(e.length<n)n=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(l=>(i=l.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let l=t.at(-1);i.raw.length===1&&l!==void 0?l.raw+=`
|
|
34
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
35
35
|
`)?"":`
|
|
36
|
-
`)+i.raw,
|
|
37
|
-
`+i.text,this.inlineQueue.at(-1).src=
|
|
36
|
+
`)+i.raw,l.text+=`
|
|
37
|
+
`+i.text,this.inlineQueue.at(-1).src=l.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let l=t.at(-1);l?.type==="paragraph"||l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
38
38
|
`)?"":`
|
|
39
|
-
`)+i.raw,
|
|
40
|
-
`+i.raw,this.inlineQueue.at(-1).src=
|
|
39
|
+
`)+i.raw,l.text+=`
|
|
40
|
+
`+i.raw,this.inlineQueue.at(-1).src=l.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let l=1/0,o=e.slice(1),c;this.options.extensions.startBlock.forEach(p=>{c=p.call({lexer:this},o),typeof c=="number"&&c>=0&&(l=Math.min(l,c))}),l<1/0&&l>=0&&(a=e.substring(0,l+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let l=t.at(-1);s&&l?.type==="paragraph"?(l.raw+=(l.raw.endsWith(`
|
|
41
41
|
`)?"":`
|
|
42
|
-
`)+i.raw,
|
|
43
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
42
|
+
`)+i.raw,l.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(i),s=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let l=t.at(-1);l?.type==="text"?(l.raw+=(l.raw.endsWith(`
|
|
44
44
|
`)?"":`
|
|
45
|
-
`)+i.raw,
|
|
46
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
45
|
+
`)+i.raw,l.text+=`
|
|
46
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=l.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let s=e;if(this.tokens.links){let l=Object.keys(this.tokens.links);l.length>0&&(s=s.replace(this.tokenizer.rules.inline.reflinkSearch,o=>l.includes(o.slice(o.lastIndexOf("[")+1,-1))?"["+"a".repeat(o.length-2)+"]":o))}s=s.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),s=s.replace(this.tokenizer.rules.inline.blockSkip,(l,o,c)=>{let p=c?c.length:0;return l.slice(0,p)+"["+"a".repeat(l.length-p-2)+"]"}),s=this.options.hooks?.emStrongMask?.call({lexer:this},s)??s;let n=!1,i="",a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}n||(i=""),n=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=t.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,s,i)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e,s,i)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let o=e;if(this.options.extensions?.startInline){let c=1/0,p=e.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(o=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(o)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(i=l.raw.slice(-1)),n=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):t.push(l);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},q=class{options;parser;constructor(r){this.options=r||z}space(r){return""}code({text:r,lang:e,escaped:t}){let s=(e||"").match(f.notSpaceStart)?.[0],n=r.replace(f.endingNewline,"")+`
|
|
47
47
|
`;return s?'<pre><code class="language-'+w(s)+'">'+(t?n:w(n,!0))+`</code></pre>
|
|
48
48
|
`:"<pre><code>"+(t?n:w(n,!0))+`</code></pre>
|
|
49
49
|
`}blockquote({tokens:r}){return`<blockquote>
|
|
50
50
|
${this.parser.parse(r)}</blockquote>
|
|
51
51
|
`}html({text:r}){return r}def(r){return""}heading({tokens:r,depth:e}){return`<h${e}>${this.parser.parseInline(r)}</h${e}>
|
|
52
52
|
`}hr(r){return`<hr>
|
|
53
|
-
`}list(r){let e=r.ordered,t=r.start,s="";for(let
|
|
53
|
+
`}list(r){let e=r.ordered,t=r.start,s="";for(let a=0;a<r.items.length;a++){let l=r.items[a];s+=this.listitem(l)}let n=e?"ol":"ul",i=e&&t!==1?' start="'+t+'"':"";return"<"+n+i+`>
|
|
54
54
|
`+s+"</"+n+`>
|
|
55
55
|
`}listitem(r){return`<li>${this.parser.parse(r.tokens)}</li>
|
|
56
56
|
`}checkbox({checked:r}){return"<input "+(r?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:r}){return`<p>${this.parser.parseInline(r)}</p>
|
|
57
|
-
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let
|
|
57
|
+
`}table(r){let e="",t="";for(let n=0;n<r.header.length;n++)t+=this.tablecell(r.header[n]);e+=this.tablerow({text:t});let s="";for(let n=0;n<r.rows.length;n++){let i=r.rows[n];t="";for(let a=0;a<i.length;a++)t+=this.tablecell(i[a]);s+=this.tablerow({text:t})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
58
58
|
<thead>
|
|
59
59
|
`+e+`</thead>
|
|
60
60
|
`+s+`</table>
|
|
61
61
|
`}tablerow({text:r}){return`<tr>
|
|
62
62
|
${r}</tr>
|
|
63
63
|
`}tablecell(r){let e=this.parser.parseInline(r.tokens),t=r.header?"th":"td";return(r.align?`<${t} align="${r.align}">`:`<${t}>`)+e+`</${t}>
|
|
64
|
-
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=ge(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=ge(r);if(n===null)return w(t);r=n;let i=`<img src="${r}" alt="${w(t)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},V=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||z,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new V}static parse(e,t){return new O(t).parse(e)}static parseInline(e,t){return new O(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let
|
|
65
|
-
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},T=new xt;function k(r,e){return T.parse(r,e)}k.options=k.setOptions=function(r){return T.setOptions(r),k.defaults=T.defaults,xe(k.defaults),k};k.getDefaults=N;k.defaults=z;k.use=function(...r){return T.use(...r),k.defaults=T.defaults,xe(k.defaults),k};k.walkTokens=function(r,e){return T.walkTokens(r,e)};k.parseInline=T.parseInline;k.Parser=m;k.parser=m.parse;k.Renderer=q;k.TextRenderer=V;k.Lexer=b;k.lexer=b.lex;k.Tokenizer=B;k.Hooks=P;k.parse=k;var wt=k.options,yt=k.setOptions,$t=k.use,
|
|
64
|
+
`}strong({tokens:r}){return`<strong>${this.parser.parseInline(r)}</strong>`}em({tokens:r}){return`<em>${this.parser.parseInline(r)}</em>`}codespan({text:r}){return`<code>${w(r,!0)}</code>`}br(r){return"<br>"}del({tokens:r}){return`<del>${this.parser.parseInline(r)}</del>`}link({href:r,title:e,tokens:t}){let s=this.parser.parseInline(t),n=ge(r);if(n===null)return s;r=n;let i='<a href="'+r+'"';return e&&(i+=' title="'+w(e)+'"'),i+=">"+s+"</a>",i}image({href:r,title:e,text:t,tokens:s}){s&&(t=this.parser.parseInline(s,this.parser.textRenderer));let n=ge(r);if(n===null)return w(t);r=n;let i=`<img src="${r}" alt="${w(t)}"`;return e&&(i+=` title="${w(e)}"`),i+=">",i}text(r){return"tokens"in r&&r.tokens?this.parser.parseInline(r.tokens):"escaped"in r&&r.escaped?r.text:w(r.text)}},V=class{strong({text:r}){return r}em({text:r}){return r}codespan({text:r}){return r}del({text:r}){return r}html({text:r}){return r}text({text:r}){return r}link({text:r}){return""+r}image({text:r}){return""+r}br(){return""}checkbox({raw:r}){return r}},m=class O{options;renderer;textRenderer;constructor(e){this.options=e||z,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new V}static parse(e,t){return new O(t).parse(e)}static parseInline(e,t){return new O(t).parseInline(e)}parse(e){this.renderer.parser=this;let t="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(a.type)){t+=l||"";continue}}let i=n;switch(i.type){case"space":{t+=this.renderer.space(i);break}case"hr":{t+=this.renderer.hr(i);break}case"heading":{t+=this.renderer.heading(i);break}case"code":{t+=this.renderer.code(i);break}case"table":{t+=this.renderer.table(i);break}case"blockquote":{t+=this.renderer.blockquote(i);break}case"list":{t+=this.renderer.list(i);break}case"checkbox":{t+=this.renderer.checkbox(i);break}case"html":{t+=this.renderer.html(i);break}case"def":{t+=this.renderer.def(i);break}case"paragraph":{t+=this.renderer.paragraph(i);break}case"text":{t+=this.renderer.text(i);break}default:{let a='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let s="";for(let n=0;n<e.length;n++){let i=e[n];if(this.options.extensions?.renderers?.[i.type]){let l=this.options.extensions.renderers[i.type].call({parser:this},i);if(l!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){s+=l||"";continue}}let a=i;switch(a.type){case"escape":{s+=t.text(a);break}case"html":{s+=t.html(a);break}case"link":{s+=t.link(a);break}case"image":{s+=t.image(a);break}case"checkbox":{s+=t.checkbox(a);break}case"strong":{s+=t.strong(a);break}case"em":{s+=t.em(a);break}case"codespan":{s+=t.codespan(a);break}case"br":{s+=t.br(a);break}case"del":{s+=t.del(a);break}case"text":{s+=t.text(a);break}default:{let l='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return s}},P=class{options;block;constructor(r){this.options=r||z}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(r){return r}postprocess(r){return r}processAllTokens(r){return r}emStrongMask(r){return r}provideLexer(r=this.block){return r?b.lex:b.lexInline}provideParser(r=this.block){return r?m.parse:m.parseInline}},xt=class{defaults=N();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=m;Renderer=q;TextRenderer=V;Lexer=b;Tokenizer=B;Hooks=P;constructor(...r){this.use(...r)}walkTokens(r,e){let t=[];for(let s of r)switch(t=t.concat(e.call(this,s)),s.type){case"table":{let n=s;for(let i of n.header)t=t.concat(this.walkTokens(i.tokens,e));for(let i of n.rows)for(let a of i)t=t.concat(this.walkTokens(a.tokens,e));break}case"list":{let n=s;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(i=>{let a=n[i].flat(1/0);t=t.concat(this.walkTokens(a,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...r){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return r.forEach(t=>{let s={...t};if(s.async=this.defaults.async||s.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let i=e.renderers[n.name];i?e.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=i.apply(this,a)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[n.level];i?i.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),s.extensions=e),t.renderer){let n=this.defaults.renderer||new q(this.defaults);for(let i in t.renderer){if(!(i in n))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,l=t.renderer[a],o=n[a];n[a]=(...c)=>{let p=l.apply(n,c);return p===!1&&(p=o.apply(n,c)),p||""}}s.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new B(this.defaults);for(let i in t.tokenizer){if(!(i in n))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,l=t.tokenizer[a],o=n[a];n[a]=(...c)=>{let p=l.apply(n,c);return p===!1&&(p=o.apply(n,c)),p}}s.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new P;for(let i in t.hooks){if(!(i in n))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,l=t.hooks[a],o=n[a];P.passThroughHooks.has(i)?n[a]=c=>{if(this.defaults.async&&P.passThroughHooksRespectAsync.has(i))return(async()=>{let h=await l.call(n,c);return o.call(n,h)})();let p=l.call(n,c);return o.call(n,p)}:n[a]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(n,c);return h===!1&&(h=await o.apply(n,c)),h})();let p=l.apply(n,c);return p===!1&&(p=o.apply(n,c)),p}}s.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,i=t.walkTokens;s.walkTokens=function(a){let l=[];return l.push(i.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(r){return this.defaults={...this.defaults,...r},this}lexer(r,e){return b.lex(r,e??this.defaults)}parser(r,e){return m.parse(r,e??this.defaults)}parseMarkdown(r){return(e,t)=>{let s={...t},n={...this.defaults,...s},i=this.onError(!!n.silent,!!n.async);if(this.defaults.async===!0&&s.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=r),n.async)return(async()=>{let a=n.hooks?await n.hooks.preprocess(e):e,l=await(n.hooks?await n.hooks.provideLexer(r):r?b.lex:b.lexInline)(a,n),o=n.hooks?await n.hooks.processAllTokens(l):l;n.walkTokens&&await Promise.all(this.walkTokens(o,n.walkTokens));let c=await(n.hooks?await n.hooks.provideParser(r):r?m.parse:m.parseInline)(o,n);return n.hooks?await n.hooks.postprocess(c):c})().catch(i);try{n.hooks&&(e=n.hooks.preprocess(e));let a=(n.hooks?n.hooks.provideLexer(r):r?b.lex:b.lexInline)(e,n);n.hooks&&(a=n.hooks.processAllTokens(a)),n.walkTokens&&this.walkTokens(a,n.walkTokens);let l=(n.hooks?n.hooks.provideParser(r):r?m.parse:m.parseInline)(a,n);return n.hooks&&(l=n.hooks.postprocess(l)),l}catch(a){return i(a)}}}onError(r,e){return t=>{if(t.message+=`
|
|
65
|
+
Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error occurred:</p><pre>"+w(t.message+"",!0)+"</pre>";return e?Promise.resolve(s):s}if(e)return Promise.reject(t);throw t}}},T=new xt;function k(r,e){return T.parse(r,e)}k.options=k.setOptions=function(r){return T.setOptions(r),k.defaults=T.defaults,xe(k.defaults),k};k.getDefaults=N;k.defaults=z;k.use=function(...r){return T.use(...r),k.defaults=T.defaults,xe(k.defaults),k};k.walkTokens=function(r,e){return T.walkTokens(r,e)};k.parseInline=T.parseInline;k.Parser=m;k.parser=m.parse;k.Renderer=q;k.TextRenderer=V;k.Lexer=b;k.lexer=b.lex;k.Tokenizer=B;k.Hooks=P;k.parse=k;var wt=k.options,yt=k.setOptions,$t=k.use,Rt=k.walkTokens,St=k.parseInline;var Tt=m.parse,zt=b.lex;var bt=ne`.interrupt-container{display:flex;flex-direction:column;gap:.75rem}.interrupt-actions{display:flex;justify-content:flex-end;gap:.5rem}.interrupt-message{white-space:normal}.interrupt-message :where(p){margin:0}.interrupt-message :where(ul,ol){margin:0;padding-inline-start:1.25rem}`;k.use({gfm:!0,breaks:!0,async:!1});var mt=new oe,Y=class extends se{constructor(){super(...arguments),this.#e=[],this._messages=ae({blocking:!0}),this.arcgisCancel=Q(),this.arcgisSubmit=Q()}static{this.properties={type:1,message:1,options:0}}static{this.styles=bt}#e;_renderMessageContent(){let e=this.message??"",t=k.parse(e,{async:!1});return mt.sanitize(t)}_renderInterruptInput(){let{_messages:e,type:t,options:s}=this;switch(t){case"single-select":return R`<calcite-list class="interrupt-list" .label=${e.singleSelectLabel} selection-mode=single-persist @calciteListChange=${n=>this.#e=n.target.selectedItems[0]?.value}>${s?.map(n=>R`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"multi-select":return R`<calcite-list class="interrupt-list" .label=${e.multiSelectLabel} selection-mode=multiple @calciteListChange=${n=>this.#e=n.target.selectedItems.map(i=>i.value)}>${s?.map(n=>R`<calcite-list-item .label=${n} .value=${n}></calcite-list-item>`)}</calcite-list>`;case"text-input":return R`<calcite-input class="interrupt-input" .label=${e.textInputLabel} @calciteInputInput=${n=>this.#e=n.target.value}></calcite-input>`;case"boolean-choice":return null;default:return le(t)}}render(){let{_messages:e,type:t}=this,s=t==="boolean-choice";return R`<div class="interrupt-container"><calcite-notice open kind=neutral width=full><div slot=title>${s?e.titleConfirm:e.titleInput}</div><div slot=message class="interrupt-message">${ce(this._renderMessageContent())}</div></calcite-notice>${this._renderInterruptInput()}<div class="interrupt-actions"><calcite-button appearance=outline @click=${()=>this.arcgisCancel.emit()}>${s?e.cancelButton:e.skipButton}</calcite-button><calcite-button appearance=solid @click=${()=>this.arcgisSubmit.emit(t==="boolean-choice"?!0:this.#e)}>${s?e.confirmButton:e.submitButton}</calcite-button></div></div>`}};ie("arcgis-portal-ai-assistant-interrupt",Y);export{Y as ArcgisPortalAiAssistantInterrupt};
|