rhua-chatgpt-web 1.1.6 → 1.1.7
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/{api_chain-CKT4Ohw8.js → api_chain-8rLd0TuD.js} +2 -2
- package/dist/{api_chain-N6cO3Z7A.cjs → api_chain-DBmoQA_7.cjs} +1 -1
- package/dist/{combine_docs_chain--Y7d6aSy.js → combine_docs_chain-BH4-g2GW.js} +2 -2
- package/dist/{combine_docs_chain-BNJxb0Gs.cjs → combine_docs_chain-DfTwsFo0.cjs} +1 -1
- package/dist/{few_shot-ChC8aH8b.js → few_shot-DJCpSBvt.js} +1 -1
- package/dist/{few_shot-CDBqI2Ys.cjs → few_shot-DQaRrbJw.cjs} +1 -1
- package/dist/{index-u8vlzCLe.js → index-BAXNGSXw.js} +1 -1
- package/dist/{index-0kEbYI8E.js → index-BDxCvrgc.js} +1 -1
- package/dist/{index-BL6aXvwq.cjs → index-BQO11CzB.cjs} +1 -1
- package/dist/index-B_x2i-jO.js +4 -0
- package/dist/{index-zAP0Ll9a.js → index-BaQU1IvP.js} +229 -17
- package/dist/index-C8LQxWL1.js +4 -0
- package/dist/{index-zo6xsYrJ.js → index-CD6GBfkZ.js} +1 -1
- package/dist/{index-B78sVP5R.cjs → index-CFln1NC2.cjs} +1 -1
- package/dist/{index-CosWt-S3.cjs → index-CUnp2vsA.cjs} +1 -1
- package/dist/{index-DjJb_SAb.js → index-CXpHNR4F.js} +1 -1
- package/dist/index-CYDd-qnF.js +4 -0
- package/dist/{index-BoVswZfB.cjs → index-CvCPvUjj.cjs} +1 -1
- package/dist/{index-vZBjPhbn.cjs → index-DFYcGKuT.cjs} +11 -11
- package/dist/index-DH4SzrZB.js +4 -0
- package/dist/{index-By0Xo-m7.cjs → index-DRg4CNkS.cjs} +1 -1
- package/dist/{index-Bd66L2W0.js → index-Dy-SzFud.js} +2 -2
- package/dist/{index-CFuOi4iF.cjs → index-FAGD8ZFV.cjs} +1 -1
- package/dist/{index-DkxD2k9x.js → index-GSRYlXZ2.js} +1 -1
- package/dist/{index-Cfepbmtj.cjs → index-PQbFNXZe.cjs} +1 -1
- package/dist/{index-B8ZRW_yr.cjs → index-VviEQjAE.cjs} +1 -1
- package/dist/{index-DyXL0CeE.js → index-Wbrx5M_5.js} +2 -2
- package/dist/{index-CIYMf0qL.cjs → index-faFDPW0m.cjs} +1 -1
- package/dist/{index-BllBfWMm.cjs → index-jiGOdiuu.cjs} +1 -1
- package/dist/{index-BLUkF_Fj.cjs → index-xDEsnKsG.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-B2TKMjj8.cjs → index.es-DUhQYmQQ.cjs} +3 -3
- package/dist/{index.es-mYp333HK.js → index.es-Ofj7pWXh.js} +60 -59
- package/dist/index.esm.js +6 -5
- package/dist/{llm_chain-EOU4-N68.js → llm_chain-D_TCnPCU.js} +1 -1
- package/dist/{llm_chain-Ccdciq6f.cjs → llm_chain-uxhdn-1W.cjs} +1 -1
- package/dist/{sequential_chain-YncpdH_1.js → sequential_chain-BIzQ7CWb.js} +1 -1
- package/dist/{sequential_chain-B7gSmAiJ.cjs → sequential_chain-CMYssdOR.cjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/{vector_db_qa-CldcVkud.cjs → vector_db_qa-Bf6oOghB.cjs} +1 -1
- package/dist/{vector_db_qa-nw6U0HI5.js → vector_db_qa-DnXdDGBx.js} +3 -3
- package/package.json +135 -135
- package/dist/index-CB3iLddF.js +0 -4
- package/dist/index-CDalpP5C.js +0 -4
- package/dist/index-CEh-kRgr.js +0 -4
- package/dist/index-Dz9H6mEL.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PromptTemplate, i as BaseChain } from "./index-
|
|
2
|
-
import { LLMChain } from "./llm_chain-
|
|
1
|
+
import { P as PromptTemplate, i as BaseChain } from "./index-BaQU1IvP.js";
|
|
2
|
+
import { LLMChain } from "./llm_chain-D_TCnPCU.js";
|
|
3
3
|
import "zod";
|
|
4
4
|
const API_URL_RAW_PROMPT_TEMPLATE = `You are given the below API Documentation:
|
|
5
5
|
{api_docs}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFYcGKuT.cjs"),i=require("./llm_chain-uxhdn-1W.cjs");require("zod");const t="You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{question}\nAPI url:",a=new e.PromptTemplate({inputVariables:["api_docs","question"],template:t}),n=`${t} {api_url}\n\nHere is the response from the API:\n\n{api_response}\n\nSummarize this response to answer the original question.\n\nSummary:`,s=new e.PromptTemplate({inputVariables:["api_docs","question","api_url","api_response"],template:n});class r extends e.BaseChain{get inputKeys(){return[this.inputKey]}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"apiAnswerChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiRequestChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"question"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output"}),this.apiRequestChain=e.apiRequestChain,this.apiAnswerChain=e.apiAnswerChain,this.apiDocs=e.apiDocs,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.headers=e.headers??this.headers}async _call(e,i){const t=e[this.inputKey],a=await this.apiRequestChain.predict({question:t,api_docs:this.apiDocs},null==i?void 0:i.getChild("request")),n=await fetch(a,{headers:this.headers}),s=await n.text(),r=await this.apiAnswerChain.predict({question:t,api_docs:this.apiDocs,api_url:a,api_response:s},null==i?void 0:i.getChild("response"));return{[this.outputKey]:r}}_chainType(){return"api_chain"}static async deserialize(e){const{api_request_chain:t,api_answer_chain:a,api_docs:n}=e;if(!t)throw new Error("LLMChain must have api_request_chain");if(!a)throw new Error("LLMChain must have api_answer_chain");if(!n)throw new Error("LLMChain must have api_docs");return new r({apiAnswerChain:await i.LLMChain.deserialize(a),apiRequestChain:await i.LLMChain.deserialize(t),apiDocs:n})}serialize(){return{_type:this._chainType(),api_answer_chain:this.apiAnswerChain.serialize(),api_request_chain:this.apiRequestChain.serialize(),api_docs:this.apiDocs}}static fromLLMAndAPIDocs(e,t,n={}){const{apiUrlPrompt:r=a,apiResponsePrompt:o=s}=n,u=new i.LLMChain({prompt:r,llm:e});return new this({apiAnswerChain:new i.LLMChain({prompt:o,llm:e}),apiRequestChain:u,apiDocs:t,...n})}}exports.APIChain=r;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "zod";
|
|
2
|
-
import { i as BaseChain, P as PromptTemplate } from "./index-
|
|
3
|
-
import { LLMChain } from "./llm_chain-
|
|
2
|
+
import { i as BaseChain, P as PromptTemplate } from "./index-BaQU1IvP.js";
|
|
3
|
+
import { LLMChain } from "./llm_chain-D_TCnPCU.js";
|
|
4
4
|
class StuffDocumentsChain extends BaseChain {
|
|
5
5
|
static lc_name() {
|
|
6
6
|
return "StuffDocumentsChain";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),require("zod");const e=require("./index-DFYcGKuT.cjs"),t=require("./llm_chain-uxhdn-1W.cjs");class i extends e.BaseChain{static lc_name(){return"StuffDocumentsChain"}get inputKeys(){return[this.inputKey,...this.llmChain.inputKeys].filter(e=>e!==this.documentVariableName)}get outputKeys(){return this.llmChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),this.llmChain=e.llmChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey}_prepInputs(e){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:t,...i}=e,n=t.map(({pageContent:e})=>e).join("\n\n");return{...i,[this.documentVariableName]:n}}async _call(e,t){return await this.llmChain.call(this._prepInputs(e),null==t?void 0:t.getChild("combine_documents"))}_chainType(){return"stuff_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");return new i({llmChain:await t.LLMChain.deserialize(e.llm_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize()}}}class n extends e.BaseChain{static lc_name(){return"MapReduceDocumentsChain"}get inputKeys(){return[this.inputKey,...this.combineDocumentChain.inputKeys]}get outputKeys(){return this.combineDocumentChain.outputKeys}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"returnIntermediateSteps",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"maxTokens",{enumerable:!0,configurable:!0,writable:!0,value:3e3}),Object.defineProperty(this,"maxIterations",{enumerable:!0,configurable:!0,writable:!0,value:10}),Object.defineProperty(this,"ensureMapStep",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"combineDocumentChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.llmChain=e.llmChain,this.combineDocumentChain=e.combineDocumentChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.ensureMapStep=e.ensureMapStep??this.ensureMapStep,this.inputKey=e.inputKey??this.inputKey,this.maxTokens=e.maxTokens??this.maxTokens,this.maxIterations=e.maxIterations??this.maxIterations,this.returnIntermediateSteps=e.returnIntermediateSteps??!1}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e;let a=i,r=[];for(let o=0;o<this.maxIterations;o+=1){const e=a.map(e=>({[this.documentVariableName]:e.pageContent,...n}));if(0!==o||!this.ensureMapStep){const e=await this.combineDocumentChain.llmChain.prompt.format(this.combineDocumentChain._prepInputs({[this.combineDocumentChain.inputKey]:a,...n}));if(await this.combineDocumentChain.llmChain._getNumTokens(e)<this.maxTokens)break}const i=await this.llmChain.apply(e,t?Array.from({length:e.length},(e,i)=>t.getChild(`map_${i+1}`)):void 0),{outputKey:s}=this.llmChain;this.returnIntermediateSteps&&(r=r.concat(i.map(e=>e[s]))),a=i.map(e=>({pageContent:e[s],metadata:{}}))}const s={[this.combineDocumentChain.inputKey]:a,...n},u=await this.combineDocumentChain.call(s,null==t?void 0:t.getChild("combine_documents"));return this.returnIntermediateSteps?{...u,intermediateSteps:r}:u}_chainType(){return"map_reduce_documents_chain"}static async deserialize(e){if(!e.llm_chain)throw new Error("Missing llm_chain");if(!e.combine_document_chain)throw new Error("Missing combine_document_chain");return new n({llmChain:await t.LLMChain.deserialize(e.llm_chain),combineDocumentChain:await i.deserialize(e.combine_document_chain)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),combine_document_chain:this.combineDocumentChain.serialize()}}}class a extends e.BaseChain{static lc_name(){return"RefineDocumentsChain"}get defaultDocumentPrompt(){return new e.PromptTemplate({inputVariables:["page_content"],template:"{page_content}"})}get inputKeys(){return[...new Set([this.inputKey,...this.llmChain.inputKeys,...this.refineLLMChain.inputKeys])].filter(e=>e!==this.documentVariableName&&e!==this.initialResponseName)}get outputKeys(){return[this.outputKey]}constructor(e){super(e),Object.defineProperty(this,"llmChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputKey",{enumerable:!0,configurable:!0,writable:!0,value:"input_documents"}),Object.defineProperty(this,"outputKey",{enumerable:!0,configurable:!0,writable:!0,value:"output_text"}),Object.defineProperty(this,"documentVariableName",{enumerable:!0,configurable:!0,writable:!0,value:"context"}),Object.defineProperty(this,"initialResponseName",{enumerable:!0,configurable:!0,writable:!0,value:"existing_answer"}),Object.defineProperty(this,"refineLLMChain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"documentPrompt",{enumerable:!0,configurable:!0,writable:!0,value:this.defaultDocumentPrompt}),this.llmChain=e.llmChain,this.refineLLMChain=e.refineLLMChain,this.documentVariableName=e.documentVariableName??this.documentVariableName,this.inputKey=e.inputKey??this.inputKey,this.outputKey=e.outputKey??this.outputKey,this.documentPrompt=e.documentPrompt??this.documentPrompt,this.initialResponseName=e.initialResponseName??this.initialResponseName}async _constructInitialInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});return{...{[this.documentVariableName]:await this.documentPrompt.format({...n})},...t}}async _constructRefineInputs(e,t){const i={page_content:e.pageContent,...e.metadata},n={};this.documentPrompt.inputVariables.forEach(e=>{n[e]=i[e]});const a={[this.documentVariableName]:await this.documentPrompt.format({...n})};return{[this.initialResponseName]:t,...a}}async _call(e,t){if(!(this.inputKey in e))throw new Error(`Document key ${this.inputKey} not found.`);const{[this.inputKey]:i,...n}=e,a=i,r=await this._constructInitialInputs(a[0],n);let s=await this.llmChain.predict({...r},null==t?void 0:t.getChild("answer"));for(let u=1;u<a.length;u+=1){const e={...await this._constructRefineInputs(a[u],s),...n};s=await this.refineLLMChain.predict({...e},null==t?void 0:t.getChild("refine"))}return{[this.outputKey]:s}}_chainType(){return"refine_documents_chain"}static async deserialize(e){const i=e.llm_chain;if(!i)throw new Error("Missing llm_chain");const n=e.refine_llm_chain;if(!n)throw new Error("Missing refine_llm_chain");return new a({llmChain:await t.LLMChain.deserialize(i),refineLLMChain:await t.LLMChain.deserialize(n)})}serialize(){return{_type:this._chainType(),llm_chain:this.llmChain.serialize(),refine_llm_chain:this.refineLLMChain.serialize()}}}exports.MapReduceDocumentsChain=n,exports.RefineDocumentsChain=a,exports.StuffDocumentsChain=i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-
|
|
1
|
+
import { B as BaseStringPromptTemplate, e as checkValidTemplate, g as renderTemplate, P as PromptTemplate } from "./index-BaQU1IvP.js";
|
|
2
2
|
import "zod";
|
|
3
3
|
class FewShotPromptTemplate extends BaseStringPromptTemplate {
|
|
4
4
|
constructor(input) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFYcGKuT.cjs");require("zod");class t extends e.BaseStringPromptTemplate{constructor(t){if(super(t),Object.defineProperty(this,"lc_serializable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"examples",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exampleSelector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"examplePrompt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"suffix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"exampleSeparator",{enumerable:!0,configurable:!0,writable:!0,value:"\n\n"}),Object.defineProperty(this,"prefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"templateFormat",{enumerable:!0,configurable:!0,writable:!0,value:"f-string"}),Object.defineProperty(this,"validateTemplate",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.assign(this,t),void 0!==this.examples&&void 0!==this.exampleSelector)throw new Error("Only one of 'examples' and 'example_selector' should be provided");if(void 0===this.examples&&void 0===this.exampleSelector)throw new Error("One of 'examples' and 'example_selector' should be provided");if(this.validateTemplate){let t=this.inputVariables;this.partialVariables&&(t=t.concat(Object.keys(this.partialVariables))),e.checkValidTemplate(this.prefix+this.suffix,this.templateFormat,t)}}_getPromptType(){return"few_shot"}static lc_name(){return"FewShotPromptTemplate"}async getExamples(e){if(void 0!==this.examples)return this.examples;if(void 0!==this.exampleSelector)return this.exampleSelector.selectExamples(e);throw new Error("One of 'examples' and 'example_selector' should be provided")}async partial(e){const r=this.inputVariables.filter(t=>!(t in e)),a={...this.partialVariables??{},...e},i={...this,inputVariables:r,partialVariables:a};return new t(i)}async format(t){const r=await this.mergePartialAndUserVariables(t),a=await this.getExamples(r),i=await Promise.all(a.map(e=>this.examplePrompt.format(e))),l=[this.prefix,...i,this.suffix].join(this.exampleSeparator);return e.renderTemplate(l,this.templateFormat,r)}serialize(){if(this.exampleSelector||!this.examples)throw new Error("Serializing an example selector is not currently supported");if(void 0!==this.outputParser)throw new Error("Serializing an output parser is not currently supported");return{_type:this._getPromptType(),input_variables:this.inputVariables,example_prompt:this.examplePrompt.serialize(),example_separator:this.exampleSeparator,suffix:this.suffix,prefix:this.prefix,template_format:this.templateFormat,examples:this.examples}}static async deserialize(r){const{example_prompt:a}=r;if(!a)throw new Error("Missing example prompt");const i=await e.PromptTemplate.deserialize(a);let l;if(!Array.isArray(r.examples))throw new Error("Invalid examples format. Only list or string are supported.");return l=r.examples,new t({inputVariables:r.input_variables,examplePrompt:i,examples:l,exampleSeparator:r.example_separator,prefix:r.prefix,suffix:r.suffix,templateFormat:r.template_format})}}exports.FewShotPromptTemplate=t;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as svg, D as html, E as webNamespaces, F as s, G as h, I as find, J as ok, V as VFile, K as VFileMessage } from "./index-
|
|
1
|
+
import { A as svg, D as html, E as webNamespaces, F as s, G as h, I as find, J as ok, V as VFile, K as VFileMessage } from "./index-BaQU1IvP.js";
|
|
2
2
|
function location(file) {
|
|
3
3
|
const value = String(file);
|
|
4
4
|
const indices = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-
|
|
1
|
+
import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-BaQU1IvP.js";
|
|
2
2
|
import { z as zwitch } from "./index-BEZf1ZPW.js";
|
|
3
3
|
const htmlVoidElements = [
|
|
4
4
|
"area",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./index-
|
|
1
|
+
"use strict";const e=require("./index-DFYcGKuT.cjs"),t=e.convertElement(function(e){return"audio"===e.tagName||"canvas"===e.tagName||"embed"===e.tagName||"iframe"===e.tagName||"img"===e.tagName||"math"===e.tagName||"object"===e.tagName||"picture"===e.tagName||"svg"===e.tagName||"video"===e.tagName}),r=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],n=["button","input","select","textarea"],a=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],i={},o=e.convert(["comment","doctype"]);function s(e,t){if("children"in e){const r={...t};return("root"===e.type||u(e))&&(r.before=!0,r.after=!0),r.whitespace=function(e,t){if("tagName"in e&&e.properties)switch(e.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return e.properties.wrap?"pre-wrap":"pre";case"td":case"th":return e.properties.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}return t.whitespace}(e,t),function(e,t){let r=t.before;const n=t.after,a=e.children;let i=a.length,o=-1;for(;++o<i;){const e=s(a[o],{...t,after:c(a,o,n),before:r});e.remove?(a.splice(o,1),o--,i--):e.ignore||(r=e.stripAtStart),l(a[o])&&(r=!1)}return{ignore:!1,stripAtStart:Boolean(r||n),remove:!1}}(e,r)}if("text"===e.type){if("normal"===t.whitespace)return function(e,t){const r=t.collapse(e.value),n={ignore:!1,stripAtStart:!1,remove:!1};let a=0,i=r.length;t.before&&f(r.charAt(0))&&a++;a!==i&&f(r.charAt(i-1))&&(t.after?i--:n.stripAtStart=!0);a===i?n.remove=!0:e.value=r.slice(a,i);return n}(e,t);"nowrap"===t.whitespace&&(e.value=t.collapse(e.value))}return{ignore:o(e),stripAtStart:!1,remove:!1}}function c(e,t,r){for(;++t<e.length;){const r=e[t];let n=p(r);if(void 0===n&&"children"in r&&!m(r)&&(n=c(r.children,-1)),"boolean"==typeof n)return n}return r}function p(t){if("element"===t.type){if(l(t))return!1;if(u(t))return!0}else if("text"===t.type){if(!e.whitespace(t))return!1}else if(!o(t))return!1}function l(r){return t(r)||e.isElement(r,n)}function u(t){return e.isElement(t,r)}function m(t){return Boolean("element"===t.type&&t.properties.hidden)||o(t)||e.isElement(t,a)}function f(e){return" "===e||"\n"===e}function d(e){const t=/\r?\n|\r/.exec(e);return t?t[0]:" "}function h(){return" "}function g(e){return function(t){return String(t).replace(/[\t\n\v\f\r ]+/g,e)}}const b={}.hasOwnProperty;const y=new Set(["pingback","prefetch","stylesheet"]);const v=e.convertElement(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),w=e.convertElement("meta");exports.embedded=t,exports.minifyWhitespace=function(e,t){s(e,{collapse:g((t||i).newlines?d:h),whitespace:"normal"})},exports.phrasing=function(e){return Boolean("text"===e.type||v(e)||t(e)||function(e){if("element"!==e.type||"link"!==e.tagName)return!1;if(e.properties.itemProp)return!0;const t=e.properties.rel;let r=-1;if(!Array.isArray(t)||0===t.length)return!1;for(;++r<t.length;)if(!y.has(String(t[r])))return!1;return!0}(e)||w(e)&&function(e,t){const r="element"===e.type&&b.call(e.properties,t)&&e.properties[t];return null!=r&&!1!==r}(e,"itemProp"))};
|
|
@@ -46929,7 +46929,7 @@ const BlockEdit = ({
|
|
|
46929
46929
|
const initVueEditor = async () => {
|
|
46930
46930
|
if (editorRef.current) {
|
|
46931
46931
|
try {
|
|
46932
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
46932
|
+
const BlockNoteEditorModule = await import("./index.es-Ofj7pWXh.js");
|
|
46933
46933
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
46934
46934
|
const theme = {
|
|
46935
46935
|
colors: {
|
|
@@ -47856,7 +47856,7 @@ const style = {
|
|
|
47856
47856
|
backgroundColor: "transparent",
|
|
47857
47857
|
color: "#333"
|
|
47858
47858
|
};
|
|
47859
|
-
const AiBlockEdit = ({
|
|
47859
|
+
const AiBlockEdit$1 = ({
|
|
47860
47860
|
getSetBlockContent,
|
|
47861
47861
|
baseUrl,
|
|
47862
47862
|
token,
|
|
@@ -47893,7 +47893,7 @@ const AiBlockEdit = ({
|
|
|
47893
47893
|
const initVueEditor = async () => {
|
|
47894
47894
|
if (editorRef.current) {
|
|
47895
47895
|
try {
|
|
47896
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
47896
|
+
const BlockNoteEditorModule = await import("./index.es-Ofj7pWXh.js");
|
|
47897
47897
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
47898
47898
|
const theme = {
|
|
47899
47899
|
colors: {
|
|
@@ -48623,6 +48623,217 @@ const AiBlockEdit = ({
|
|
|
48623
48623
|
}
|
|
48624
48624
|
);
|
|
48625
48625
|
};
|
|
48626
|
+
const AiBlockEdit = ({
|
|
48627
|
+
getSetBlockContent,
|
|
48628
|
+
baseUrl,
|
|
48629
|
+
token,
|
|
48630
|
+
onBack,
|
|
48631
|
+
onRegenerate
|
|
48632
|
+
}) => {
|
|
48633
|
+
useNavigate();
|
|
48634
|
+
const [searchParams] = useSearchParams();
|
|
48635
|
+
const editorRef = useRef(null);
|
|
48636
|
+
const editorVmRef = useRef(null);
|
|
48637
|
+
const contentChangeHandlerRef = useRef(
|
|
48638
|
+
null
|
|
48639
|
+
);
|
|
48640
|
+
const hasPastedRef = useRef(false);
|
|
48641
|
+
const [outlineTree, setOutlineTree] = useState([]);
|
|
48642
|
+
const [exporting, setExporting] = useState(false);
|
|
48643
|
+
useRef(false);
|
|
48644
|
+
const [editorReady, setEditorReady] = useState(false);
|
|
48645
|
+
const [historyVisible, setHistoryVisible] = useState(false);
|
|
48646
|
+
const [historyList, setHistoryList] = useState([]);
|
|
48647
|
+
const [historyLoading, setHistoryLoading] = useState(false);
|
|
48648
|
+
const [historyHasMore, setHistoryHasMore] = useState(true);
|
|
48649
|
+
const [currentConversationId, setCurrentConversationId] = useState("");
|
|
48650
|
+
useEffect(() => {
|
|
48651
|
+
if (baseUrl == null ? void 0 : baseUrl.conversationId) {
|
|
48652
|
+
setCurrentConversationId(baseUrl == null ? void 0 : baseUrl.conversationId);
|
|
48653
|
+
}
|
|
48654
|
+
if (baseUrl == null ? void 0 : baseUrl.userId) {
|
|
48655
|
+
getHistoryFromIndexedDB();
|
|
48656
|
+
}
|
|
48657
|
+
}, [baseUrl]);
|
|
48658
|
+
useEffect(() => {
|
|
48659
|
+
const initVueEditor = async () => {
|
|
48660
|
+
if (editorRef.current) {
|
|
48661
|
+
try {
|
|
48662
|
+
const BlockNoteEditorModule = await import("./index.es-Ofj7pWXh.js");
|
|
48663
|
+
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
48664
|
+
const theme = {
|
|
48665
|
+
colors: {
|
|
48666
|
+
editor: {
|
|
48667
|
+
text: "#333",
|
|
48668
|
+
background: "transparent"
|
|
48669
|
+
}
|
|
48670
|
+
}
|
|
48671
|
+
};
|
|
48672
|
+
console.log("BlockNoteEditor:", BlockNoteEditor);
|
|
48673
|
+
if (BlockNoteEditor && typeof BlockNoteEditor === "object") {
|
|
48674
|
+
const { createApp } = await import("./vue.runtime.esm-bundler-uPvnzsTN.js");
|
|
48675
|
+
console.log("Creating Vue app with BlockNoteEditor component");
|
|
48676
|
+
const onContentChange = (payload) => {
|
|
48677
|
+
console.log("内容变化了", payload);
|
|
48678
|
+
const treeData2 = parseBlockNoteOutline(payload);
|
|
48679
|
+
console.log("大纲内容", treeData2);
|
|
48680
|
+
setOutlineTree(treeData2);
|
|
48681
|
+
};
|
|
48682
|
+
const onHandleAiAssistant = (text2, type) => {
|
|
48683
|
+
console.log("处理AI助手", text2, type);
|
|
48684
|
+
};
|
|
48685
|
+
const app = createApp(BlockNoteEditor, {
|
|
48686
|
+
theme,
|
|
48687
|
+
onContentChange,
|
|
48688
|
+
onHandleAiAssistant,
|
|
48689
|
+
hiddenAiAssistant: true
|
|
48690
|
+
// placeholder: "开始编辑...",
|
|
48691
|
+
});
|
|
48692
|
+
console.log("Mounting Vue app to:", editorRef.current);
|
|
48693
|
+
const vm = app.mount(editorRef.current);
|
|
48694
|
+
editorVmRef.current = vm;
|
|
48695
|
+
setEditorReady(true);
|
|
48696
|
+
if (!hasPastedRef.current) {
|
|
48697
|
+
hasPastedRef.current = true;
|
|
48698
|
+
setTimeout(() => {
|
|
48699
|
+
var _a2;
|
|
48700
|
+
try {
|
|
48701
|
+
const anyVm = editorVmRef.current;
|
|
48702
|
+
const exposed = ((_a2 = anyVm == null ? void 0 : anyVm.$) == null ? void 0 : _a2.exposed) ?? (anyVm == null ? void 0 : anyVm.exposed) ?? anyVm;
|
|
48703
|
+
const paste = (baseUrl == null ? void 0 : baseUrl.contentType) && (baseUrl == null ? void 0 : baseUrl.contentType) === "blocknote" ? exposed == null ? void 0 : exposed.setContent : exposed == null ? void 0 : exposed.pasteMarkdown;
|
|
48704
|
+
if (typeof paste === "function") {
|
|
48705
|
+
if ((baseUrl == null ? void 0 : baseUrl.contentType) && (baseUrl == null ? void 0 : baseUrl.contentType) === "blocknote") {
|
|
48706
|
+
paste(JSON.parse(baseUrl.content));
|
|
48707
|
+
} else {
|
|
48708
|
+
paste(baseUrl.content, true);
|
|
48709
|
+
}
|
|
48710
|
+
}
|
|
48711
|
+
} catch (e) {
|
|
48712
|
+
console.warn("初始化 pasteMarkdown 失败:", e);
|
|
48713
|
+
}
|
|
48714
|
+
}, 300);
|
|
48715
|
+
}
|
|
48716
|
+
} else {
|
|
48717
|
+
console.log("BlockNoteEditor is not a valid Vue component");
|
|
48718
|
+
if (editorRef.current) {
|
|
48719
|
+
editorRef.current.innerHTML = `
|
|
48720
|
+
<div style="padding: 20px; text-align: center; color: #666; background: #f0f0f0; border: 1px solid #ccc; border-radius: 4px;">
|
|
48721
|
+
<h3>BlockNote编辑器</h3>
|
|
48722
|
+
<p>编辑器组件类型: ${typeof BlockNoteEditor}</p>
|
|
48723
|
+
<p>主题: ${JSON.stringify(theme)}</p>
|
|
48724
|
+
</div>
|
|
48725
|
+
`;
|
|
48726
|
+
}
|
|
48727
|
+
}
|
|
48728
|
+
} catch (error) {
|
|
48729
|
+
console.error("Failed to load Vue editor:", error);
|
|
48730
|
+
if (editorRef.current) {
|
|
48731
|
+
editorRef.current.innerHTML = '<div style="padding: 20px; text-align: center; color: #666; background: #fff3cd; border: 1px solid #ffeaa7; border-radius: 4px;">编辑器加载失败,请检查控制台错误信息</div>';
|
|
48732
|
+
}
|
|
48733
|
+
}
|
|
48734
|
+
}
|
|
48735
|
+
};
|
|
48736
|
+
initVueEditor();
|
|
48737
|
+
return () => {
|
|
48738
|
+
contentChangeHandlerRef.current = null;
|
|
48739
|
+
editorVmRef.current = void 0;
|
|
48740
|
+
setEditorReady(false);
|
|
48741
|
+
};
|
|
48742
|
+
}, []);
|
|
48743
|
+
const parseBlockNoteOutline = (content2) => {
|
|
48744
|
+
if (!Array.isArray(content2) || content2.length === 0) return [];
|
|
48745
|
+
const treeData2 = [];
|
|
48746
|
+
const stack = [];
|
|
48747
|
+
content2.forEach((block, index2) => {
|
|
48748
|
+
var _a2, _b;
|
|
48749
|
+
if (!block || typeof block !== "object") return;
|
|
48750
|
+
if (block.type === "heading" && ((_a2 = block.props) == null ? void 0 : _a2.level)) {
|
|
48751
|
+
const level = block.props.level;
|
|
48752
|
+
const title = extractTextFromContent(block.content);
|
|
48753
|
+
const key = `outline-${index2}`;
|
|
48754
|
+
const blockId = block.id || `block-${index2}`;
|
|
48755
|
+
const titleSlug = title ? title.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, "-").toLowerCase() : `heading-${index2}`;
|
|
48756
|
+
const node2 = {
|
|
48757
|
+
label: title,
|
|
48758
|
+
key,
|
|
48759
|
+
value: key,
|
|
48760
|
+
blockId,
|
|
48761
|
+
// 保存 BlockNote 的块ID
|
|
48762
|
+
titleSlug,
|
|
48763
|
+
// 保存标题的slug版本
|
|
48764
|
+
children: [],
|
|
48765
|
+
level,
|
|
48766
|
+
// 保存标题级别
|
|
48767
|
+
agentId: ((_b = block.props) == null ? void 0 : _b.agentId) || null
|
|
48768
|
+
// 保存 agentId
|
|
48769
|
+
};
|
|
48770
|
+
while (stack.length > 0 && stack[stack.length - 1].level >= level) {
|
|
48771
|
+
stack.pop();
|
|
48772
|
+
}
|
|
48773
|
+
if (stack.length === 0) {
|
|
48774
|
+
treeData2.push(node2);
|
|
48775
|
+
stack.push({ ...node2, level });
|
|
48776
|
+
} else {
|
|
48777
|
+
const parent = stack[stack.length - 1];
|
|
48778
|
+
if (parent.children) {
|
|
48779
|
+
parent.children.push(node2);
|
|
48780
|
+
}
|
|
48781
|
+
stack.push({ ...node2, level });
|
|
48782
|
+
}
|
|
48783
|
+
}
|
|
48784
|
+
});
|
|
48785
|
+
return treeData2;
|
|
48786
|
+
};
|
|
48787
|
+
const extractTextFromContent = (content2) => {
|
|
48788
|
+
if (!Array.isArray(content2)) return "";
|
|
48789
|
+
let text2 = "";
|
|
48790
|
+
content2.forEach((item) => {
|
|
48791
|
+
if (item && typeof item === "object") {
|
|
48792
|
+
if (item.type === "text") {
|
|
48793
|
+
text2 += item.text || "";
|
|
48794
|
+
} else if (item.type === "link" && item.content) {
|
|
48795
|
+
text2 += extractTextFromContent(item.content);
|
|
48796
|
+
} else if (item.content) {
|
|
48797
|
+
text2 += extractTextFromContent(item.content);
|
|
48798
|
+
}
|
|
48799
|
+
}
|
|
48800
|
+
});
|
|
48801
|
+
return text2;
|
|
48802
|
+
};
|
|
48803
|
+
const setBlockContent = (content2, type) => {
|
|
48804
|
+
var _a2;
|
|
48805
|
+
try {
|
|
48806
|
+
const anyVm = editorVmRef.current;
|
|
48807
|
+
const exposed = ((_a2 = anyVm == null ? void 0 : anyVm.$) == null ? void 0 : _a2.exposed) ?? (anyVm == null ? void 0 : anyVm.exposed) ?? anyVm;
|
|
48808
|
+
const paste = type === "blocknote" ? exposed == null ? void 0 : exposed.setContent : exposed == null ? void 0 : exposed.pasteMarkdown;
|
|
48809
|
+
if (typeof paste === "function") {
|
|
48810
|
+
if (type === "blocknote") {
|
|
48811
|
+
paste(JSON.parse(content2));
|
|
48812
|
+
} else {
|
|
48813
|
+
paste(content2, true);
|
|
48814
|
+
}
|
|
48815
|
+
}
|
|
48816
|
+
} catch (err) {
|
|
48817
|
+
console.error("设置块内容失败:", err);
|
|
48818
|
+
Toast.error("设置块内容失败,请重试或查看控制台日志");
|
|
48819
|
+
}
|
|
48820
|
+
};
|
|
48821
|
+
useEffect(() => {
|
|
48822
|
+
if (getSetBlockContent) {
|
|
48823
|
+
getSetBlockContent(setBlockContent);
|
|
48824
|
+
}
|
|
48825
|
+
}, [getSetBlockContent]);
|
|
48826
|
+
const getHistoryFromIndexedDB = async () => {
|
|
48827
|
+
const userId = (baseUrl == null ? void 0 : baseUrl.userId) || "";
|
|
48828
|
+
if (!userId) {
|
|
48829
|
+
Toast.error("获取用户ID失败");
|
|
48830
|
+
return;
|
|
48831
|
+
}
|
|
48832
|
+
const historyList2 = await getWritingsByUserId(userId);
|
|
48833
|
+
setHistoryList(historyList2);
|
|
48834
|
+
};
|
|
48835
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block-edit-contanier", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "block-edit-right-content", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: editorRef, className: "vue-editor-container" }) }) });
|
|
48836
|
+
};
|
|
48626
48837
|
class BaseAgent extends Serializable {
|
|
48627
48838
|
get returnValues() {
|
|
48628
48839
|
return ["output"];
|
|
@@ -48942,7 +49153,7 @@ class BasePromptTemplate extends Runnable {
|
|
|
48942
49153
|
return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
|
|
48943
49154
|
}
|
|
48944
49155
|
case "few_shot": {
|
|
48945
|
-
const { FewShotPromptTemplate } = await import("./few_shot-
|
|
49156
|
+
const { FewShotPromptTemplate } = await import("./few_shot-DJCpSBvt.js");
|
|
48946
49157
|
return FewShotPromptTemplate.deserialize(data);
|
|
48947
49158
|
}
|
|
48948
49159
|
default:
|
|
@@ -50514,35 +50725,35 @@ class BaseChain extends BaseLangChain {
|
|
|
50514
50725
|
static async deserialize(data, values = {}) {
|
|
50515
50726
|
switch (data._type) {
|
|
50516
50727
|
case "llm_chain": {
|
|
50517
|
-
const { LLMChain } = await import("./llm_chain-
|
|
50728
|
+
const { LLMChain } = await import("./llm_chain-D_TCnPCU.js");
|
|
50518
50729
|
return LLMChain.deserialize(data);
|
|
50519
50730
|
}
|
|
50520
50731
|
case "sequential_chain": {
|
|
50521
|
-
const { SequentialChain } = await import("./sequential_chain-
|
|
50732
|
+
const { SequentialChain } = await import("./sequential_chain-BIzQ7CWb.js");
|
|
50522
50733
|
return SequentialChain.deserialize(data);
|
|
50523
50734
|
}
|
|
50524
50735
|
case "simple_sequential_chain": {
|
|
50525
|
-
const { SimpleSequentialChain } = await import("./sequential_chain-
|
|
50736
|
+
const { SimpleSequentialChain } = await import("./sequential_chain-BIzQ7CWb.js");
|
|
50526
50737
|
return SimpleSequentialChain.deserialize(data);
|
|
50527
50738
|
}
|
|
50528
50739
|
case "stuff_documents_chain": {
|
|
50529
|
-
const { StuffDocumentsChain } = await import("./combine_docs_chain
|
|
50740
|
+
const { StuffDocumentsChain } = await import("./combine_docs_chain-BH4-g2GW.js");
|
|
50530
50741
|
return StuffDocumentsChain.deserialize(data);
|
|
50531
50742
|
}
|
|
50532
50743
|
case "map_reduce_documents_chain": {
|
|
50533
|
-
const { MapReduceDocumentsChain } = await import("./combine_docs_chain
|
|
50744
|
+
const { MapReduceDocumentsChain } = await import("./combine_docs_chain-BH4-g2GW.js");
|
|
50534
50745
|
return MapReduceDocumentsChain.deserialize(data);
|
|
50535
50746
|
}
|
|
50536
50747
|
case "refine_documents_chain": {
|
|
50537
|
-
const { RefineDocumentsChain } = await import("./combine_docs_chain
|
|
50748
|
+
const { RefineDocumentsChain } = await import("./combine_docs_chain-BH4-g2GW.js");
|
|
50538
50749
|
return RefineDocumentsChain.deserialize(data);
|
|
50539
50750
|
}
|
|
50540
50751
|
case "vector_db_qa": {
|
|
50541
|
-
const { VectorDBQAChain } = await import("./vector_db_qa-
|
|
50752
|
+
const { VectorDBQAChain } = await import("./vector_db_qa-DnXdDGBx.js");
|
|
50542
50753
|
return VectorDBQAChain.deserialize(data, values);
|
|
50543
50754
|
}
|
|
50544
50755
|
case "api_chain": {
|
|
50545
|
-
const { APIChain } = await import("./api_chain-
|
|
50756
|
+
const { APIChain } = await import("./api_chain-8rLd0TuD.js");
|
|
50546
50757
|
return APIChain.deserialize(data);
|
|
50547
50758
|
}
|
|
50548
50759
|
default:
|
|
@@ -51445,11 +51656,12 @@ export {
|
|
|
51445
51656
|
getDefaultExportFromCjs as Z,
|
|
51446
51657
|
jsxRuntimeExports as _,
|
|
51447
51658
|
remarkParse as a,
|
|
51448
|
-
AiBlockEdit as a0,
|
|
51449
|
-
|
|
51450
|
-
|
|
51451
|
-
|
|
51452
|
-
|
|
51659
|
+
AiBlockEdit$1 as a0,
|
|
51660
|
+
AiBlockEdit as a1,
|
|
51661
|
+
LocalForageService as a2,
|
|
51662
|
+
MessageUtil as a3,
|
|
51663
|
+
PluginExecutor as a4,
|
|
51664
|
+
CommonUtil as a5,
|
|
51453
51665
|
defaultFootnoteBackLabel as b,
|
|
51454
51666
|
remarkRehype as c,
|
|
51455
51667
|
defaultFootnoteBackContent as d,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z as zwitch } from "./index-BEZf1ZPW.js";
|
|
2
|
-
import { q as formatCodeAsIndented, s as formatHeadingAsSetext, t as decodeString, x as encodeCharacterReference, y as patternInScope, z as handle } from "./index-
|
|
2
|
+
import { q as formatCodeAsIndented, s as formatHeadingAsSetext, t as decodeString, x as encodeCharacterReference, y as patternInScope, z as handle } from "./index-BaQU1IvP.js";
|
|
3
3
|
const own = {}.hasOwnProperty;
|
|
4
4
|
function configure(base, extension) {
|
|
5
5
|
let index = -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFYcGKuT.cjs");exports.unified=e.unified;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2yo2kUGy.cjs"),t=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-2yo2kUGy.cjs"),t=require("./index-DFYcGKuT.cjs"),n={}.hasOwnProperty;function r(e,t){let o,i=-1;if(t.extensions)for(;++i<t.extensions.length;)r(e,t.extensions[i]);for(o in t)if(n.call(t,o))switch(o){case"extensions":break;case"unsafe":case"join":c(e[o],t[o]);break;case"handlers":a(e[o],t[o]);break;default:e.options[o]=t[o]}return e}function c(e,t){t&&e.push(...t)}function a(e,t){t&&Object.assign(e,t)}const o=[function(e,n,r,c){if("code"===n.type&&t.formatCodeAsIndented(n,c)&&("list"===e.type||e.type===n.type&&t.formatCodeAsIndented(e,c)))return!1;if("spread"in r&&"boolean"==typeof r.spread){if("paragraph"===e.type&&(e.type===n.type||"definition"===n.type||"heading"===n.type&&t.formatHeadingAsSetext(n,c)))return;return r.spread?1:0}}];const i=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],s=[{character:"\t",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",before:"[\\r\\n]",inConstruct:"phrasing"},{character:"\t",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:i},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \t\r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"+",after:"(?:[ \t\r\n])"},{atBreak:!0,character:"-",after:"(?:[ \t\r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \t\r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:i},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:i},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:i},{atBreak:!0,character:"~"}];function h(e){return e.label||!e.identifier?e.label||"":t.decodeString(e.identifier)}function u(e){if(!e._compiled){const t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=new RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}function f(e,t,n,r){let c=r.join.length;for(;c--;){const a=r.join[c](e,t,n,r);if(!0===a||1===a)break;if("number"==typeof a)return"\n".repeat(1+a);if(!1===a)return"\n\n\x3c!----\x3e\n\n"}return"\n\n"}const l=/\r?\n|\r/g;function d(e,t){const n=[];let r,c=0,a=0;for(;r=l.exec(e);)o(e.slice(c,r.index)),n.push(r[0]),c=r.index+r[0].length,a++;return o(e.slice(c)),n.join("");function o(e){n.push(t(e,a,!e))}}function p(e,t){return e-t}function g(e,t){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],c=[],a=e+t;let o,i=-1,s=0;for(;o=n.exec(a);)r.push(o.index);for(;++i<r.length;)s!==r[i]&&c.push(e.slice(s,r[i])),c.push("\\"),s=r[i];return c.push(e.slice(s)),c.join("")}function C(e){const t=e||{},n=t.now||{};let r=t.lineShift||0,c=n.line||1,a=n.column||1;return{move:function(e){const t=e||"",n=t.split(/\r?\n|\r/g),o=n[n.length-1];return c+=n.length-1,a=1===n.length?a+o.length:1+o.length+r,t},current:function(){return{now:{line:c,column:a},lineShift:r}},shift:function(e){r+=e}}}function b(n,c){const a=c||{},i={associationId:h,containerPhrasing:y,containerFlow:v,createTracker:C,compilePattern:u,enter:function(e){return i.stack.push(e),function(){i.stack.pop()}},handlers:{...t.handle},handle:void 0,indentLines:d,indexStack:[],join:[...o],options:{},safe:m,stack:[],unsafe:[...s]};r(i,a),i.options.tightDefinitions&&i.join.push(A),i.handle=e.zwitch("type",{invalid:k,unknown:x,handlers:i.handlers});let f=i.handle(n,void 0,i,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0});return f&&10!==f.charCodeAt(f.length-1)&&13!==f.charCodeAt(f.length-1)&&(f+="\n"),f}function k(e){throw new Error("Cannot handle value `"+e+"`, expected node")}function x(e){throw new Error("Cannot handle unknown node `"+e.type+"`")}function A(e,t){if("definition"===e.type&&e.type===t.type)return 0}function y(e,n){return function(e,n,r){const c=n.indexStack,a=e.children||[],o=[];let i,s=-1,h=r.before;c.push(-1);let u=n.createTracker(r);for(;++s<a.length;){const f=a[s];let l;if(c[c.length-1]=s,s+1<a.length){let t=n.handle.handlers[a[s+1].type];t&&t.peek&&(t=t.peek),l=t?t(a[s+1],e,n,{before:"",after:"",...u.current()}).charAt(0):""}else l=r.after;o.length>0&&("\r"===h||"\n"===h)&&"html"===f.type&&(o[o.length-1]=o[o.length-1].replace(/(\r?\n|\r)$/," "),h=" ",u=n.createTracker(r),u.move(o.join("")));let d=n.handle(f,e,n,{...u.current(),after:l,before:h});i&&i===d.slice(0,1)&&(d=t.encodeCharacterReference(i.charCodeAt(0))+d.slice(1));const p=n.attentionEncodeSurroundingInfo;n.attentionEncodeSurroundingInfo=void 0,i=void 0,p&&(o.length>0&&p.before&&h===o[o.length-1].slice(-1)&&(o[o.length-1]=o[o.length-1].slice(0,-1)+t.encodeCharacterReference(h.charCodeAt(0))),p.after&&(i=l)),u.move(d),o.push(d),h=d.slice(-1)}return c.pop(),o.join("")}(e,this,n)}function v(e,t){return function(e,t,n){const r=t.indexStack,c=e.children||[],a=t.createTracker(n),o=[];let i=-1;for(r.push(-1);++i<c.length;){const n=c[i];r[r.length-1]=i,o.push(a.move(t.handle(n,e,t,{before:"\n",after:"\n",...a.current()}))),"list"!==n.type&&(t.bulletLastUsed=void 0),i<c.length-1&&o.push(a.move(f(n,c[i+1],e,t)))}return r.pop(),o.join("")}(e,this,t)}function m(e,n){return function(e,n,r){const c=(r.before||"")+(n||"")+(r.after||""),a=[],o=[],i={};let s=-1;for(;++s<e.unsafe.length;){const n=e.unsafe[s];if(!t.patternInScope(e.stack,n))continue;const r=e.compilePattern(n);let o;for(;o=r.exec(c);){const e="before"in n||Boolean(n.atBreak),t="after"in n,r=o.index+(e?o[1].length:0);a.includes(r)?(i[r].before&&!e&&(i[r].before=!1),i[r].after&&!t&&(i[r].after=!1)):(a.push(r),i[r]={before:e,after:t})}}a.sort(p);let h=r.before?r.before.length:0;const u=c.length-(r.after?r.after.length:0);for(s=-1;++s<a.length;){const e=a[s];e<h||e>=u||e+1<u&&a[s+1]===e+1&&i[e].after&&!i[e+1].before&&!i[e+1].after||a[s-1]===e-1&&i[e].before&&!i[e-1].before&&!i[e-1].after||(h!==e&&o.push(g(c.slice(h,e),"\\")),h=e,!/[!-/:-@[-`{-~]/.test(c.charAt(e))||r.encode&&r.encode.includes(c.charAt(e))?(o.push(t.encodeCharacterReference(c.charCodeAt(e))),h++):o.push("\\"))}return o.push(g(c.slice(h,u),r.after)),o.join("")}(this,e,n)}exports.default=function(e){const t=this;t.compiler=function(n){return b(n,{...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]})}};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-
|
|
1
|
+
import { n as convertElement, o as convert, p as isElement, w as whitespace } from "./index-BaQU1IvP.js";
|
|
2
2
|
const embedded = convertElement(
|
|
3
3
|
/**
|
|
4
4
|
* @param element
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DFYcGKuT.cjs");exports.default=e.remarkGfm;
|