super-agent-sdk 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +44 -44
- package/dist/{mammoth.browser-_e1UoKEX.js → mammoth.browser-DFNnVkev.js} +1 -1
- package/dist/{mammoth.browser-CKp13R4W.cjs → mammoth.browser-DrqsE041.cjs} +1 -1
- package/dist/nosUploader-BD9gHyMF.cjs +13 -0
- package/dist/{nosUploader-2VXYPLap.js → nosUploader-vxkhX3-O.js} +448 -440
- package/dist/widget.cjs +21 -23
- package/dist/widget.d.ts +1 -1
- package/dist/widget.mjs +2675 -2668
- package/package.json +1 -1
- package/dist/nosUploader-Dk2GyRpT.cjs +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./nosUploader-BD9gHyMF.cjs");function m(r){if(Array.isArray(r))return r.map(e=>m(e));if(r&&typeof r=="object"&&r.constructor===Object){const e={};for(const[o,s]of Object.entries(r)){const d=o.replace(/_([a-z])/g,(t,n)=>n.toUpperCase());e[d]=m(s)}return e}return r}const S="/api/agent/runtime/v1";class C{constructor(e){this.refreshing=null,this.tokenPromise=null;const o=e.baseUrl??S;this.baseUrl=o.replace(/\/$/,""),this.tokenGateway=e.tokenGateway.replace(/\/$/,""),this.appId=e.appId??"",this.token=e.token??"",this.botCode=e.botCode,this.tenantId=e.tenantId,this.isAbsoluteUrl=/^https?:\/\//.test(this.baseUrl),this.isAbsoluteGateway=/^https?:\/\//.test(this.tokenGateway),this.loginUrl=e.loginUrl,this.onAuthExpired=e.onAuthExpired}getBotCode(){return this.botCode}getAppKey(){return this.appId}setToken(e){this.token=e}getOrigin(){return typeof window<"u"?window.location.origin:""}async fetchToken(){if(this.token)return this.token;if(this.tokenPromise)return this.tokenPromise;this.tokenPromise=(async()=>{const o=`${this.isAbsoluteGateway?this.tokenGateway:`${this.getOrigin()}${this.tokenGateway}`}/superagent/v2/token/generate`,s={"Content-Type":"application/json"};this.tenantId!=null&&(s["X-Tenant-Id"]=String(this.tenantId));const d=await fetch(o,{method:"POST",headers:s,body:JSON.stringify({botCode:this.botCode})});if(!d.ok)throw new Error(`HTTP ${d.status}: ${d.statusText}`);const t=await d.json();if(t.code!=="200")throw new Error(t.message||`API error: ${t.code}`);const n=m(t.data);return this.token=n.token,n.appId&&!this.appId&&(this.appId=n.appId),n.token})();try{return await this.tokenPromise}finally{this.tokenPromise=null}}headers(e){return{"Content-Type":"application/json","X-App-Id":this.appId,"X-Token":this.token,...e}}async handleTokenRefresh(){if(this.refreshing)return await this.refreshing,!0;try{return this.token="",this.refreshing=(async()=>{await this.fetchToken()})(),await this.refreshing,!0}catch{return!1}finally{this.refreshing=null}}async request(e,o,s){if(!this.token&&!await this.handleTokenRefresh())throw new Error("SDK token not available: POST /token failed");let d=this.isAbsoluteUrl?`${this.baseUrl}${o}`:`${this.getOrigin()}${this.baseUrl}${o}`;if(s!=null&&s.params){const a=new URLSearchParams;for(const[c,l]of Object.entries(s.params))l!=null&&a.set(c,String(l));const i=a.toString();i&&(d+=`?${i}`)}const t=await fetch(d,{method:e,headers:this.headers(),body:s!=null&&s.body?JSON.stringify(s.body):void 0});if(t.status===401&&!(s!=null&&s.retry)&&await this.handleTokenRefresh())return this.request(e,o,{...s,retry:!0});if(!t.ok){let a=`HTTP ${t.status}: ${t.statusText}`;try{const i=await t.json();i!=null&&i.message&&(a=i.message)}catch{}throw new Error(a)}const n=await t.json();if(n.code!=="200")throw new Error(n.message||`API error: ${n.code}`);return m(n.data)}get(e,o){return this.request("GET",e,{params:o})}post(e,o){return this.request("POST",e,{body:o})}patch(e,o){return this.request("PATCH",e,{body:o})}del(e){return this.request("DELETE",e)}async streamPost(e,o,s){if(!this.token&&!await this.handleTokenRefresh())throw new Error("SDK token not available: POST /token failed");const d=this.isAbsoluteUrl?`${this.baseUrl}${e}`:`${this.getOrigin()}${this.baseUrl}${e}`,t=await fetch(d,{method:"POST",headers:this.headers(),body:JSON.stringify(o),signal:s});if(t.status===401){const n=await g.peekCookieExpired(t.clone());if(n.isCookieExpired&&typeof(o==null?void 0:o.message)=="string"){g.stashPendingChat({botCode:this.botCode,message:o.message,sessionId:o.sessionId??""});const i=g.resolveLoginUrl(n.loginUrl??this.loginUrl);return this.onAuthExpired?this.onAuthExpired({loginUrl:i,sessionId:n.sessionId,botCode:this.botCode}):i&&window.location.replace(i),t}if(await this.handleTokenRefresh())return fetch(d,{method:"POST",headers:this.headers(),body:JSON.stringify(o),signal:s})}return t}}function h(r){return typeof r=="string"?r:Array.isArray(r)?r.map(e=>{if(typeof e=="string")return e;if(e&&typeof e=="object"){if(typeof e.text=="string")return e.text;if(e.type)return`[${e.type}${e.mime_type?": "+e.mime_type:""}]`}return""}).join(""):r==null?"":String(r)}function k(r){const e=r.split(`
|
|
2
2
|
`).map(a=>a.trim()).filter(a=>a.length>0);let o,s,d;for(const a of e)if(a.startsWith("id:"))o=a.slice(3).trim();else if(a.startsWith("event:"))s=a.slice(6).trim();else if(a.startsWith("data:")){const i=a.slice(5).trim();d=d?`${d}
|
|
3
3
|
${i}`:i}if(d===void 0)return null;let t;try{t=JSON.parse(d)}catch{return null}const n=t.type==="tool_result"&&typeof t.content=="object"&&t.content?t.content:void 0;switch(t.type){case"session.start":return{type:"session.start",content:"",sessionId:t.sessionId??t.session_id??"",roundId:t.roundId??t.round_id,event:s,id:o};case"user":return{type:"user",content:h(t.content),event:s,id:o};case"thinking":return{type:"thinking",content:h(t.content),event:s,id:o};case"ai":return{type:"ai",content:h(t.content),event:s,id:o};case"tool_call":return{type:"tool_call",content:t.name??"",toolName:t.name,toolCallId:t.id,args:typeof t.args=="string"?t.args:JSON.stringify(t.args??{}),event:s,id:o};case"tool_delta":return{type:"tool_delta",content:typeof t.content=="string"?t.content:"",toolCallId:t.tool_call_id??t.toolCallId??"",event:s,id:o};case"tool_result":{const a=n==null?void 0:n.result;let i;return typeof a=="string"?i=a:a!=null&&typeof a=="object"?i=JSON.stringify(a):n&&typeof n=="object"&&Object.keys(n).length>0?i=JSON.stringify(n):i=h(t.output??""),{type:"tool_result",content:i,toolName:t.name,toolCallId:t.id,artifacts:Array.isArray(t.artifacts)?t.artifacts:void 0,renderMode:(n==null?void 0:n.render_mode)??t.render_mode??t.renderMode,html:(n==null?void 0:n.html)??t.html,markdown:(n==null?void 0:n.markdown)??t.markdown,defaultExpanded:t.default_expanded??t.defaultExpanded,event:s,id:o}}case"done":return{type:"done",content:h(t.content),sessionId:t.sessionId??t.session_id??"",messageId:t.messageId??t.message_id,roundId:t.roundId??t.round_id,artifacts:Array.isArray(t.artifacts)?t.artifacts:void 0,event:s,id:o};case"stop":return{type:"stop",content:h(t.content),sessionId:t.sessionId??t.session_id??"",messageId:t.messageId??t.message_id,roundId:t.roundId??t.round_id,event:s,id:o};case"error":return{type:"error",content:t.message??"Unknown error",event:s,id:o};case"interrupt":return{type:"interrupt",content:t.content??"",interrupt:{interruptId:t.interruptId??t.interrupt_id??"",interruptType:t.interruptType??t.interrupt_type??"confirm",content:t.content??"",options:t.options,placeholder:t.placeholder,inputType:t.inputType??t.input_type,maxLength:t.maxLength??t.max_length,required:t.required,fields:t.fields,metadata:t.metadata},event:s,id:o};default:return null}}async function b(r,e,o){if(!r.body){o(new Error("Response body is null"));return}const s=r.body.getReader(),d=new TextDecoder;let t="";try{for(;;){const{value:n,done:a}=await s.read();if(a)break;t+=d.decode(n,{stream:!0});let i;for(;(i=t.indexOf(`
|
|
4
4
|
|
|
5
|
-
`))!==-1;){const c=t.slice(0,i);t=t.slice(i+2);const l=k(c);l&&e(l)}}if(t.trim()){const n=k(t);n&&e(n)}}catch(n){(n==null?void 0:n.name)!=="AbortError"&&o(n instanceof Error?n:new Error(String(n)))}finally{try{s.releaseLock()}catch{}}}function A(r,e){var t;const o=new AbortController,s=e.signal?_(e.signal,o.signal):o.signal,d={botCode:r.getBotCode(),message:e.message,sessionId:e.sessionId,stream:e.stream!==!1,...(t=e.attachments)!=null&&t.length?{attachments:e.attachments.map(({url:n,...a})=>a)}:{}};return d.stream?r.streamPost("/chat",d,s).then(async n=>{var a;if(!n.ok){let i=`HTTP ${n.status}`;try{const c=await n.json();c!=null&&c.message&&(i=c.message)}catch{}(a=e.onError)==null||a.call(e,new Error(i));return}return b(n,i=>{var c,l,f,u,y,I,p,w;i.type==="done"&&i.sessionId?((c=e.onMessage)==null||c.call(e,i),(l=e.onDone)==null||l.call(e,{sessionId:i.sessionId,content:i.content,messageId:i.messageId,roundId:i.roundId,artifacts:i.artifacts})):i.type==="done"?((f=e.onMessage)==null||f.call(e,i),(u=e.onDone)==null||u.call(e,{sessionId:"",content:i.content,messageId:i.messageId,roundId:i.roundId,artifacts:i.artifacts})):i.type==="stop"?((y=e.onMessage)==null||y.call(e,i),(I=e.onDone)==null||I.call(e,{sessionId:i.sessionId??"",content:i.content,messageId:i.messageId,roundId:i.roundId})):i.type==="error"?(p=e.onError)==null||p.call(e,new Error(i.content)):(w=e.onMessage)==null||w.call(e,i)},i=>{var c;return(c=e.onError)==null?void 0:c.call(e,i)})}).catch(n=>{var a;(n==null?void 0:n.name)!=="AbortError"&&((a=e.onError)==null||a.call(e,n instanceof Error?n:new Error(String(n))))}):r.post("/chat",d).then(n=>{var a;(a=e.onDone)==null||a.call(e,{sessionId:n.sessionId,content:n.content??"",messageId:n.messageId})}).catch(n=>{var a;(a=e.onError)==null||a.call(e,n instanceof Error?n:new Error(String(n)))}),o}function _(r,e){const o=new AbortController,s=()=>o.abort();return r.addEventListener("abort",s,{once:!0}),e.addEventListener("abort",s,{once:!0}),(r.aborted||e.aborted)&&o.abort(),o.signal}async function $(r){return(await r.post("/chat/sessions",{botCode:r.getBotCode()})).sessionId}function x(r){return{sessionId:r.threadId??r.sessionId,title:r.title,createTime:r.createTime,updateTime:r.updateTime}}async function E(r,e){const o=await r.get("/chat/conversations",{botCode:r.getBotCode(),page:(e==null?void 0:e.page)??1,size:(e==null?void 0:e.size)??20});return{...o,items:o.items.map(x)}}async function P(r,e,o){await r.patch(`/chat/conversations/${e}`,{title:o})}async function v(r,e){await r.del(`/chat/conversations/${e}`)}async function O(r,e){const o=await r.get(`/chat/conversations/${e}/messages`);return U(o)}function T(){return`r_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function U(r){var d;const e=r.length>0&&Array.isArray((d=r[0])==null?void 0:d.data),o=[];if(e)for(const t of r)o.push({roundId:t.roundId??T(),artifacts:Array.isArray(t.artifacts)&&t.artifacts.length?t.artifacts:void 0,items:Array.isArray(t.data)?t.data:[]});else o.push({roundId:T(),items:r});const s=[];for(const t of o){const n=M(t.items);for(const a of n)a.roundId=t.roundId;if(t.artifacts){const a=n.findLast(i=>i.role==="assistant");a&&(a.artifacts=t.artifacts)}s.push(...n)}return s}function M(r){var n;const e=[...r].sort((a,i)=>{const c=new Date(a.createTime??0).getTime()||0,l=new Date(i.createTime??0).getTime()||0;return c!==l?c-l:(a.seq??0)-(i.seq??0)}),o=new Map;for(const a of e)a.role==="tool"&&a.toolCallId&&o.set(a.toolCallId,a.content||"");const s=new Set,d=[],t=(a,i,c,l,f)=>{const u=d[d.length-1];(u==null?void 0:u.role)==="assistant"?(u.parts.push(...a),u.id=i,l&&(u.messageId=l,u.feedback=f??null)):d.push({id:i,role:"assistant",parts:[...a],timestamp:c,messageId:l,feedback:f??null})};for(const a of e){if(a.role==="system")continue;const i=String(a.id??a.messageId??`msg_${Date.now()}`),c=new Date(a.createTime??"").getTime()||Date.now();if(a.role==="human"){const l=(a.attachments??[]).map(u=>({type:"attachment",attachment:{nosKey:u.nosKey??u.attachmentId??"",filename:u.filename??"file",size:u.size??void 0,mime:u.mime??void 0,url:u.url??void 0}})),f=(n=a.metadata)==null?void 0:n.raw_message;d.push({id:i,role:"user",parts:[...l,{type:"text",content:h(a.content)}],timestamp:c,messageId:a.messageId,rawContent:typeof f=="string"&&f?f:void 0});continue}if(a.role==="ai"){const l=N(a,o,s);l.length>0&&t(l,i,c,a.messageId,a.feedback);continue}if(a.role==="tool"){if(a.toolCallId&&s.has(a.toolCallId))continue;t([
|
|
5
|
+
`))!==-1;){const c=t.slice(0,i);t=t.slice(i+2);const l=k(c);l&&e(l)}}if(t.trim()){const n=k(t);n&&e(n)}}catch(n){(n==null?void 0:n.name)!=="AbortError"&&o(n instanceof Error?n:new Error(String(n)))}finally{try{s.releaseLock()}catch{}}}function A(r,e){var t;const o=new AbortController,s=e.signal?_(e.signal,o.signal):o.signal,d={botCode:r.getBotCode(),message:e.message,sessionId:e.sessionId,stream:e.stream!==!1,...(t=e.attachments)!=null&&t.length?{attachments:e.attachments.map(({url:n,...a})=>a)}:{}};return d.stream?r.streamPost("/chat",d,s).then(async n=>{var a;if(!n.ok){let i=`HTTP ${n.status}`;try{const c=await n.json();c!=null&&c.message&&(i=c.message)}catch{}(a=e.onError)==null||a.call(e,new Error(i));return}return b(n,i=>{var c,l,f,u,y,I,p,w;i.type==="done"&&i.sessionId?((c=e.onMessage)==null||c.call(e,i),(l=e.onDone)==null||l.call(e,{sessionId:i.sessionId,content:i.content,messageId:i.messageId,roundId:i.roundId,artifacts:i.artifacts})):i.type==="done"?((f=e.onMessage)==null||f.call(e,i),(u=e.onDone)==null||u.call(e,{sessionId:"",content:i.content,messageId:i.messageId,roundId:i.roundId,artifacts:i.artifacts})):i.type==="stop"?((y=e.onMessage)==null||y.call(e,i),(I=e.onDone)==null||I.call(e,{sessionId:i.sessionId??"",content:i.content,messageId:i.messageId,roundId:i.roundId})):i.type==="error"?(p=e.onError)==null||p.call(e,new Error(i.content)):(w=e.onMessage)==null||w.call(e,i)},i=>{var c;return(c=e.onError)==null?void 0:c.call(e,i)})}).catch(n=>{var a;(n==null?void 0:n.name)!=="AbortError"&&((a=e.onError)==null||a.call(e,n instanceof Error?n:new Error(String(n))))}):r.post("/chat",d).then(n=>{var a;(a=e.onDone)==null||a.call(e,{sessionId:n.sessionId,content:n.content??"",messageId:n.messageId})}).catch(n=>{var a;(a=e.onError)==null||a.call(e,n instanceof Error?n:new Error(String(n)))}),o}function _(r,e){const o=new AbortController,s=()=>o.abort();return r.addEventListener("abort",s,{once:!0}),e.addEventListener("abort",s,{once:!0}),(r.aborted||e.aborted)&&o.abort(),o.signal}async function $(r){return(await r.post("/chat/sessions",{botCode:r.getBotCode()})).sessionId}function x(r){return{sessionId:r.threadId??r.sessionId,title:r.title,createTime:r.createTime,updateTime:r.updateTime}}async function E(r,e){const o=await r.get("/chat/conversations",{botCode:r.getBotCode(),page:(e==null?void 0:e.page)??1,size:(e==null?void 0:e.size)??20});return{...o,items:o.items.map(x)}}async function P(r,e,o){await r.patch(`/chat/conversations/${e}`,{title:o})}async function v(r,e){await r.del(`/chat/conversations/${e}`)}async function O(r,e){const o=await r.get(`/chat/conversations/${e}/messages`);return U(o)}function T(){return`r_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`}function U(r){var d;const e=r.length>0&&Array.isArray((d=r[0])==null?void 0:d.data),o=[];if(e)for(const t of r)o.push({roundId:t.roundId??T(),artifacts:Array.isArray(t.artifacts)&&t.artifacts.length?t.artifacts:void 0,items:Array.isArray(t.data)?t.data:[]});else o.push({roundId:T(),items:r});const s=[];for(const t of o){const n=M(t.items);for(const a of n)a.roundId=t.roundId;if(t.artifacts){const a=n.findLast(i=>i.role==="assistant");a&&(a.artifacts=t.artifacts)}s.push(...n)}return s}function M(r){var n;const e=[...r].sort((a,i)=>{const c=new Date(a.createTime??0).getTime()||0,l=new Date(i.createTime??0).getTime()||0;return c!==l?c-l:(a.seq??0)-(i.seq??0)}),o=new Map;for(const a of e)a.role==="tool"&&a.toolCallId&&o.set(a.toolCallId,a.content||"");const s=new Set,d=[],t=(a,i,c,l,f)=>{const u=d[d.length-1];(u==null?void 0:u.role)==="assistant"?(u.parts.push(...a),u.id=i,l&&(u.messageId=l,u.feedback=f??null)):d.push({id:i,role:"assistant",parts:[...a],timestamp:c,messageId:l,feedback:f??null})};for(const a of e){if(a.role==="system")continue;const i=String(a.id??a.messageId??`msg_${Date.now()}`),c=new Date(a.createTime??"").getTime()||Date.now();if(a.role==="human"){const l=(a.attachments??[]).map(u=>({type:"attachment",attachment:{nosKey:u.nosKey??u.attachmentId??"",filename:u.filename??"file",size:u.size??void 0,mime:u.mime??void 0,url:u.url??void 0}})),f=(n=a.metadata)==null?void 0:n.raw_message;d.push({id:i,role:"user",parts:[...l,{type:"text",content:h(a.content)}],timestamp:c,messageId:a.messageId,rawContent:typeof f=="string"&&f?f:void 0});continue}if(a.role==="ai"){const l=N(a,o,s);l.length>0&&t(l,i,c,a.messageId,a.feedback);continue}if(a.role==="tool"){if(a.toolCallId&&s.has(a.toolCallId))continue;t([L(a)],i,c)}}return d}function N(r,e,o){const s=[];r.reasoning&&s.push({type:"thinking",content:r.reasoning}),r.content&&s.push({type:"text",content:h(r.content)});for(const d of r.toolCalls??[])d.is_interrupt??d.isInterrupt?(o.add(d.id),s.push(D(d,e))):s.push(q(d));return s}function D(r,e){const o=e.has(r.id),s=typeof r.args=="object"?r.args:{};return{type:"interrupt",interrupt:{interruptId:r.id??"",interruptType:s.interruptType??"input",content:s.content??"",options:s.options,placeholder:s.placeholder,inputType:s.inputType,maxLength:s.maxLength,required:s.required,fields:s.fields,metadata:s.metadata},resolved:o,response:o?{action:"submit",value:j(e.get(r.id))}:void 0}}function q(r){let e;try{e=typeof r.args=="string"?r.args:JSON.stringify(r.args??{})}catch{e=String(r.args??"{}")}return{type:"tool_call",toolName:r.name??"",toolCallId:r.id??"",args:e}}function L(r){var o,s,d,t,n;const e=Array.isArray(r.artifacts)?r.artifacts:void 0;return{type:"tool_result",toolName:r.toolName??"",toolCallId:r.toolCallId??"",content:h(r.content),artifacts:e,renderMode:r.renderMode??((o=r.metadata)==null?void 0:o.renderMode)??((s=r.metadata)==null?void 0:s.render_mode),html:r.html??((d=r.metadata)==null?void 0:d.html),markdown:r.markdown??((t=r.metadata)==null?void 0:t.markdown),defaultExpanded:r.defaultExpanded??((n=r.metadata)==null?void 0:n.default_expanded)}}function j(r){if(r!=null)try{return JSON.parse(r)}catch{return r}}async function J(r,e,o,s,d,t,n){const a=await r.streamPost(`/chat/interrupt/${e}/respond`,{sessionId:o,action:s.action,value:s.value},n);if(!a.ok){const i=new Error(`HTTP ${a.status}`);throw t==null||t(i),i}d&&await b(a,i=>{i.type==="error"?t==null||t(new Error(i.content)):d(i)},i=>t==null?void 0:t(i))}async function G(r){return r.get(`/chat/bots/${r.getBotCode()}/skills`)}async function R(r,e){await r.post("/chat/stop",{sessionId:e})}function B(r){const e=new C(r);return{botCode:e.getBotCode(),getToken:()=>e.fetchToken(),createSession:()=>$(e),chat:s=>A(e,s),listConversations:s=>E(e,s),renameConversation:(s,d)=>P(e,s,d),deleteConversation:s=>v(e,s),getMessages:s=>O(e,s),respondInterrupt:(s,d,t,n,a,i)=>J(e,s,d,t,n,a,i),setToken:s=>e.setToken(s),feedback:async(s,d,t)=>{const n={type:d};d==="dislike"&&((t==null?void 0:t.reason)!=null&&(n.reason=t.reason),t!=null&&t.remark&&(n.remark=t.remark)),await e.post(`/chat/messages/${s}/feedback`,n)},cancelFeedback:async s=>{await e.del(`/chat/messages/${s}/feedback`)},listSkills:()=>G(e),stopGeneration:s=>R(e,s)}}exports.createNosUploader=g.createNosUploader;exports.createSuperAgent=B;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as b, s as C } from "./nosUploader-
|
|
2
|
-
import { c as
|
|
1
|
+
import { p as b, s as C, r as S } from "./nosUploader-vxkhX3-O.js";
|
|
2
|
+
import { c as X } from "./nosUploader-vxkhX3-O.js";
|
|
3
3
|
function g(r) {
|
|
4
4
|
if (Array.isArray(r)) return r.map((e) => g(e));
|
|
5
5
|
if (r && typeof r == "object" && r.constructor === Object) {
|
|
@@ -12,11 +12,11 @@ function g(r) {
|
|
|
12
12
|
}
|
|
13
13
|
return r;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
class
|
|
15
|
+
const A = "/api/agent/runtime/v1";
|
|
16
|
+
class _ {
|
|
17
17
|
constructor(e) {
|
|
18
18
|
this.refreshing = null, this.tokenPromise = null;
|
|
19
|
-
const o = e.baseUrl ??
|
|
19
|
+
const o = e.baseUrl ?? A;
|
|
20
20
|
this.baseUrl = o.replace(/\/$/, ""), this.tokenGateway = e.tokenGateway.replace(/\/$/, ""), this.appId = e.appId ?? "", this.token = e.token ?? "", this.botCode = e.botCode, this.tenantId = e.tenantId, this.isAbsoluteUrl = /^https?:\/\//.test(this.baseUrl), this.isAbsoluteGateway = /^https?:\/\//.test(this.tokenGateway), this.loginUrl = e.loginUrl, this.onAuthExpired = e.onAuthExpired;
|
|
21
21
|
}
|
|
22
22
|
getBotCode() {
|
|
@@ -148,7 +148,7 @@ class A {
|
|
|
148
148
|
message: o.message,
|
|
149
149
|
sessionId: o.sessionId ?? ""
|
|
150
150
|
});
|
|
151
|
-
const i = n.loginUrl ?? this.loginUrl;
|
|
151
|
+
const i = S(n.loginUrl ?? this.loginUrl);
|
|
152
152
|
return this.onAuthExpired ? this.onAuthExpired({
|
|
153
153
|
loginUrl: i,
|
|
154
154
|
sessionId: n.sessionId,
|
|
@@ -330,9 +330,9 @@ async function T(r, e, o) {
|
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function $(r, e) {
|
|
334
334
|
var t;
|
|
335
|
-
const o = new AbortController(), s = e.signal ?
|
|
335
|
+
const o = new AbortController(), s = e.signal ? x(e.signal, o.signal) : o.signal, d = {
|
|
336
336
|
botCode: r.getBotCode(),
|
|
337
337
|
message: e.message,
|
|
338
338
|
sessionId: e.sessionId,
|
|
@@ -380,16 +380,16 @@ function _(r, e) {
|
|
|
380
380
|
(a = e.onError) == null || a.call(e, n instanceof Error ? n : new Error(String(n)));
|
|
381
381
|
}), o;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function x(r, e) {
|
|
384
384
|
const o = new AbortController(), s = () => o.abort();
|
|
385
385
|
return r.addEventListener("abort", s, { once: !0 }), e.addEventListener("abort", s, { once: !0 }), (r.aborted || e.aborted) && o.abort(), o.signal;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function E(r) {
|
|
388
388
|
return (await r.post("/chat/sessions", {
|
|
389
389
|
botCode: r.getBotCode()
|
|
390
390
|
})).sessionId;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function P(r) {
|
|
393
393
|
return {
|
|
394
394
|
// 后端返回 thread_id,toCamelCase 转为 threadId,映射为 sessionId
|
|
395
395
|
sessionId: r.threadId ?? r.sessionId,
|
|
@@ -400,7 +400,7 @@ function E(r) {
|
|
|
400
400
|
updateTime: r.updateTime
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
-
async function
|
|
403
|
+
async function v(r, e) {
|
|
404
404
|
const o = await r.get("/chat/conversations", {
|
|
405
405
|
botCode: r.getBotCode(),
|
|
406
406
|
page: (e == null ? void 0 : e.page) ?? 1,
|
|
@@ -408,25 +408,25 @@ async function P(r, e) {
|
|
|
408
408
|
});
|
|
409
409
|
return {
|
|
410
410
|
...o,
|
|
411
|
-
items: o.items.map(
|
|
411
|
+
items: o.items.map(P)
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
|
-
async function
|
|
414
|
+
async function O(r, e, o) {
|
|
415
415
|
await r.patch(`/chat/conversations/${e}`, { title: o });
|
|
416
416
|
}
|
|
417
|
-
async function
|
|
417
|
+
async function U(r, e) {
|
|
418
418
|
await r.del(`/chat/conversations/${e}`);
|
|
419
419
|
}
|
|
420
|
-
async function
|
|
420
|
+
async function M(r, e) {
|
|
421
421
|
const o = await r.get(
|
|
422
422
|
`/chat/conversations/${e}/messages`
|
|
423
423
|
);
|
|
424
|
-
return
|
|
424
|
+
return N(o);
|
|
425
425
|
}
|
|
426
426
|
function k() {
|
|
427
427
|
return `r_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function N(r) {
|
|
430
430
|
var d;
|
|
431
431
|
const e = r.length > 0 && Array.isArray((d = r[0]) == null ? void 0 : d.data), o = [];
|
|
432
432
|
if (e)
|
|
@@ -440,7 +440,7 @@ function M(r) {
|
|
|
440
440
|
o.push({ roundId: k(), items: r });
|
|
441
441
|
const s = [];
|
|
442
442
|
for (const t of o) {
|
|
443
|
-
const n =
|
|
443
|
+
const n = D(t.items);
|
|
444
444
|
for (const a of n) a.roundId = t.roundId;
|
|
445
445
|
if (t.artifacts) {
|
|
446
446
|
const a = n.findLast((i) => i.role === "assistant");
|
|
@@ -450,7 +450,7 @@ function M(r) {
|
|
|
450
450
|
}
|
|
451
451
|
return s;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function D(r) {
|
|
454
454
|
var n;
|
|
455
455
|
const e = [...r].sort((a, i) => {
|
|
456
456
|
const c = new Date(a.createTime ?? 0).getTime() || 0, l = new Date(i.createTime ?? 0).getTime() || 0;
|
|
@@ -498,25 +498,25 @@ function N(r) {
|
|
|
498
498
|
continue;
|
|
499
499
|
}
|
|
500
500
|
if (a.role === "ai") {
|
|
501
|
-
const l =
|
|
501
|
+
const l = q(a, o, s);
|
|
502
502
|
l.length > 0 && t(l, i, c, a.messageId, a.feedback);
|
|
503
503
|
continue;
|
|
504
504
|
}
|
|
505
505
|
if (a.role === "tool") {
|
|
506
506
|
if (a.toolCallId && s.has(a.toolCallId)) continue;
|
|
507
|
-
t([
|
|
507
|
+
t([j(a)], i, c);
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
return d;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function q(r, e, o) {
|
|
513
513
|
const s = [];
|
|
514
514
|
r.reasoning && s.push({ type: "thinking", content: r.reasoning }), r.content && s.push({ type: "text", content: h(r.content) });
|
|
515
515
|
for (const d of r.toolCalls ?? [])
|
|
516
|
-
d.is_interrupt ?? d.isInterrupt ? (o.add(d.id), s.push(
|
|
516
|
+
d.is_interrupt ?? d.isInterrupt ? (o.add(d.id), s.push(L(d, e))) : s.push(J(d));
|
|
517
517
|
return s;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function L(r, e) {
|
|
520
520
|
const o = e.has(r.id), s = typeof r.args == "object" ? r.args : {};
|
|
521
521
|
return {
|
|
522
522
|
type: "interrupt",
|
|
@@ -533,7 +533,7 @@ function q(r, e) {
|
|
|
533
533
|
metadata: s.metadata
|
|
534
534
|
},
|
|
535
535
|
resolved: o,
|
|
536
|
-
response: o ? { action: "submit", value:
|
|
536
|
+
response: o ? { action: "submit", value: G(e.get(r.id)) } : void 0
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
function J(r) {
|
|
@@ -550,7 +550,7 @@ function J(r) {
|
|
|
550
550
|
args: e
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
function
|
|
553
|
+
function j(r) {
|
|
554
554
|
var o, s, d, t, n;
|
|
555
555
|
const e = Array.isArray(r.artifacts) ? r.artifacts : void 0;
|
|
556
556
|
return {
|
|
@@ -566,7 +566,7 @@ function L(r) {
|
|
|
566
566
|
defaultExpanded: r.defaultExpanded ?? ((n = r.metadata) == null ? void 0 : n.default_expanded)
|
|
567
567
|
};
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function G(r) {
|
|
570
570
|
if (r != null)
|
|
571
571
|
try {
|
|
572
572
|
return JSON.parse(r);
|
|
@@ -574,7 +574,7 @@ function j(r) {
|
|
|
574
574
|
return r;
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
|
-
async function
|
|
577
|
+
async function R(r, e, o, s, d, t, n) {
|
|
578
578
|
const a = await r.streamPost(
|
|
579
579
|
`/chat/interrupt/${e}/respond`,
|
|
580
580
|
{
|
|
@@ -596,24 +596,24 @@ async function G(r, e, o, s, d, t, n) {
|
|
|
596
596
|
(i) => t == null ? void 0 : t(i)
|
|
597
597
|
);
|
|
598
598
|
}
|
|
599
|
-
async function
|
|
599
|
+
async function B(r) {
|
|
600
600
|
return r.get(`/chat/bots/${r.getBotCode()}/skills`);
|
|
601
601
|
}
|
|
602
|
-
async function
|
|
602
|
+
async function K(r, e) {
|
|
603
603
|
await r.post("/chat/stop", { sessionId: e });
|
|
604
604
|
}
|
|
605
|
-
function
|
|
606
|
-
const e = new
|
|
605
|
+
function H(r) {
|
|
606
|
+
const e = new _(r);
|
|
607
607
|
return {
|
|
608
608
|
botCode: e.getBotCode(),
|
|
609
609
|
getToken: () => e.fetchToken(),
|
|
610
|
-
createSession: () =>
|
|
611
|
-
chat: (s) =>
|
|
612
|
-
listConversations: (s) =>
|
|
613
|
-
renameConversation: (s, d) =>
|
|
614
|
-
deleteConversation: (s) =>
|
|
615
|
-
getMessages: (s) =>
|
|
616
|
-
respondInterrupt: (s, d, t, n, a, i) =>
|
|
610
|
+
createSession: () => E(e),
|
|
611
|
+
chat: (s) => $(e, s),
|
|
612
|
+
listConversations: (s) => v(e, s),
|
|
613
|
+
renameConversation: (s, d) => O(e, s, d),
|
|
614
|
+
deleteConversation: (s) => U(e, s),
|
|
615
|
+
getMessages: (s) => M(e, s),
|
|
616
|
+
respondInterrupt: (s, d, t, n, a, i) => R(e, s, d, t, n, a, i),
|
|
617
617
|
setToken: (s) => e.setToken(s),
|
|
618
618
|
feedback: async (s, d, t) => {
|
|
619
619
|
const n = { type: d };
|
|
@@ -622,11 +622,11 @@ function z(r) {
|
|
|
622
622
|
cancelFeedback: async (s) => {
|
|
623
623
|
await e.del(`/chat/messages/${s}/feedback`);
|
|
624
624
|
},
|
|
625
|
-
listSkills: () =>
|
|
626
|
-
stopGeneration: (s) =>
|
|
625
|
+
listSkills: () => B(e),
|
|
626
|
+
stopGeneration: (s) => K(e, s)
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
629
|
export {
|
|
630
|
-
|
|
631
|
-
|
|
630
|
+
X as createNosUploader,
|
|
631
|
+
H as createSuperAgent
|
|
632
632
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Ye=require("./nosUploader-
|
|
1
|
+
"use strict";const Ye=require("./nosUploader-BD9gHyMF.cjs");function hi(pn,Dn){for(var C=0;C<Dn.length;C++){const ie=Dn[C];if(typeof ie!="string"&&!Array.isArray(ie)){for(const W in ie)if(W!=="default"&&!(W in pn)){const x=Object.getOwnPropertyDescriptor(ie,W);x&&Object.defineProperty(pn,W,x.get?x:{enumerable:!0,get:()=>ie[W]})}}}return Object.freeze(Object.defineProperty(pn,Symbol.toStringTag,{value:"Module"}))}var ft={exports:{}};(function(pn,Dn){(function(C){pn.exports=C()})(function(){return function C(ie,W,x){function b(p,s){if(!W[p]){if(!ie[p]){var i=typeof Ye.commonjsRequire=="function"&&Ye.commonjsRequire;if(!s&&i)return i(p,!0);if(a)return a(p,!0);var e=new Error("Cannot find module '"+p+"'");throw e.code="MODULE_NOT_FOUND",e}var r=W[p]={exports:{}};ie[p][0].call(r.exports,function(u){var h=ie[p][1][u];return b(h||u)},r,r.exports,C,ie,W,x)}return W[p].exports}for(var a=typeof Ye.commonjsRequire=="function"&&Ye.commonjsRequire,g=0;g<x.length;g++)b(x[g]);return b}({1:[function(C,ie,W){var x=C("../../lib/promises");W.Files=b;function b(){function a(g){return x.reject(new Error("could not open external image: '"+g+`'
|
|
2
2
|
cannot open linked files from a web browser`))}return{read:a}}},{"../../lib/promises":23}],2:[function(C,ie,W){var x=C("../lib/promises"),b=C("../lib/zipfile");W.openZip=a;function a(g){return g.arrayBuffer?x.resolve(b.openArrayBuffer(g.arrayBuffer)):x.reject(new Error("Could not find file in options"))}},{"../lib/promises":23,"../lib/zipfile":40}],3:[function(C,ie,W){var x=C("underscore"),b=C("./promises"),a=C("./documents"),g=C("./styles/html-paths"),p=C("./results"),s=C("./images"),i=C("./html"),e=C("./writers");W.DocumentConverter=r;function r(t){return{convertToHtml:function(n){var m=x.indexBy(n.type===a.types.document?n.comments:[],"commentId"),U=new u(t,m);return U.convertToHtml(n)}}}function u(t,n){var m=1,U=[],M=[];t=x.extend({ignoreEmptyParagraphs:!0},t);var E=t.idPrefix===void 0?"":t.idPrefix,k=t.ignoreEmptyParagraphs,I=g.topLevelElement("p"),R=t.styleMap||[];function A(_){var oe=[],q=ae(_,oe,{}),j=[];d(q,function(f){f.type==="deferred"&&j.push(f)});var D={};return b.mapSeries(j,function(f){return f.value().then(function(v){D[f.id]=v})}).then(function(){function f(S){return l(S,function(N){return N.type==="deferred"?D[N.id]:N.children?[x.extend({},N,{children:f(N.children)})]:[N]})}var v=e.writer({prettyPrint:t.prettyPrint,outputFormat:t.outputFormat});return i.write(v,i.simplify(f(q))),new p.Result(v.asString(),oe)})}function Y(_,oe,q){return l(_,function(j){return ae(j,oe,q)})}function ae(_,oe,q){if(!q)throw new Error("options not set");var j=Le[_.type];return j?j(_,oe,q):[]}function F(_,oe,q){return V(_,oe).wrap(function(){var j=Y(_.children,oe,q);return k?j:[i.forceWrite].concat(j)})}function V(_,oe){var q=H(_);return q?q.to:(_.styleId&&oe.push(y("paragraph",_)),I)}function T(_,oe,q){var j=function(){return Y(_.children,oe,q)},D=[];if(_.highlight!==null){var f=z({type:"highlight",color:_.highlight});f&&D.push(f)}_.isSmallCaps&&D.push($("smallCaps")),_.isAllCaps&&D.push($("allCaps")),_.isStrikethrough&&D.push($("strikethrough","s")),_.isUnderline&&D.push($("underline")),_.verticalAlignment===a.verticalAlignment.subscript&&D.push(g.element("sub",{},{fresh:!1})),_.verticalAlignment===a.verticalAlignment.superscript&&D.push(g.element("sup",{},{fresh:!1})),_.isItalic&&D.push($("italic","em")),_.isBold&&D.push($("bold","strong"));var v=g.empty,S=H(_);return S?v=S.to:_.styleId&&oe.push(y("run",_)),D.push(v),D.forEach(function(N){j=N.wrap.bind(N,j)}),j()}function $(_,oe){var q=z({type:_});return q||(oe?g.element(oe,{},{fresh:!1}):g.empty)}function z(_,oe){var q=H(_);return q?q.to:oe}function H(_){for(var oe=0;oe<R.length;oe++)if(R[oe].from.matches(_))return R[oe]}function re(_){return function(oe,q){return b.attempt(function(){return _(oe,q)}).caught(function(j){return q.push(p.error(j)),[]})}}function K(_){return X(_.noteType,_.noteId)}function fe(_){return ne(_.noteType,_.noteId)}function X(_,oe){return ye(_+"-"+oe)}function ne(_,oe){return ye(_+"-ref-"+oe)}function ye(_){return E+_}var te=g.elements([g.element("table",{},{fresh:!0})]);function le(_,oe,q){return z(_,te).wrap(function(){return we(_,oe,q)})}function we(_,oe,q){var j=x.findIndex(_.children,function(S){return!S.type===a.types.tableRow||!S.isHeader});j===-1&&(j=_.children.length);var D;if(j===0)D=Y(_.children,oe,x.extend({},q,{isTableHeader:!1}));else{var f=Y(_.children.slice(0,j),oe,x.extend({},q,{isTableHeader:!0})),v=Y(_.children.slice(j),oe,x.extend({},q,{isTableHeader:!1}));D=[i.freshElement("thead",{},f),i.freshElement("tbody",{},v)]}return[i.forceWrite].concat(D)}function _e(_,oe,q){var j=Y(_.children,oe,q);return[i.freshElement("tr",{},[i.forceWrite].concat(j))]}function ve(_,oe,q){var j=q.isTableHeader?"th":"td",D=Y(_.children,oe,q),f={};return _.colSpan!==1&&(f.colspan=_.colSpan.toString()),_.rowSpan!==1&&(f.rowspan=_.rowSpan.toString()),[i.freshElement(j,f,[i.forceWrite].concat(D))]}function xe(_,oe,q){return z(_,g.ignore).wrap(function(){var j=n[_.commentId],D=M.length+1,f="["+o(j)+D+"]";return M.push({label:f,comment:j}),[i.freshElement("a",{href:"#"+X("comment",_.commentId),id:ne("comment",_.commentId)},[i.text(f)])]})}function Ce(_,oe,q){var j=_.label,D=_.comment,f=Y(D.body,oe,q).concat([i.nonFreshElement("p",{},[i.text(" "),i.freshElement("a",{href:"#"+ne("comment",D.commentId)},[i.text("↑")])])]);return[i.freshElement("dt",{id:X("comment",D.commentId)},[i.text("Comment "+j)]),i.freshElement("dd",{},f)]}function Se(_,oe,q){return Oe(_).wrap(function(){return[]})}function Oe(_){var oe=H(_);return oe?oe.to:_.breakType==="line"?g.topLevelElement("br"):g.empty}var Le={document:function(_,oe,q){var j=Y(_.children,oe,q),D=U.map(function(v){return _.notes.resolve(v)}),f=Y(D,oe,q);return j.concat([i.freshElement("ol",{},f),i.freshElement("dl",{},l(M,function(v){return Ce(v,oe,q)}))])},paragraph:F,run:T,text:function(_,oe,q){return[i.text(_.value)]},tab:function(_,oe,q){return[i.text(" ")]},hyperlink:function(_,oe,q){var j=_.anchor?"#"+ye(_.anchor):_.href,D={href:j};_.targetFrame!=null&&(D.target=_.targetFrame);var f=Y(_.children,oe,q);return[i.nonFreshElement("a",D,f)]},checkbox:function(_){var oe={type:"checkbox"};return _.checked&&(oe.checked="checked"),[i.freshElement("input",oe)]},bookmarkStart:function(_,oe,q){var j=i.freshElement("a",{id:ye(_.name)},[i.forceWrite]);return[j]},noteReference:function(_,oe,q){U.push(_);var j=i.freshElement("a",{href:"#"+K(_),id:fe(_)},[i.text("["+m+++"]")]);return[i.freshElement("sup",{},[j])]},note:function(_,oe,q){var j=Y(_.body,oe,q),D=i.elementWithTag(g.element("p",{},{fresh:!1}),[i.text(" "),i.freshElement("a",{href:"#"+fe(_)},[i.text("↑")])]),f=j.concat([D]);return i.freshElement("li",{id:K(_)},f)},commentReference:xe,comment:Ce,image:c(re(t.convertImage||s.dataUri)),table:le,tableRow:_e,tableCell:ve,break:Se};return{convertToHtml:A}}var h=1;function c(t){return function(n,m,U){return[{type:"deferred",id:h++,value:function(){return t(n,m,U)}}]}}function y(t,n){return p.warning("Unrecognised "+t+" style: '"+n.styleName+"' (Style ID: "+n.styleId+")")}function l(t,n){return x.flatten(t.map(n),!0)}function d(t,n){t.forEach(function(m){n(m),m.children&&d(m.children,n)})}var o=W.commentAuthorLabel=function(n){return n.authorInitials||""}},{"./documents":4,"./html":18,"./images":20,"./promises":23,"./results":25,"./styles/html-paths":28,"./writers":33,underscore:102}],4:[function(C,ie,W){(function(x){var b=C("underscore"),a=W.types={document:"document",paragraph:"paragraph",run:"run",text:"text",tab:"tab",checkbox:"checkbox",hyperlink:"hyperlink",noteReference:"noteReference",image:"image",note:"note",commentReference:"commentReference",comment:"comment",table:"table",tableRow:"tableRow",tableCell:"tableCell",break:"break",bookmarkStart:"bookmarkStart"};function g(I,R){return R=R||{},{type:a.document,children:I,notes:R.notes||new y({}),comments:R.comments||[]}}function p(I,R){R=R||{};var A=R.indent||{};return{type:a.paragraph,children:I,styleId:R.styleId||null,styleName:R.styleName||null,numbering:R.numbering||null,alignment:R.alignment||null,indent:{start:A.start||null,end:A.end||null,firstLine:A.firstLine||null,hanging:A.hanging||null}}}function s(I,R){return R=R||{},{type:a.run,children:I,styleId:R.styleId||null,styleName:R.styleName||null,isBold:!!R.isBold,isUnderline:!!R.isUnderline,isItalic:!!R.isItalic,isStrikethrough:!!R.isStrikethrough,isAllCaps:!!R.isAllCaps,isSmallCaps:!!R.isSmallCaps,verticalAlignment:R.verticalAlignment||i.baseline,font:R.font||null,fontSize:R.fontSize||null,highlight:R.highlight||null}}var i={baseline:"baseline",superscript:"superscript",subscript:"subscript"};function e(I){return{type:a.text,value:I}}function r(){return{type:a.tab}}function u(I){return{type:a.checkbox,checked:I.checked}}function h(I,R){return{type:a.hyperlink,children:I,href:R.href,anchor:R.anchor,targetFrame:R.targetFrame}}function c(I){return{type:a.noteReference,noteType:I.noteType,noteId:I.noteId}}function y(I){this._notes=b.indexBy(I,function(R){return t(R.noteType,R.noteId)})}y.prototype.resolve=function(I){return this.findNoteByKey(t(I.noteType,I.noteId))},y.prototype.findNoteByKey=function(I){return this._notes[I]||null};function l(I){return{type:a.note,noteType:I.noteType,noteId:I.noteId,body:I.body}}function d(I){return{type:a.commentReference,commentId:I.commentId}}function o(I){return{type:a.comment,commentId:I.commentId,body:I.body,authorName:I.authorName,authorInitials:I.authorInitials}}function t(I,R){return I+"-"+R}function n(I){return{type:a.image,read:function(R){return R?I.readImage(R):I.readImage().then(function(A){return x.from(A)})},readAsArrayBuffer:function(){return I.readImage()},readAsBase64String:function(){return I.readImage("base64")},readAsBuffer:function(){return I.readImage().then(function(R){return x.from(R)})},altText:I.altText,contentType:I.contentType}}function m(I,R){return R=R||{},{type:a.table,children:I,styleId:R.styleId||null,styleName:R.styleName||null}}function U(I,R){return R=R||{},{type:a.tableRow,children:I,isHeader:R.isHeader||!1}}function M(I,R){return R=R||{},{type:a.tableCell,children:I,colSpan:R.colSpan==null?1:R.colSpan,rowSpan:R.rowSpan==null?1:R.rowSpan}}function E(I){return{type:a.break,breakType:I}}function k(I){return{type:a.bookmarkStart,name:I.name}}W.document=W.Document=g,W.paragraph=W.Paragraph=p,W.run=W.Run=s,W.text=W.Text=e,W.tab=W.Tab=r,W.checkbox=W.Checkbox=u,W.Hyperlink=h,W.noteReference=W.NoteReference=c,W.Notes=y,W.Note=l,W.commentReference=d,W.comment=o,W.Image=n,W.Table=m,W.TableRow=U,W.TableCell=M,W.lineBreak=E("line"),W.pageBreak=E("page"),W.columnBreak=E("column"),W.BookmarkStart=k,W.verticalAlignment=i}).call(this,C("buffer").Buffer)},{buffer:83,underscore:102}],5:[function(C,ie,W){W.createBodyReader=r,W._readNumberingProperties=h;var x=C("dingbat-to-unicode"),b=C("underscore"),a=C("../documents"),g=C("../results").Result,p=C("../results").warning,s=C("../xml"),i=C("../transforms"),e=C("./uris");function r(E){return{readXmlElement:function(k){return new u(E).readXmlElement(k)},readXmlElements:function(k){return new u(E).readXmlElements(k)}}}function u(E){var k=[],I=[],R=[],A=E.relationships,Y=E.contentTypes,ae=E.docxFile,F=E.files,V=E.numbering,T=E.styles;function $(ce){var be=ce.map(z);return m(be)}function z(ce){if(ce.type==="element"){var be=j[ce.name];if(be)return be(ce);if(!Object.prototype.hasOwnProperty.call(y,ce.name)){var De=p("An unrecognised element was ignored: "+ce.name);return l([De])}}return d()}function H(ce){return te(ce).map(function(be){return{type:"paragraphProperties",styleId:be.styleId,styleName:be.name,alignment:ce.firstOrEmpty("w:jc").attributes["w:val"],numbering:h(be.styleId,ce.firstOrEmpty("w:numPr"),V),indent:re(ce.firstOrEmpty("w:ind"))}})}function re(ce){return{start:ce.attributes["w:start"]||ce.attributes["w:left"],end:ce.attributes["w:end"]||ce.attributes["w:right"],firstLine:ce.attributes["w:firstLine"],hanging:ce.attributes["w:hanging"]}}function K(ce){return le(ce).map(function(be){var De=ce.firstOrEmpty("w:sz").attributes["w:val"],Fe=/^[0-9]+$/.test(De)?parseInt(De,10)/2:null;return{type:"runProperties",styleId:be.styleId,styleName:be.name,verticalAlignment:ce.firstOrEmpty("w:vertAlign").attributes["w:val"],font:ce.firstOrEmpty("w:rFonts").attributes["w:ascii"],fontSize:Fe,isBold:X(ce.first("w:b")),isUnderline:fe(ce.first("w:u")),isItalic:X(ce.first("w:i")),isStrikethrough:X(ce.first("w:strike")),isAllCaps:X(ce.first("w:caps")),isSmallCaps:X(ce.first("w:smallCaps")),highlight:ye(ce.firstOrEmpty("w:highlight").attributes["w:val"])}})}function fe(ce){if(ce){var be=ce.attributes["w:val"];return be!==void 0&&be!=="false"&&be!=="0"&&be!=="none"}else return!1}function X(ce){if(ce){var be=ce.attributes["w:val"];return be!=="false"&&be!=="0"}else return!1}function ne(ce){return ce!=="false"&&ce!=="0"}function ye(ce){return!ce||ce==="none"?null:ce}function te(ce){return _e(ce,"w:pStyle","Paragraph",T.findParagraphStyleById)}function le(ce){return _e(ce,"w:rStyle","Run",T.findCharacterStyleById)}function we(ce){return _e(ce,"w:tblStyle","Table",T.findTableStyleById)}function _e(ce,be,De,Fe){var We=[],Me=ce.first(be),ze=null,je=null;if(Me&&(ze=Me.attributes["w:val"],ze)){var O=Fe(ze);O?je=O.name:We.push(Re(De,ze))}return t({styleId:ze,name:je},We)}function ve(ce){var be=ce.attributes["w:fldCharType"];if(be==="begin")k.push({type:"begin",fldChar:ce}),I=[];else if(be==="end"){var De=k.pop();if(De.type==="begin"&&(De=Ce(De)),De.type==="checkbox")return o(a.checkbox({checked:De.checked}))}else if(be==="separate"){var Fe=k.pop(),We=Ce(Fe);k.push(We)}return d()}function xe(){var ce=b.last(k.filter(function(be){return be.type==="hyperlink"}));return ce?ce.options:null}function Ce(ce){return Se(I.join(""),ce.type==="begin"?ce.fldChar:s.emptyElement)}function Se(ce,be){var De=/^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(ce);if(De){var Fe=De[2]===void 0?De[3]:De[2],We=De[1]===void 0?{href:Fe}:{anchor:Fe};return{type:"hyperlink",options:We}}var Me=/\s*FORMCHECKBOX\s*/.exec(ce);if(Me){var ze=be.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox"),je=ze.first("w:checked"),O=je==null?X(ze.first("w:default")):X(je);return{type:"checkbox",checked:O}}return{type:"unknown"}}function Oe(ce){return I.push(ce.text()),d()}function Le(ce){var be=ce.attributes["w:font"],De=ce.attributes["w:char"],Fe=x.hex(be,De);return Fe==null&&/^F0..$/.test(De)&&(Fe=x.hex(be,De.substring(2))),Fe==null?l([p("A w:sym element with an unsupported character was ignored: char "+De+" in font "+be)]):o(new a.Text(Fe.string))}function _(ce){return function(be){var De=be.attributes["w:id"];return o(new a.NoteReference({noteType:ce,noteId:De}))}}function oe(ce){return o(a.commentReference({commentId:ce.attributes["w:id"]}))}function q(ce){return $(ce.children)}var j={"w:p":function(ce){var be=ce.firstOrEmpty("w:pPr"),De=!!be.firstOrEmpty("w:rPr").first("w:del");if(De)return ce.children.forEach(function(We){R.push(We)}),d();var Fe=ce.children;return R.length>0&&(Fe=R.concat(Fe),R=[]),n.map(H(be),$(Fe),function(We,Me){return new a.Paragraph(Me,We)}).insertExtra()},"w:r":function(ce){return n.map(K(ce.firstOrEmpty("w:rPr")),$(ce.children),function(be,De){var Fe=xe();return Fe!==null&&(De=[new a.Hyperlink(De,Fe)]),new a.Run(De,be)})},"w:fldChar":ve,"w:instrText":Oe,"w:t":function(ce){return o(new a.Text(ce.text()))},"w:tab":function(ce){return o(new a.Tab)},"w:noBreakHyphen":function(){return o(new a.Text("‑"))},"w:softHyphen":function(ce){return o(new a.Text(""))},"w:sym":Le,"w:hyperlink":function(ce){var be=ce.attributes["r:id"],De=ce.attributes["w:anchor"];return $(ce.children).map(function(Fe){function We(ze){var je=ce.attributes["w:tgtFrame"]||null;return new a.Hyperlink(Fe,b.extend({targetFrame:je},ze))}if(be){var Me=A.findTargetByRelationshipId(be);return De&&(Me=e.replaceFragment(Me,De)),We({href:Me})}else return De?We({anchor:De}):Fe})},"w:tbl":D,"w:tr":v,"w:tc":S,"w:footnoteReference":_("footnote"),"w:endnoteReference":_("endnote"),"w:commentReference":oe,"w:br":function(ce){var be=ce.attributes["w:type"];return be==null||be==="textWrapping"?o(a.lineBreak):be==="page"?o(a.pageBreak):be==="column"?o(a.columnBreak):l([p("Unsupported break type: "+be)])},"w:bookmarkStart":function(ce){var be=ce.attributes["w:name"];return be==="_GoBack"?d():o(new a.BookmarkStart({name:be}))},"mc:AlternateContent":function(ce){return q(ce.firstOrEmpty("mc:Fallback"))},"w:sdt":function(ce){var be=$(ce.firstOrEmpty("w:sdtContent").children);return be.map(function(De){var Fe=ce.firstOrEmpty("w:sdtPr").first("wordml:checkbox");if(Fe){var We=Fe.first("wordml:checked"),Me=!!We&&ne(We.attributes["wordml:val"]),ze=a.checkbox({checked:Me}),je=!1,O=De.map(i._elementsOfType(a.types.text,function(P){return P.value.length>0&&!je?(je=!0,ze):P}));return je?O:ze}else return De})},"w:ins":q,"w:object":q,"w:smartTag":q,"w:drawing":q,"w:pict":function(ce){return q(ce).toExtra()},"v:roundrect":q,"v:shape":q,"v:textbox":q,"w:txbxContent":q,"wp:inline":Z,"wp:anchor":Z,"v:imagedata":Ae,"v:group":q,"v:rect":q};return{readXmlElement:z,readXmlElements:$};function D(ce){var be=f(ce.firstOrEmpty("w:tblPr"));return $(ce.children).flatMap(J).flatMap(function(De){return be.map(function(Fe){return a.Table(De,Fe)})})}function f(ce){return we(ce).map(function(be){return{styleId:be.styleId,styleName:be.name}})}function v(ce){var be=ce.firstOrEmpty("w:trPr"),De=!!be.first("w:del");if(De)return d();var Fe=!!be.first("w:tblHeader");return $(ce.children).map(function(We){return a.TableRow(We,{isHeader:Fe})})}function S(ce){return $(ce.children).map(function(be){var De=ce.firstOrEmpty("w:tcPr"),Fe=De.firstOrEmpty("w:gridSpan").attributes["w:val"],We=Fe?parseInt(Fe,10):1,Me=a.TableCell(be,{colSpan:We});return Me._vMerge=N(De),Me})}function N(ce){var be=ce.first("w:vMerge");if(be){var De=be.attributes["w:val"];return De==="continue"||!De}else return null}function J(ce){var be=b.any(ce,function(We){return We.type!==a.types.tableRow});if(be)return L(ce),t(ce,[p("unexpected non-row element in table, cell merging may be incorrect")]);var De=b.any(ce,function(We){return b.any(We.children,function(Me){return Me.type!==a.types.tableCell})});if(De)return L(ce),t(ce,[p("unexpected non-cell element in table row, cell merging may be incorrect")]);var Fe={};return ce.forEach(function(We){var Me=0;We.children.forEach(function(ze){ze._vMerge&&Fe[Me]?Fe[Me].rowSpan++:(Fe[Me]=ze,ze._vMerge=!1),Me+=ze.colSpan})}),ce.forEach(function(We){We.children=We.children.filter(function(Me){return!Me._vMerge}),We.children.forEach(function(Me){delete Me._vMerge})}),o(ce)}function L(ce){ce.forEach(function(be){var De=i.getDescendantsOfType(be,a.types.tableCell);De.forEach(function(Fe){delete Fe._vMerge})})}function Z(ce){var be=ce.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");return m(be.map(ue.bind(null,ce)))}function ue(ce,be){var De=ce.firstOrEmpty("wp:docPr"),Fe=De.attributes,We=he(Fe.descr)?Fe.title:Fe.descr,Me=ge(be);return Me===null?l([p("Could not find image file for a:blip element")]):Ee(Me,We).map(function(ze){var je=De.firstOrEmpty("a:hlinkClick"),O=je.attributes["r:id"];if(O){var P=A.findTargetByRelationshipId(O);return new a.Hyperlink([ze],{href:P})}else return ze})}function he(ce){return ce==null||/^\s*$/.test(ce)}function ge(ce){var be=ce.attributes["r:embed"],De=ce.attributes["r:link"];if(be)return Be(be);if(De){var Fe=A.findTargetByRelationshipId(De);return{path:Fe,read:F.read.bind(F,Fe)}}else return null}function Ae(ce){var be=ce.attributes["r:id"];return be?Ee(Be(be),ce.attributes["o:title"]):l([p("A v:imagedata element without a relationship ID was ignored")])}function Be(ce){var be=e.uriToZipEntryName("word",A.findTargetByRelationshipId(ce));return{path:be,read:ae.read.bind(ae,be)}}function Ee(ce,be){var De=Y.findContentType(ce.path),Fe=a.Image({readImage:ce.read,altText:be,contentType:De}),We=c[De]?[]:p("Image of type "+De+" is unlikely to display in web browsers");return t(Fe,We)}function Re(ce,be){return p(ce+" style with ID "+be+" was referenced but not defined in the document")}}function h(E,k,I){var R=k.firstOrEmpty("w:ilvl").attributes["w:val"],A=k.firstOrEmpty("w:numId").attributes["w:val"];if(R!==void 0&&A!==void 0)return I.findLevel(A,R);if(E!=null){var Y=I.findLevelByParagraphStyleId(E);if(Y!=null)return Y}return A!==void 0?I.findLevel(A,"0"):null}var c={"image/png":!0,"image/gif":!0,"image/jpeg":!0,"image/svg+xml":!0,"image/tiff":!0},y={"office-word:wrap":!0,"v:shadow":!0,"v:shapetype":!0,"w:annotationRef":!0,"w:bookmarkEnd":!0,"w:sectPr":!0,"w:proofErr":!0,"w:lastRenderedPageBreak":!0,"w:commentRangeStart":!0,"w:commentRangeEnd":!0,"w:del":!0,"w:footnoteRef":!0,"w:endnoteRef":!0,"w:pPr":!0,"w:rPr":!0,"w:tblPr":!0,"w:tblGrid":!0,"w:trPr":!0,"w:tcPr":!0};function l(E){return new n(null,null,E)}function d(){return new n(null)}function o(E){return new n(E)}function t(E,k){return new n(E,null,k)}function n(E,k,I){this.value=E||[],this.extra=k||[],this._result=new g({element:this.value,extra:k},I),this.messages=this._result.messages}n.prototype.toExtra=function(){return new n(null,U(this.extra,this.value),this.messages)},n.prototype.insertExtra=function(){var E=this.extra;return E&&E.length?new n(U(this.value,E),null,this.messages):this},n.prototype.map=function(E){var k=this._result.map(function(I){return E(I.element)});return new n(k.value,this.extra,k.messages)},n.prototype.flatMap=function(E){var k=this._result.flatMap(function(I){return E(I.element)._result});return new n(k.value.element,U(this.extra,k.value.extra),k.messages)},n.map=function(E,k,I){return new n(I(E.value,k.value),U(E.extra,k.extra),E.messages.concat(k.messages))};function m(E){var k=g.combine(b.pluck(E,"_result"));return new n(b.flatten(b.pluck(k.value,"element")),b.filter(b.flatten(b.pluck(k.value,"extra")),M),k.messages)}function U(E,k){return b.flatten([E,k])}function M(E){return E}},{"../documents":4,"../results":25,"../transforms":30,"../xml":35,"./uris":16,"dingbat-to-unicode":85,underscore:102}],6:[function(C,ie,W){var x=C("../documents"),b=C("../results").Result;function a(g){function p(i){return b.combine(i.getElementsByTagName("w:comment").map(s))}function s(i){var e=i.attributes["w:id"];function r(u){return(i.attributes[u]||"").trim()||null}return g.readXmlElements(i.children).map(function(u){return x.comment({commentId:e,body:u,authorName:r("w:author"),authorInitials:r("w:initials")})})}return p}W.createCommentsReader=a},{"../documents":4,"../results":25}],7:[function(C,ie,W){W.readContentTypesFromXml=b;var x={png:"png",gif:"gif",jpeg:"jpeg",jpg:"jpeg",tif:"tiff",tiff:"tiff",bmp:"bmp"};W.defaultContentTypes=a({},{});function b(g){var p={},s={};return g.children.forEach(function(i){if(i.name==="content-types:Default"&&(p[i.attributes.Extension]=i.attributes.ContentType),i.name==="content-types:Override"){var e=i.attributes.PartName;e.charAt(0)==="/"&&(e=e.substring(1)),s[e]=i.attributes.ContentType}}),a(s,p)}function a(g,p){return{findContentType:function(s){var i=g[s];if(i)return i;var e=s.split("."),r=e[e.length-1];if(p.hasOwnProperty(r))return p[r];var u=x[r.toLowerCase()];return u?"image/"+u:null}}}},{}],8:[function(C,ie,W){W.DocumentXmlReader=a;var x=C("../documents"),b=C("../results").Result;function a(g){var p=g.bodyReader;function s(i){var e=i.first("w:body");if(e==null)throw new Error("Could not find the body element: are you sure this is a docx file?");var r=p.readXmlElements(e.children).map(function(u){return new x.Document(u,{notes:g.notes,comments:g.comments})});return new b(r.value,r.messages)}return{convertXmlToDocument:s}}},{"../documents":4,"../results":25}],9:[function(C,ie,W){W.read=d,W._findPartPaths=o;var x=C("../promises"),b=C("../documents"),a=C("../results").Result,g=C("../zipfile"),p=C("./office-xml-reader").readXmlFromZipFile,s=C("./body-reader").createBodyReader,i=C("./document-xml-reader").DocumentXmlReader,e=C("./relationships-reader"),r=C("./content-types-reader"),u=C("./numbering-xml"),h=C("./styles-reader"),c=C("./notes-reader"),y=C("./comments-reader"),l=C("./files").Files;function d(A,Y,ae){Y=Y||{},ae=ae||{};var F=new l({externalFileAccess:ae.externalFileAccess,relativeToFile:Y.path});return x.props({contentTypes:E(A),partPaths:o(A),docxFile:A,files:F}).also(function(V){return{styles:I(A,V.partPaths.styles)}}).also(function(V){return{numbering:k(A,V.partPaths.numbering,V.styles)}}).also(function(V){return{footnotes:U(V.partPaths.footnotes,V,function(T,$){return $?c.createFootnotesReader(T)($):new a([])}),endnotes:U(V.partPaths.endnotes,V,function(T,$){return $?c.createEndnotesReader(T)($):new a([])}),comments:U(V.partPaths.comments,V,function(T,$){return $?y.createCommentsReader(T)($):new a([])})}}).also(function(V){return{notes:V.footnotes.flatMap(function(T){return V.endnotes.map(function($){return new b.Notes(T.concat($))})})}}).then(function(V){return U(V.partPaths.mainDocument,V,function(T,$){return V.notes.flatMap(function(z){return V.comments.flatMap(function(H){var re=new i({bodyReader:T,notes:z,comments:H});return re.convertXmlToDocument($)})})})})}function o(A){return R(A).then(function(Y){var ae=t({docxFile:A,relationships:Y,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",basePath:"",fallbackPath:"word/document.xml"});if(!A.exists(ae))throw new Error("Could not find main document part. Are you sure this is a valid .docx file?");return m({filename:M(ae),readElement:e.readRelationships,defaultValue:e.defaultValue})(A).then(function(F){function V(T){return t({docxFile:A,relationships:F,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"+T,basePath:g.splitPath(ae).dirname,fallbackPath:"word/"+T+".xml"})}return{mainDocument:ae,comments:V("comments"),endnotes:V("endnotes"),footnotes:V("footnotes"),numbering:V("numbering"),styles:V("styles")}})})}function t(A){var Y=A.docxFile,ae=A.relationships,F=A.relationshipType,V=A.basePath,T=A.fallbackPath,$=ae.findTargetsByType(F),z=$.map(function(re){return n(g.joinPath(V,re),"/")}),H=z.filter(function(re){return Y.exists(re)});return H.length===0?T:H[0]}function n(A,Y){return A.substring(0,Y.length)===Y?A.substring(Y.length):A}function m(A){return function(Y){return p(Y,A.filename).then(function(ae){return ae?A.readElement(ae):A.defaultValue})}}function U(A,Y,ae){var F=m({filename:M(A),readElement:e.readRelationships,defaultValue:e.defaultValue});return F(Y.docxFile).then(function(V){var T=new s({relationships:V,contentTypes:Y.contentTypes,docxFile:Y.docxFile,numbering:Y.numbering,styles:Y.styles,files:Y.files});return p(Y.docxFile,A).then(function($){return ae(T,$)})})}function M(A){var Y=g.splitPath(A);return g.joinPath(Y.dirname,"_rels",Y.basename+".rels")}var E=m({filename:"[Content_Types].xml",readElement:r.readContentTypesFromXml,defaultValue:r.defaultContentTypes});function k(A,Y,ae){return m({filename:Y,readElement:function(F){return u.readNumberingXml(F,{styles:ae})},defaultValue:u.defaultNumbering})(A)}function I(A,Y){return m({filename:Y,readElement:h.readStylesXml,defaultValue:h.defaultStyles})(A)}var R=m({filename:"_rels/.rels",readElement:e.readRelationships,defaultValue:e.defaultValue})},{"../documents":4,"../promises":23,"../results":25,"../zipfile":40,"./body-reader":5,"./comments-reader":6,"./content-types-reader":7,"./document-xml-reader":8,"./files":1,"./notes-reader":10,"./numbering-xml":11,"./office-xml-reader":12,"./relationships-reader":13,"./styles-reader":15}],10:[function(C,ie,W){var x=C("../documents"),b=C("../results").Result;W.createFootnotesReader=a.bind(this,"footnote"),W.createEndnotesReader=a.bind(this,"endnote");function a(g,p){function s(r){return b.combine(r.getElementsByTagName("w:"+g).filter(i).map(e))}function i(r){var u=r.attributes["w:type"];return u!=="continuationSeparator"&&u!=="separator"}function e(r){var u=r.attributes["w:id"];return p.readXmlElements(r.children).map(function(h){return x.Note({noteType:g,noteId:u,body:h})})}return s}},{"../documents":4,"../results":25}],11:[function(C,ie,W){var x=C("underscore");W.readNumberingXml=a,W.Numbering=b,W.defaultNumbering=new b({},{});function b(i,e,r){var u=x.flatten(x.values(e).map(function(d){return x.values(d.levels)})),h=x.indexBy(u.filter(function(d){return d.paragraphStyleId!=null}),"paragraphStyleId");function c(d,o){return y(d,o,{})}function y(d,o,t){if(t[d])return null;t[d]=!0;var n=i[d];if(!n)return null;var m=e[n.abstractNumId];if(m){if(m.numStyleLink==null)return e[n.abstractNumId].levels[o];var U=r.findNumberingStyleById(m.numStyleLink);return y(U.numId,o,t)}else return null}function l(d){return h[d]||null}return{findLevel:c,findLevelByParagraphStyleId:l}}function a(i,e){if(!e||!e.styles)throw new Error("styles is missing");var r=g(i),u=s(i);return new b(u,r,e.styles)}function g(i){var e={};return i.getElementsByTagName("w:abstractNum").forEach(function(r){var u=r.attributes["w:abstractNumId"];e[u]=p(r)}),e}function p(i){var e={},r=null;i.getElementsByTagName("w:lvl").forEach(function(h){var c=h.attributes["w:ilvl"],y=h.firstOrEmpty("w:numFmt").attributes["w:val"],l=y!=="bullet",d=h.firstOrEmpty("w:pStyle").attributes["w:val"];c===void 0?r={isOrdered:l,level:"0",paragraphStyleId:d}:e[c]={isOrdered:l,level:c,paragraphStyleId:d}}),r!==null&&e[r.level]===void 0&&(e[r.level]=r);var u=i.firstOrEmpty("w:numStyleLink").attributes["w:val"];return{levels:e,numStyleLink:u}}function s(i){var e={};return i.getElementsByTagName("w:num").forEach(function(r){var u=r.attributes["w:numId"],h=r.first("w:abstractNumId").attributes["w:val"];e[u]={abstractNumId:h}}),e}},{underscore:102}],12:[function(C,ie,W){var x=C("underscore"),b=C("../promises"),a=C("../xml");W.read=p,W.readXmlFromZipFile=s;var g={"http://schemas.openxmlformats.org/wordprocessingml/2006/main":"w","http://schemas.openxmlformats.org/officeDocument/2006/relationships":"r","http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing":"wp","http://schemas.openxmlformats.org/drawingml/2006/main":"a","http://schemas.openxmlformats.org/drawingml/2006/picture":"pic","http://purl.oclc.org/ooxml/wordprocessingml/main":"w","http://purl.oclc.org/ooxml/officeDocument/relationships":"r","http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing":"wp","http://purl.oclc.org/ooxml/drawingml/main":"a","http://purl.oclc.org/ooxml/drawingml/picture":"pic","http://schemas.openxmlformats.org/package/2006/content-types":"content-types","http://schemas.openxmlformats.org/package/2006/relationships":"relationships","http://schemas.openxmlformats.org/markup-compatibility/2006":"mc","urn:schemas-microsoft-com:vml":"v","urn:schemas-microsoft-com:office:word":"office-word","http://schemas.microsoft.com/office/word/2010/wordml":"wordml"};function p(r){return a.readString(r,g).then(function(u){return e(u)[0]})}function s(r,u){return r.exists(u)?r.read(u,"utf-8").then(i).then(p):b.resolve(null)}function i(r){return r.replace(/^\uFEFF/g,"")}function e(r){return r.type==="element"?r.name==="mc:AlternateContent"?r.firstOrEmpty("mc:Fallback").children:(r.children=x.flatten(r.children.map(e,!0)),[r]):[r]}},{"../promises":23,"../xml":35,underscore:102}],13:[function(C,ie,W){W.readRelationships=x,W.defaultValue=new b([]),W.Relationships=b;function x(a){var g=[];return a.children.forEach(function(p){if(p.name==="relationships:Relationship"){var s={relationshipId:p.attributes.Id,target:p.attributes.Target,type:p.attributes.Type};g.push(s)}}),new b(g)}function b(a){var g={};a.forEach(function(s){g[s.relationshipId]=s.target});var p={};return a.forEach(function(s){p[s.type]||(p[s.type]=[]),p[s.type].push(s.target)}),{findTargetByRelationshipId:function(s){return g[s]},findTargetsByType:function(s){return p[s]||[]}}}},{}],14:[function(C,ie,W){var x=C("underscore"),b=C("../promises"),a=C("../xml");W.writeStyleMap=i,W.readStyleMap=h;var g="http://schemas.zwobble.org/mammoth/style-map",p="mammoth/style-map",s="/"+p;function i(c,y){return c.write(p,y),e(c).then(function(){return r(c)})}function e(c){var y="word/_rels/document.xml.rels",l="http://schemas.openxmlformats.org/package/2006/relationships",d="{"+l+"}Relationship";return c.read(y,"utf8").then(a.readString).then(function(o){var t=o.children;u(t,d,"Id",{Id:"rMammothStyleMap",Type:g,Target:s});var n={"":l};return c.write(y,a.writeString(o,n))})}function r(c){var y="[Content_Types].xml",l="http://schemas.openxmlformats.org/package/2006/content-types",d="{"+l+"}Override";return c.read(y,"utf8").then(a.readString).then(function(o){var t=o.children;u(t,d,"PartName",{PartName:s,ContentType:"text/prs.mammoth.style-map"});var n={"":l};return c.write(y,a.writeString(o,n))})}function u(c,y,l,d){var o=x.find(c,function(t){return t.name===y&&t.attributes[l]===d[l]});o?o.attributes=d:c.push(a.element(y,d))}function h(c){return c.exists(p)?c.read(p,"utf8"):b.resolve(null)}},{"../promises":23,"../xml":35,underscore:102}],15:[function(C,ie,W){W.readStylesXml=b,W.Styles=x,W.defaultStyles=new x({},{});function x(i,e,r,u){return{findParagraphStyleById:function(h){return i[h]},findCharacterStyleById:function(h){return e[h]},findTableStyleById:function(h){return r[h]},findNumberingStyleById:function(h){return u[h]}}}x.EMPTY=new x({},{},{},{});function b(i){var e={},r={},u={},h={},c={paragraph:e,character:r,table:u,numbering:h};return i.getElementsByTagName("w:style").forEach(function(y){var l=a(y),d=c[l.type];d&&d[l.styleId]===void 0&&(d[l.styleId]=l)}),new x(e,r,u,h)}function a(i){var e=i.attributes["w:type"];if(e==="numbering")return p(e,i);var r=s(i),u=g(i);return{type:e,styleId:r,name:u}}function g(i){var e=i.first("w:name");return e?e.attributes["w:val"]:null}function p(i,e){var r=s(e),u=e.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];return{type:i,numId:u,styleId:r}}function s(i){return i.attributes["w:styleId"]}},{}],16:[function(C,ie,W){W.uriToZipEntryName=x,W.replaceFragment=b;function x(a,g){return g.charAt(0)==="/"?g.substr(1):a+"/"+g}function b(a,g){var p=a.indexOf("#");return p!==-1&&(a=a.substring(0,p)),a+"#"+g}},{}],17:[function(C,ie,W){var x=C("../styles/html-paths");function b(r,u,h){return g(x.element(r,u,{fresh:!1}),h)}function a(r,u,h){var c=x.element(r,u,{fresh:!0});return g(c,h)}function g(r,u){return{type:"element",tag:r,children:u||[]}}function p(r){return{type:"text",value:r}}var s={type:"forceWrite"};W.freshElement=a,W.nonFreshElement=b,W.elementWithTag=g,W.text=p,W.forceWrite=s;var i={br:!0,hr:!0,img:!0,input:!0};function e(r){return r.children.length===0&&i[r.tag.tagName]}W.isVoidElement=e},{"../styles/html-paths":28}],18:[function(C,ie,W){var x=C("./ast");W.freshElement=x.freshElement,W.nonFreshElement=x.nonFreshElement,W.elementWithTag=x.elementWithTag,W.text=x.text,W.forceWrite=x.forceWrite,W.simplify=C("./simplify");function b(i,e){e.forEach(function(r){a(i,r)})}function a(i,e){g[e.type](i,e)}var g={element:p,text:s,forceWrite:function(){}};function p(i,e){x.isVoidElement(e)?i.selfClosing(e.tag.tagName,e.tag.attributes):(i.open(e.tag.tagName,e.tag.attributes),b(i,e.children),i.close(e.tag.tagName))}function s(i,e){i.text(e.value)}W.write=b},{"./ast":17,"./simplify":19}],19:[function(C,ie,W){var x=C("underscore"),b=C("./ast");function a(o){return g(u(o))}function g(o){var t=[];return o.map(p).forEach(function(n){r(t,n)}),t}function p(o){return s[o.type](o)}var s={element:i,text:e,forceWrite:e};function i(o){return b.elementWithTag(o.tag,g(o.children))}function e(o){return o}function r(o,t){var n=o[o.length-1];t.type==="element"&&!t.tag.fresh&&n&&n.type==="element"&&t.tag.matchesElement(n.tag)?(t.tag.separator&&r(n.children,b.text(t.tag.separator)),t.children.forEach(function(m){r(n.children,m)})):o.push(t)}function u(o){return h(o,function(t){return c[t.type](t)})}function h(o,t){return x.flatten(x.map(o,t),!0)}var c={element:l,text:d,forceWrite:y};function y(o){return[o]}function l(o){var t=u(o.children);return t.length===0&&!b.isVoidElement(o)?[]:[b.elementWithTag(o.tag,t)]}function d(o){return o.value.length===0?[]:[o]}ie.exports=a},{"./ast":17,underscore:102}],20:[function(C,ie,W){var x=C("underscore"),b=C("./promises"),a=C("./html");W.imgElement=g;function g(s){return function(i,e){return b.when(s(i)).then(function(r){var u={};return i.altText&&(u.alt=i.altText),x.extend(u,r),[a.freshElement("img",u)]})}}W.inline=W.imgElement,W.dataUri=g(function(s){return s.readAsBase64String().then(function(i){return{src:"data:"+s.contentType+";base64,"+i}})});function p(s){return s.contentType.split(/\/|\\/)[1]}W.imageFilenameExtension=p},{"./html":18,"./promises":23,underscore:102}],21:[function(C,ie,W){(function(x){var b=C("underscore"),a=C("./docx/docx-reader"),g=C("./docx/style-map"),p=C("./document-to-html").DocumentConverter,s=C("./raw-text").convertElementToRawText,i=C("./style-reader").readStyle,e=C("./options-reader").readOptions,r=C("./unzip"),u=C("./results").Result;W.convertToHtml=h,W.convertToMarkdown=c,W.convert=y,W.extractRawText=t,W.images=C("./images"),W.transforms=C("./transforms"),W.underline=C("./underline"),W.embedStyleMap=n,W.readEmbeddedStyleMap=l;function h(m,U){return y(m,U)}function c(m,U){var M=Object.create(U||{});return M.outputFormat="markdown",y(m,M)}function y(m,U){return U=e(U),r.openZip(m).tap(function(M){return g.readStyleMap(M).then(function(E){U.embeddedStyleMap=E})}).then(function(M){return a.read(M,m,U).then(function(E){return E.map(U.transformDocument)}).then(function(E){return d(E,U)})})}function l(m){return r.openZip(m).then(g.readStyleMap)}function d(m,U){var M=o(U.readStyleMap()),E=b.extend({},U,{styleMap:M.value}),k=new p(E);return m.flatMapThen(function(I){return M.flatMapThen(function(R){return k.convertToHtml(I)})})}function o(m){return u.combine((m||[]).map(i)).map(function(U){return U.filter(function(M){return!!M})})}function t(m){return r.openZip(m).then(a.read).then(function(U){return U.map(s)})}function n(m,U){return r.openZip(m).tap(function(M){return g.writeStyleMap(M,U)}).then(function(M){return M.toArrayBuffer()}).then(function(M){return{toArrayBuffer:function(){return M},toBuffer:function(){return x.from(M)}}})}W.styleMapping=function(){throw new Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`)}}).call(this,C("buffer").Buffer)},{"./document-to-html":3,"./docx/docx-reader":9,"./docx/style-map":14,"./images":20,"./options-reader":22,"./raw-text":24,"./results":25,"./style-reader":26,"./transforms":30,"./underline":31,"./unzip":2,buffer:83,underscore:102}],22:[function(C,ie,W){W.readOptions=g;var x=C("underscore"),b=W._defaultStyleMap=["p.Heading1 => h1:fresh","p.Heading2 => h2:fresh","p.Heading3 => h3:fresh","p.Heading4 => h4:fresh","p.Heading5 => h5:fresh","p.Heading6 => h6:fresh","p[style-name='Heading 1'] => h1:fresh","p[style-name='Heading 2'] => h2:fresh","p[style-name='Heading 3'] => h3:fresh","p[style-name='Heading 4'] => h4:fresh","p[style-name='Heading 5'] => h5:fresh","p[style-name='Heading 6'] => h6:fresh","p[style-name='heading 1'] => h1:fresh","p[style-name='heading 2'] => h2:fresh","p[style-name='heading 3'] => h3:fresh","p[style-name='heading 4'] => h4:fresh","p[style-name='heading 5'] => h5:fresh","p[style-name='heading 6'] => h6:fresh","p.Heading => h1:fresh","p[style-name='Heading'] => h1:fresh","r[style-name='Strong'] => strong","p[style-name='footnote text'] => p:fresh","r[style-name='footnote reference'] =>","p[style-name='endnote text'] => p:fresh","r[style-name='endnote reference'] =>","p[style-name='annotation text'] => p:fresh","r[style-name='annotation reference'] =>","p[style-name='Footnote'] => p:fresh","r[style-name='Footnote anchor'] =>","p[style-name='Endnote'] => p:fresh","r[style-name='Endnote anchor'] =>","p:unordered-list(1) => ul > li:fresh","p:unordered-list(2) => ul|ol > li > ul > li:fresh","p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:ordered-list(1) => ol > li:fresh","p:ordered-list(2) => ul|ol > li > ol > li:fresh","p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","r[style-name='Hyperlink'] =>","p[style-name='Normal'] => p:fresh","p.Body => p:fresh","p[style-name='Body'] => p:fresh"],a=W._standardOptions={externalFileAccess:!1,transformDocument:s,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function g(i){return i=i||{},x.extend({},a,i,{customStyleMap:p(i.styleMap),readStyleMap:function(){var e=this.customStyleMap;return this.includeEmbeddedStyleMap&&(e=e.concat(p(this.embeddedStyleMap))),this.includeDefaultStyleMap&&(e=e.concat(b)),e}})}function p(i){return i?x.isString(i)?i.split(`
|
|
3
3
|
`).map(function(e){return e.trim()}).filter(function(e){return e!==""&&e.charAt(0)!=="#"}):i:[]}function s(i){return i}},{underscore:102}],23:[function(C,ie,W){var x=C("underscore"),b=C("bluebird/js/release/promise")();W.defer=a,W.when=b.resolve,W.resolve=b.resolve,W.all=b.all,W.props=b.props,W.reject=b.reject,W.promisify=b.promisify,W.mapSeries=b.mapSeries,W.attempt=b.attempt,W.nfcall=function(g){var p=Array.prototype.slice.call(arguments,1),s=b.promisify(g);return s.apply(null,p)},b.prototype.fail=b.prototype.caught,b.prototype.also=function(g){return this.then(function(p){var s=x.extend({},p,g(p));return b.props(s)})};function a(){var g,p,s=new b.Promise(function(i,e){g=i,p=e});return{resolve:g,reject:p,promise:s}}},{"bluebird/js/release/promise":68,underscore:102}],24:[function(C,ie,W){var x=C("./documents");function b(a){if(a.type==="text")return a.value;if(a.type===x.types.tab)return" ";var g=a.type==="paragraph"?`
|
|
4
4
|
|