{"version":3,"sources":["jsdelivr-header.js","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/generic/cleanHTML.ts","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/microsoft-word/isWordHTML.ts","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/microsoft-word/cleanHTML.ts","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/google-docs/isGoogleDocsHTML.ts","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/google-docs/cleanHTML.ts","/npm/@vericus/slate-kit-paste-helpers@0.2.18/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,6bCLA,SAAA,aAAe,O,uHAAA,OAAA,EAAA,KAAA,EAAA,MAAA,cAAA,EAAA,OAAA,aAAA,SAAA,SAAA,GAAA,IAAA,GAAA,IAAA,WAAA,gBAAA,EAAA,aAAA,EAAA,KAAA,MAAA,EACN,KAAA,WAAY,GACjB,KAFW,O,UAAA,OAAA,EAAA,OAAA,GAAA,EAAA,MAAA,MAAA,KAAA,UAAA,C,4GCDA,C,iECEf,UAAA,eAAe,O,yHAAA,OAAA,EAAA,KAAA,EAAA,MAAA,cAAA,EAAA,OAAA,SAAA,QAAA,UAAA,MAAA,kBAAA,QAAA,gCAAA,MAAA,SAAA,GACN,OAAA,KAAA,QAAA,EAAA,QAAA,GAAyC,EAC9C,KAFW,O,UAAA,OAAA,EAAA,OAAA,GAAA,EAAA,MAAA,MAAA,KAAA,UAAA,C,0ECFA,C,iECCf,UAAA,eAAe,O,yHAAA,OAAA,EAAA,KAAA,EAAA,MAAA,cAAA,EAAA,OAAA,aAAA,SAAA,SAAA,KAAA,EAAA,QAAA,iE,UAAA,OAAA,EAAA,OAAA,GAAA,EAAA,MAAA,MAAA,KAAA,UAAA,C,+BCkBA,QAAA,CACb,WAAO,SAAA,EAAA,GACL,OAAS,WAAA,EACP,EAAY,iBAAmC,SAAnC,EAAA,GADL,OAAA,iBAAA,EAEP,EAAkB,iBAFX,EAA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npm/@vericus/slate-kit-paste-helpers@0.2.18/lib/slate-kit-paste-helpers.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@vericus/slate-kit-paste-helpers@0.2.18/lib/slate-kit-paste-helpers.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// remove everything from HTML string except the content of <body/>\nexport default async function cleanHTML(html: string): Promise<string> {\n  return new Promise((resolve) => {\n    const dom = new DOMParser().parseFromString(html, \"text/html\");\n    resolve((dom && dom.body && dom.body.innerHTML) || \"\");\n  });\n}\n","export default function isWordHTML(html: string): boolean {\n  return (\n    html\n      .toString()\n      .match(/(class=\"?Mso|style=\"[^\"]*\\bmso-|w:WordDocument)/gi) !== null\n  );\n}\n","// filter pasted HTML using wordFilter from tinymce to get rid of\n// metadata tags that shouldn't be deserialize on pasting\nexport default async function cleanHTML(html: string): Promise<string> {\n  return import(\"tinymce-word-paste-filter\").then((wordFilter) => {\n    const fn =\n      wordFilter && wordFilter.default ? wordFilter.default : wordFilter;\n    return fn(html);\n  });\n}\n","export default function isGoogleDocsHTML(html: string): boolean {\n  return html.indexOf('id=\"docs-internal-guid') >= 0;\n}\n","// remove unnecessary wrapping <b/> that will be pasted over from google docs\nexport default async function cleanHTML(html: string): Promise<string> {\n  return new Promise((resolve) => {\n    resolve(html.replace(/^.* id=\"docs-internal-guid[^>]*>(.*)<\\/b>.*$/, \"$1\"));\n  });\n}\n","import { Editor, Plugin } from \"slate\";\nimport genericClean from \"./generic\";\nimport wordClean, { isWordHTML } from \"./microsoft-word\";\nimport googleDocsClean, { isGoogleDocsHTML } from \"./google-docs\";\n\nexport interface PasteHelperPlugin extends Plugin {\n  queries: {\n    isWordHTML: (editor: Editor, HTMLstring: string) => boolean;\n    isGoogleDocsHTML: (editor: Editor, HTMLstring: string) => boolean;\n    cleanedWordHTML: (editor: Editor, HTMLstring: string) => Promise<string>;\n    cleanedDocsHTML: (editor: Editor, HTMLstring: string) => Promise<string>;\n    cleanedGenericHTML: (editor: Editor, HTMLstring: string) => Promise<string>;\n    cleanHTML: (\n      editor: Editor,\n      HTMLstring: string\n    ) => Promise<{ origin: \"word\" | \"docs\" | \"generic\"; cleanedHTML: string }>;\n  };\n}\n\nexport default function PasteHelpers(): PasteHelperPlugin {\n  return {\n    queries: {\n      isWordHTML: (_editor: Editor, html: string) => isWordHTML(html),\n      isGoogleDocsHTML: (_editor: Editor, html: string) =>\n        isGoogleDocsHTML(html),\n      cleanedWordHTML: async (_editor: Editor, html: string) => wordClean(html),\n      cleanedDocsHTML: async (_editor: Editor, html: string) =>\n        googleDocsClean(html),\n      cleanedGenericHTML: async (_editor: Editor, html: string) =>\n        genericClean(html),\n      cleanHTML: async (editor: Editor, html: string) => {\n        let cleanedHTML;\n        if (editor.isWordHTML(html)) {\n          cleanedHTML = await editor.cleanedWordHTML(html);\n          return {\n            origin: \"word\",\n            cleanedHTML,\n          };\n        }\n        if (editor.isGoogleDocsHTML(html)) {\n          cleanedHTML = await editor.cleanedDocsHTML(html);\n          return {\n            origin: \"docs\",\n            cleanedHTML,\n          };\n        }\n        cleanedHTML = await editor.cleanedGenericHTML(html);\n        return {\n          origin: \"generic\",\n          cleanedHTML,\n        };\n      },\n    },\n  };\n}\n"]}