%%
%% This is file `insdljs.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% insdljs.dtx  (with options: `copyright,package')
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% insdljs.sty package,                                 %%
%% Copyright (C) 2001-2018  D. P. Story                 %%
%%   dpstory@uakron.edu                                 %%
%%                                                      %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License        %%
%% Distributed from CTAN archives in directory          %%
%% macros/latex/base/lppl.txt; either version 1 of the  %%
%% License, or (at your option) any later version.      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{insdljs}
 [2017/09/03 v2.3g Insert Document Level JavaScripts (dps)]
\usepackage{xkeyval}
\RequirePackage{ifpdf}[2006/02/20]
\RequirePackage{ifxetex}[2006/08/21]
\RequirePackage{ifluatex}
\DeclareOptionX{dvipsone}{\def\dljs@drivernum{0}%
    \AtBeginDocument{\dvips@marker}}
\DeclareOptionX{dvips}{\def\dljs@drivernum{0}%
    \AtBeginDocument{\dvips@marker}}
\DeclareOptionX{textures}{\def\dljs@drivernum{0}%
    \AtBeginDocument{\dvips@marker}}
\DeclareOptionX{pdftex}{\def\dljs@drivernum{1}}
\DeclareOptionX{luatex}{\def\dljs@drivernum{1}}
\DeclareOptionX{dvipdfm}{\def\dljs@drivernum{2}}
\DeclareOptionX{dvipdfmx}{\def\dljs@drivernum{2}}
\DeclareOptionX{xetex}{\def\dljs@drivernum{2}}
\let\dl@YES=y \let\dl@NO=n
\let\dl@One=1 \let\dl@Zero=0
\let\dljs@YES=y \let\dljs@NO=n
\def\dvips@marker{\ifx\dljspresent\dl@NO\@OAction\fi}
\let\isOpenAction\dl@NO
\DeclareOptionX{nodljs}{\let\importdljs\dl@NO}
\let\importdljs\dl@YES
\let\firstdljs\dl@YES
\let\dljspresent\dl@NO
\DeclareOptionX{debug}{\let\dljs@debug\dl@YES}
\let\dljs@debug\dl@NO
\DeclareOptionX{execJS}{\let\execjs\dl@YES}
\let\execjs\dl@NO
\DeclareOptionX{nopro}{\let\dl@gopro\dl@NO}
\let\dl@gopro\dl@YES
\@ifpackageloaded{web}{%
    \ExecuteOptionsX{\eq@driver@name}%
}{%
    \@ifpackageloaded{eforms}{%
        \ExecuteOptionsX{\ef@driver}%
    }{%
        \ifpdf\ExecuteOptionsX{pdftex}\else
        \ifxetex\ExecuteOptionsX{xetex}\else
        \@ifundefined{l@tex@@@@driver}{\ExecuteOptionsX{dvips}}
            {\ExecuteOptionsX{dvipsone}}\fi\fi
    }%
}
\DeclareOptionX{reqjs}{\let\dl@reqJS\dl@YES}
\let\dljs@reqJS\dl@YES
\DeclareOptionX{!reqjs}{\let\dl@reqJS\dl@NO}
\DeclareOptionX{usealtadobe}{\def\inputAltAdbFncs{%
    \InputIfFileExists{altadbfncs.def}%
    {\PackageInfo{insdljs}{Inputting code for usealtadobe option}}%
    {\PackageWarning{insdljs}{Cannot find altadbfncs.def.\MessageBreak
        Reinstall or refresh your file name database.}}}}
\let\inputAltAdbFncs\relax
\ProcessOptionsX
\edef\dl@dquoteCat{\the\catcode`\"}
\catcode`\"=12\relax
\@ifundefined{dljs@drivernum}{%
    \PackageError{insdljs}%
        {You have not specified dvips, dvipsone, pdftex,\MessageBreak
        dvipdfm, dvipdfmx, or xetex in the option list
        \MessageBreak of the insdljs package}
        {Place one of the drivers dvips, dvipsone, pdftex,  dvipdfm,
        dvipdfmx, or xetex
        \MessageBreak in the option list of the insdljs package.}
}{}
\@ifundefined{ifpdfmarkup}{\newif\ifpdfmarkup}{}\pdfmarkupfalse
\ifpdf\else\ifxetex\else\pdfmarkuptrue\fi\fi
\RequirePackage{hyperref}
\ifpdf\ifx\pdfextension\@undefined\else
    \protected\def\pdfnames{\pdfextension names }
    \def\pdfpageref{\pdffeedback pageref}\fi\fi
\RequirePackage{verbatim}
\usepackage{conv-xkv}[2017/01/03]
\@ifundefined{dljs@drivernum}{%
    \@ifundefined{eq@drivernum}{%
        \PackageWarning{insdljs}
            {No driver specified, will check for pdftex.}
        \@ifundefined{pdfoutput}{%
            \@ifundefined{@pdfm@mark}{\def\eq@drivernum{2}%
            \def\dljs@drivernum{1}\let\isOpenAction\dl@NO
            \PackageWarning{insdljs}{No pdftex, but detected dvipdfm}}%
            {\PackageWarning{insdljs}{Neither pdftex nor dvipdfm,
                assuming dvips/dvipsone.}%
            \def\eq@drivernum{0}\def\dljs@drivernum{0}%
            \let\isOpenAction\dl@YES}
        }{%
            \ifcase\pdfoutput
                \def\eq@drivernum{1}\def\dljs@drivernum{1}%
                \let\isOpenAction\dl@NO
                \PackageInfo{insdljs}{Pdftex detected.}%
            \else
                \def\eq@drivernum{0}\def\dljs@drivernum{0}%
                \let\isOpenAction\dl@YES
                \PackageWarning{insdljs}{Pdftex engine detected,
                but is outputting dvi. Assuming dvips as the driver.}%
            \fi
        }%
    }{%
        \begingroup
            \count0=\eq@drivernum
            \xdef\dljs@drivernum{\ifcase\count0 0\or1\or2\or0\else0\fi}
            \ifnum\dljs@drivernum=0\global\let\isOpenAction\dl@YES
                \else\global\let\isOpenAction\dl@NO\fi
        \endgroup
    }%
}{}
\ifnum\dljs@drivernum=1\relax
    \RequirePackage{everyshi}
\fi
\def\AEB@psMrk{[\space}
\ifx\dl@reqJS\dl@YES
   \def\dl@@reqJS{/Type/Requirement/S/EnableJavaScripts}
   \ifpdf\pdfcatalog{\dl@@reqJS}\else
   \ifxetex\immediate\@pdfm@mark{put @catalog <<\dl@@reqJS>>}\else
   \literalps@out{\AEB@psMrk{Catalog} <<\dl@@reqJS>> /PUT pdfmark}\fi\fi
\fi
\providecommand\JS[1]{/S/JavaScript/JS(#1)}
\providecommand\Named[1]{/S/Named/N/#1}
\providecommand{\GoTo}{/S/GoTo/D}
\providecommand{\GoToD}{/S/GoTo/D}
\providecommand{\GoToR}{/S/GoToR}
\def\previewMiKTeX{\def\jsR{\string\r}\def\jsT{\string\t}}
{\obeylines %
\gdef\js@@R{\noexpand
}}
\let\dljstfor\@tfor
\def\jsR{\string\r\string\n}
\def\defineJSjsR{\string\r\eqbs^^J}
\def\jsN{\string\n}
{\catcode`\^^I\active %
\gdef^^I{\noexpand^^I}%
\gdef\js@@T{\noexpand^^I}%
}%  end of \catcode`\^^I
\let\jsT=\js@@T
\newwrite\js@verbatim@out
\def\iwvo#1{\immediate\write\js@verbatim@out{#1}}
\def\dl@lparen{(}\def\dl@rparen{)}
\def\jscsDflt{\let\protect\noexpand\let\jslit\string
    \let\~\dl@tilda\let\^\dl@sup
    \def\\{\eqbs\eqbs}\def\cs##1{\\\\##1}%
    \def\r{\\r}\def\t{\\t}\def\n{\\n}%
    \let\{\dl@lBrace\let\}\dl@rBrace
    \ifx\jsstr@useUni\dl@One\def\Uni{\\u}\else\def\u{\\u}\fi
    \ifx\jsstr@parens\dl@One\let\l@paren\dl@lparen
        \let\r@paren\dl@rparen\else
    \let\l@paren\@empty\let\r@paren\@empty\fi
}
\def\jscsDLJS{\let\protect\noexpand\let\jslit\string
    \let\~\dl@tilda\let\^\dl@sup
    \ifxetex\def\\{\eqbs\eqbs}\else\def\\{\eqbs}\fi\def\cs##1{\\\\##1}%
    \def\r{\\r}\def\t{\\t}\def\n{\\n}%
    \let\{\dl@lBrace\let\}\dl@rBrace
    \ifx\jsstr@useUni\dl@One\def\Uni{\\u}\else\def\u{\\u}\fi
    \ifx\jsstr@parens\dl@One\let\l@paren\dl@lparen
        \let\r@paren\dl@rparen\else
    \let\l@paren\@empty\let\r@paren\@empty\fi
}
\ifpdf\let\jscsDLJS\jscsDflt\fi
\let\dl@JSCS\jscsDflt
\newcommand{\flJSStr}{\bgroup
    \let\dl@JSCS\jscsDflt
    \@ifstar{\def\isStar{*}\dl@defJSStr}
    {\let\isStar\relax\dl@defJSStr}}
\let\fieldJSStr\flJSStr
\let\defineJSStr\flJSStr
\newcommand{\dlJSStr}{\bgroup
    \@ifstar{\def\isStar{*}\let\dl@JSCS\jscsDLJS\dl@defJSStr}
    {\let\isStar\relax\let\dl@JSCS\jscsDLJS\dl@defJSStr}}
\define@key{jsstr}{quotes}[]{\let\jsstr@quotes\dl@One}
\define@key{jsstr}{noquotes}[]{\let\jsstr@quotes\dl@Zero}
\define@key{jsstr}{parens}[]{\let\jsstr@parens\dl@One}
\define@key{jsstr}{noparens}[]{\let\jsstr@parens\dl@Zero}
\let\jsstr@quotes\dl@One\let\jsstr@parens\dl@One
\define@key{jsstr}{useUni}[]{\let\jsstr@useUni\dl@One}
\let\jsstr@useUni\dl@Zero
\newcommand{\dl@defJSStr}[3][quotes]{\def\dl@argi{#1}\ifx\dl@argi\@empty
    \else\ifx\dl@JSCS\jscsDLJS\let\jsstr@parens\dl@Zero\fi
    \setkeys{jsstr}{#1}\fi\dl@JSCS
    \ifx\jsstr@quotes\dl@One
        \xdef#2{\l@paren"#3"\r@paren}\else
        \xdef#2{\l@paren#3\r@paren}\fi
    \if\isStar*\gdef\dl@afterAction{{\Hy@unicodefalse\expandafter
        \pdfstringdef\expandafter#2\expandafter{#2}}}\else
        \global\let\dl@afterAction\relax\fi
    \aftergroup\dl@afterAction\egroup}
\def\dlTC#1{try{#1}catch(e){}}
\def\js@R{\ifcase\dljs@drivernum^^J\else\jsR\fi}
\def\db#1\db{\ifx\dljs@debug\dl@YES\space\space\space#1\js@R\fi}
\newcounter{dljs@cnt}
\newcounter{dljssegs}\setcounter{dljssegs}{2}
\newenvironment{js@verbatimwrite}% writes to current \js@verbatim@out
 {%
    \@bsphack
    \let\do\@makeother\dospecials\catcode`\^^M\active
    \def\verbatim@processline{%
        \immediate\write\js@verbatim@out{\the\verbatim@line}}%
    \verbatim@start}{\@esphack}
\def\closejs@verbatim@out{\immediate\closeout\js@verbatim@out}
\begingroup
\catcode`\@=0 @catcode`@\=12
@gdef@eqbs{\}
@gdef@ccpdfmark{@gdef@eqesc{\}@gdef@eqesci{}}
@endgroup
\begingroup
    \catcode`<=1 \catcode`\>=2 \@makeother\{ \@makeother\}
\gdef\definebraces<\def\{<\eqesc{>\def\}<\eqesc}>>
\endgroup
\def\eqdospecials{\do\ \do\{\do\}\do\$\do\&%
  \do\#\do\^\do\_\do\~}
\begingroup
\catcode`\~=\active \lccode`\~=`\^^M
\lowercase{\endgroup
    \def\eqverbatim@#1~{\verbatim@@#1*end\@nil}%
    \def\eqverbatim@@#1*end{%
    \verbatim@addtoline{#1}%
    \futurelet\dl@next\eqverbatim@@@}%
    \def\eqverbatim@@@#1\@nil{%
    \ifx\dl@next\@nil
        \verbatim@processline
        \verbatim@startline
        \let\dl@next\eqverbatim@
    \else
        \def\@tempa##1*end\@nil{##1}%
        \@temptokena{*end}%
        \def\dl@next{\expandafter\verbatim@test\@tempa#1\@nil~}%
    \fi\dl@next}%
}%
\def\jsexpverbatimwrite
{% writes to current \js@verbatim@out
    \@bsphack
    \ccpdfmark
    \catcode`\<=12 \catcode`\>=12
    \input{dljscc.def}%
    \let\verbatim@=\eqverbatim@
    \let\verbatim@@=\eqverbatim@@
    \let\verbatim@@@=\eqverbatim@@@
    \let\do\@makeother\eqdospecials%
    \catcode`\^^M=\active\catcode`\^^I=12%
    \def\verbatim@processline{%
        \edef\expVerb{\the\verbatim@line}%
        \immediate\write\js@verbatim@out{\expVerb}}%
        \verbatim@start%
}
\def\endjsexpverbatimwrite{\immediate\closeout\js@verbatim@out\@esphack}
\let\js@Path\@empty
\def\insPath#1{\def\js@Path{#1}}
\begingroup
\catcode`\{=12 \catcode`\}=12 \catcode`\<=1 \catcode`\>=2
\gdef\dl@lBrace<\string\{> \gdef\dl@rBrace<\string\}>
\gdef\dl@tilda<\string~> \gdef\dl@sup<\string^>
\endgroup
\def\makeJSspecials{%
    \def\\{\eqbs\eqbs}%         % define \\ to be \\
    \let\jslit\string
    \let\{\dl@lBrace\let\}\dl@rBrace
    \let\u\@empty
    \def\({\eqbs(}\def\){\eqbs)}%
    \makespecialJS              % make \r=\jsR and \t=\jsT
}
\def\dl@fitpage{/Fit}
\def\dl@actualsize{/XYZ null null 1.0}  %{/XYZ -32768 -32768 1.0}
\def\dl@fitwidth{/FitH null}            %{/FitH -32768}
\def\dl@fitheight{/FitV null}           %{/FitV -32768}
\def\dl@fitvisible{/FitBH null}         %{/FitBH -32768}
\def\dl@inheritzoom{/XYZ 0 0 0}
\def\dl@mag#1{/XYZ null null #1}
\edef\dl@Page#1{\ifcase\dljs@drivernum
    {Page#1}\or\noexpand\pdfpageref#1\space\space 0 R\or
    @page#1\fi}
\def\dl@preProcDefns{\let\Page\dl@Page\let\mag\dl@mag
    \let\fitpage\dl@fitpage\let\actualsize\dl@actualsize
    \let\fitwidth\dl@fitwidth\let\fitheight\dl@fitheight
    \let\fitvisible\dl@fitvisible\let\inheritzoom\dl@inheritzoom
}
\let\aeb@additionalOpenAction\@empty
\let\aeb@addActionCode\@empty
\let\addActionObj\@empty
\let\aebpopentoks\@empty
\let\aebpFA\dl@NO
\def\aebp@rightDelimiters{}
\newcommand{\addToDocOpen}[1]{%
    \ifx\aebpFA\dl@NO
        \g@addto@macro\aebpopentoks{#1}%
        \def\aeb@additionalOpenAction{/Next {pubAddToDocOpen}}%
\ifpdf
        \def\aeb@addActionCode{\immediate\pdfobj{<<
        \aebpopentoks\aebp@rightDelimiters >>}%
        \edef\addActionObj{\the\pdflastobj\space 0 R}}%
\else\ifxetex
        \def\aeb@addActionCode{\immediate
            \@pdfm@mark{obj @objAddActionObj
            << \aebpopentoks\aebp@rightDelimiters >> }}%
        \def\addActionObj{@objAddActionObj}%
\else % postscript
        \def\aeb@addActionCode{\literalps@out{%
        \AEB@psMrk/_objdef {pubAddToDocOpen}
            /type/dict /OBJ pdfmark^^J%
        \AEB@psMrk{pubAddToDocOpen} <<
        \aebpopentoks\aebp@rightDelimiters >> /PUT pdfmark}}%
        \def\addActionObj{{pubAddToDocOpen}}%
\fi\fi
        \global\let\aebpFA\dl@YES
        \let\@pdfstartview\@empty
    \else
            \edef\aebp@dljstmp{\aebp@rightDelimiters}%
            \xdef\aebp@rightDelimiters{\aebp@dljstmp >> }%
            \g@addto@macro\aebpopentoks{/Next << #1 }%
    \fi
}
\def\dljs@OpenActions{/OpenAction \addActionObj}
\def\dljs@setOpenActions{\bgroup\makeJSspecials\dl@preProcDefns
    \aeb@addActionCode
    \ifpdf\pdfcatalog{\dljs@OpenActions}\else
    \ifxetex\immediate
        \@pdfm@mark{put @catalog <<\dljs@OpenActions>>}\else
    \literalps@out{\AEB@psMrk
     {Catalog} <<\dljs@OpenActions>> /PUT pdfmark}\fi\fi\egroup}
\@ifpackageloaded{aeb_pro}{}
    {\AtBeginDocument{\ifx\aebpFA\dl@YES\expandafter
        \dljs@setOpenActions\fi}}
\let\@CloseAction\@empty
\def\@OAction@pdfmark{\literalps@out{%
     \AEB@psMrk{ThisPage} << /AA << /O << \theFirstAction\space
    \opentoks\@rightDelimiters >> \@CloseAction >> >> /PUT pdfmark}}
\def\@POAction@pdfmark{\literalps@out{%
    \AEB@psMrk{ThisPage} << /AA << \@thisOpenAction
    \@thisCloseAction >> >> /PUT pdfmark}%
}
\def\@OAction@pdftex{%
    \ifx\isOpenAction\dl@YES
        \xdef\pdftexOAction{/AA << /O << \theFirstAction\space
        \opentoks\@rightDelimiters >> \@CloseAction  >>}%
        \AtNextShipout{\pdfpageattr=\expandafter{\pdftexOAction}}%
    \fi
}
\def\@POAction@pdftex{%
  \xdef\thisPageActionpdftex{/AA << \@thisOpenAction
    \@thisCloseAction >>}%
  \AtNextShipout{\pdfpageattr=\expandafter{\thisPageActionpdftex}}%
}
\def\@OAction@dvipdfm{\ifx\isOpenAction\dl@YES
    \@pdfm@mark{put @thispage << /AA << /O << \theFirstAction\space
    \opentoks\@rightDelimiters >> \@CloseAction >> >>}\fi
}
\def\@POAction@dvipdfm{%
    \@pdfm@mark{put @thispage << /AA << \@thisOpenAction
    \@thisCloseAction >> >>}%
}
\ifcase\dljs@drivernum
    \let\@OAction\@OAction@pdfmark
    \let\@POAction\@POAction@pdfmark
    \gdef\theFirstAction{/S/JavaScript/JS (\the\importfdftoks)}
    \let\isOpenAction\dl@YES
\or
    \let\@OAction\@OAction@pdftex
    \let\@POAction\@POAction@pdftex
    \AtBeginDocument{\@OAction@pdftex}
\or
    \let\@OAction\@OAction@dvipdfm
    \let\@POAction\@POAction@dvipdfm
    \AtBeginDocument{\@OAction@dvipdfm}
\fi
\def\opentoks{}
\def\makespecialJS{%
    \let\r\jsR\let\t\jsT\let\n\jsN}
\def\@rightDelimiters{}
\def\OpenAction{\@ifnextchar\Next
    {\expandafter\@OpenAction\@gobble}{\@OpenAction}}
\def\@OpenAction#1{%
    \ifx\isOpenAction\dl@NO
        {\makespecialJS\xdef\theFirstAction{#1}}%
        \global\let\isOpenAction\dl@YES
    \else
        \edef\dljstmp{\@rightDelimiters}%
        \xdef\@rightDelimiters{\dljstmp >> }%
        {\makespecialJS\xdef\dljstmp{\opentoks /Next << #1 }}%
        \xdef\opentoks{\dljstmp}%
    \fi
    \@nextOpenAction
}
\def\@nextOpenAction{\@ifnextchar\Next{\expandafter
    \@OpenAction\@gobble}{}}
\def\protectJSCtrls{\def\r{\string\r\string\n}%
    \def\t{\string\t}\def\n{\string\n}}
\def\dljs@tstlp{\@ifnextchar\bgroup
    {\let\dljs@multi\dl@YES\dljs@tstlpi}%
    {\let\dljs@multi\dl@NO\dljs@tstlpi}}
\def\dljs@tstlpi#1\@nil{}%
\def\dljs@bldScript#1#2#3{{%
    \dljs@tstlp#1\@nil
    \ifx\dljs@multi\dl@NO{\protectJSCtrls\xdef#3{/#2<<#1>>}}\else
        \toks0={}\let\dljs@rAngles\@empty\count0=0
        \@tfor\dljs@arg:=#1\do{%
            \ifnum\count0=0
                \toks0=\expandafter{\dljs@arg}\else
                \toks2=\expandafter{\dljs@arg}%
                \edef\holdtokstmp{\the\toks0
                    /Next<<\the\toks2 }%
                \edef\dljs@rAngles{\dljs@rAngles\space>>}%
                \toks0=\expandafter{\holdtokstmp}%
            \fi
            \advance\count0by1
        }%
        {\protectJSCtrls\xdef#3{/#2<<\the\toks0 \dljs@rAngles>>}%
         \xdef#3{#3}}%
    \fi
}}
\newcommand{\thisPageAction}[2]{%
    \let\@CloseAction\@empty
    \let\@thisOpenAction\@empty
    \let\@thisCloseAction\@empty
    \def\dljs@argi{#1}\def\dljs@argii{#2}%
    \ifnum\value{page}=1\relax
        \ifx\dljs@argii\@empty\else
            \dljs@bldScript{#2}{C}{\@CloseAction}\fi
        \ifx\dljs@argi\@empty\else\dljs@tstlp#1\@nil
            \ifx\dljs@multi\dl@NO\OpenAction{#1}\else
            \@tfor\dljs@arg:=#1\do{\expandafter
                \OpenAction\expandafter{\dljs@arg}%
            }\fi
        \fi
    \else
        \ifx\dljs@argi\@empty\else
            \dljs@bldScript{#1}{O}{\@thisOpenAction}\fi
        \ifx\dljs@argii\@empty\else
            \dljs@bldScript{#2}{C}{\@thisCloseAction}\fi
        \@POAction
    \fi
}
\let\insdljsloadVar\@empty
\newenvironment{insDLJS}[3][]
{%
    \gdef\detectdljs{#1}\gdef\dljsBase{#2}%
    \ifxetex{\def\1{\string\1}\def\2{\string2}%
    \def\3{\string\3}\xdef\dljsName{#3}}\else
    \Hy@unicodefalse\pdfstringdef{\dljsName}{#3}\fi
\ifx\detectdljs\@empty
    \stepcounter{dljs@cnt}%
    \xdef\detectdljs{_bInsdljsload\arabic{dljs@cnt}}%
    \edef\insdljsloadVar{var \detectdljs=true;}%
    \addtocounter{dljs@cnt}{-1}%
\fi
    \global\let\multisegments\dl@NO\setcounter{dljssegs}{2}%
    \global\dljsobjtoks={}%
    \expandafter\ifx\csname dljs\dljsBase\endcsname\relax
        \else\@insjserrDuplicate\fi
    \ifcase\dljs@drivernum
        \let\insert@DLJS=\insert@DLJS@pdfmark
        \let\endinsDLJS=\endinsert@DLJS@pdfmark
        \let\newsegment=\newsegment@pdfmark
        \let\endnewsegment=\endnewsegment@pdfmark
    \or
        \let\insert@DLJS=\insert@DLJS@pdftex
        \let\endinsDLJS=\endinsert@DLJS@pdftex
        \let\newsegment=\newsegment@pdftex
        \let\endnewsegment=\endnewsegment@pdftex
    \or
        \let\insert@DLJS=\insert@DLJS@dvipdfm
        \let\endinsDLJS=\endinsert@DLJS@dvipdfm
        \let\newsegment=\newsegment@dvipdfm
        \let\endnewsegment=\endnewsegment@dvipdfm
    \fi
    \insert@DLJS
}{}
\newenvironment{insDLJS*}[2][]
{%
    \gdef\detectdljs{#1}\gdef\dljsBase{#2}%
\ifx\detectdljs\@empty
    \stepcounter{dljs@cnt}%
    \xdef\detectdljs{_bInsdljsload\arabic{dljs@cnt}}%
    \edef\insdljsloadVar{var \detectdljs=true;}%
    \addtocounter{dljs@cnt}{-1}%
\fi
    \global\let\multisegments\dl@YES\setcounter{dljssegs}{2}%
    \global\dljsobjtoks={}%
    \expandafter\ifx\csname dljs\dljsBase\endcsname\relax
        \else\@insjserrDuplicate\fi
    \ifcase\dljs@drivernum
        \let\insert@DLJS=\insert@DLJS@pdfmark
        \expandafter
            \let\csname endinsDLJS*\endcsname\endinsert@DLJS@pdfmark
        \let\newsegment=\newsegment@pdfmark
        \let\endnewsegment=\endnewsegment@pdfmark
    \or
        \let\insert@DLJS=\insert@DLJS@pdftex
        \expandafter
            \let\csname endinsDLJS*\endcsname\endinsert@DLJS@pdftex
        \let\newsegment=\newsegment@pdftex
        \let\endnewsegment=\endnewsegment@pdftex
    \or
        \let\insert@DLJS=\insert@DLJS@dvipdfm
        \expandafter
            \let\csname endinsDLJS*\endcsname\endinsert@DLJS@dvipdfm
        \let\newsegment=\newsegment@dvipdfm
        \let\endnewsegment=\endnewsegment@dvipdfm
    \fi
    \insert@DLJS
}{}
\def\@insjserrDuplicate{%
    \typeout{^^J! insdljs Package error.}
    \typeout{! insDLJS environment: On line number \the\inputlineno,}
    \typeout{! the base name `\dljsBase' has already been chosen.}
    \typeout{! A DLJS earlier defined has been overwritten!}
    \typeout{! Choose another name for the first required argument}
    \typeout{! of the insDLJS environment.^^J}
}
\newif\ifisdljs \isdljsfalse
\begingroup
\catcode`\~=12 \catcode`\#=12
\gdef\efdlspecials{\catcode`\~=12 \catcode`\#=12}
\endgroup
\def\ckivspace#1{\if\noexpand#1\space\else\expandafter#1\fi}
\let\DLspecialDefs\@empty
\def\fdfAfterheader
{%
    \iwvo{\string\begingroup\string\efdlspecials}
    \iwvo{\string\DLspecialDefs}
    \iwvo{\string\isdljstrue}
    \iwvo{\string\makeatletter}
    \iwvo{\string\immediate\string\openout\string
\js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
    \iwvo{\string\begin{jsexpverbatimwrite}}
    \iwvo{\string\firstFDFline}
    \iwvo{1 0 obj}
    \iwvo{<< /FDF << /JavaScript << /Doc 2 0 R /After 3 0 R >> >> >> }
    \iwvo{endobj}
    \iwvo{2 0 obj}
\ifpdfmarkup
    \iwvo{[ (ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\else
    \iwvo{[ (00 ExecJS \dljsBase) (var _\dljsBase\space = true;) ] }\fi
    \iwvo{endobj}
    \iwvo{3 0 obj}
    \iwvo{<<>>}
    \iwvo{stream}
}
\newenvironment{execJS}[1]
{%
    \gdef\detectdljs{\string_#1}\gdef\dljsBase{#1}%
    \global\dljsobjtoks={}%
    \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
    \ifx\importdljs\dl@YES\ifx\execjs\dl@YES
        \ifx\dl@gopro\dl@YES
        \ifnum\dljs@drivernum=0\relax
            \addImportAnFDF\importAnFDFTemplate
        \else
            \OpenAction{/S/JavaScript/JS (\importAnFDFTemplate)}%
        \fi\fi
    \fi\fi
    \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
    \fdfAfterheader
    \js@verbatimwrite
}{%
    \fdfendstreamobj
    \endjs@verbatimwrite
    \fdftrailer
    \closejs@verbatim@out
    \expandafter\xdef\csname\dljsBase OBJ\endcsname{\the\dljsobjtoks}%
    \edef\@dljstmp{\noexpand\AtBeginDocument{%
        \noexpand\input{\js@Path\dljsBase.djs}}}\@dljstmp
}
\newtoks\JStoks
\newenvironment{defineJS}[2][]
{%
    \expandafter\@ifundefined\expandafter{%
        \expandafter\@gobble\string#2}{}{%
            \PackageWarning{insdljs}{The command
                \string#2 already defined}}%
    \gdef\defineJSArg{#2}\JStoks={}%
    \def\verbatim@processline
        {%
            \xdef\JS@temp{\the\JStoks\the\verbatim@line\defineJSjsR}%
            \global\JStoks=\expandafter{\JS@temp}%
        }%
    \let\do\@makeother\dospecials\catcode`\^^M\active
    #1%
    \verbatim@start
}{\gdef\eq@JStemp{\expandafter\edef\defineJSArg{\the\JStoks}}%
    \aftergroup\eq@JStemp}
\newenvironment{@defineJS}[2][]
{%
    \gdef\defineJSArg{#2}\JStoks={}%
    \def\verbatim@processline
        {%
            \xdef\JS@temp{\the\JStoks\the\verbatim@line\defineJSjsR}%
            \global\JStoks=\expandafter{\JS@temp}%
        }%
    \let\do\@makeother\dospecials\catcode`\^^M\active
    #1%
    \verbatim@start
}{\gdef\eq@JStemp{\expandafter\edef\defineJSArg{\the\JStoks}}%
    \aftergroup\eq@JStemp}
\newenvironment{localJS}[1][]{}{\ifvmode\else\unskip\fi}
\newenvironment{willClose}[1][]
{\@defineJS[#1]{\will@Close}}
{\end@defineJS}
\let\will@Close\@empty
\newenvironment{willSave}[1][]
{\@defineJS[#1]{\will@Save}}
{\end@defineJS}
\let\will@Save\@empty
\newenvironment{didSave}[1][]
{\@defineJS[#1]{\did@Save}}
{\end@defineJS}
\let\did@Save\@empty
\newenvironment{willPrint}[1][]
{\@defineJS[#1]{\will@Print}}
{\end@defineJS}
\let\will@Print\@empty
\newenvironment{didPrint}[1][]
{\@defineJS[#1]{\did@Print}}
{\end@defineJS}
\let\did@Print\@empty
\def\dljs@willDidActions{/AA <<
   \ifx\test@will@Close\@empty\else/WC <<
        \JS{\will@Close} >>\fi
   \ifx\test@will@Save\@empty\else/WS <<
        \JS{\will@Save} >>\fi
   \ifx\test@did@Save\@empty\else/DS <<
        \JS{\did@Save} >>\fi
   \ifx\test@will@Print\@empty\else/WP <<
        \JS{\will@Print} >>\fi
   \ifx\test@did@Print\@empty\else/DP <<
        \JS{\did@Print} >>\fi
    >>
}
\newcommand\dljs@setDocActions{%
    \edef\test@will@Close{\will@Close}%
    \edef\test@will@Save{\will@Save}%
    \edef\test@did@Save{\did@Save}%
    \edef\test@will@Print{\will@Print}%
    \edef\test@did@Print{\did@Print}%
    \ifpdf\pdfcatalog{\dljs@willDidActions}\else
    \ifxetex\immediate
        \@pdfm@mark{put @catalog <<\dljs@willDidActions>>}\else
    \literalps@out{\AEB@psMrk
     {Catalog} <<\dljs@willDidActions>> /PUT pdfmark}\fi\fi
}
\@ifpackageloaded{aeb_pro}{}
    {\AtBeginDocument{\dljs@setDocActions}}
\begingroup
\catcode`\%=12
\gdef\firstFDFline{%FDF-1.2}
\gdef\lastFDFline{%%EOF}
\endgroup
\def\fdfheader
{%
    \iwvo{\string\begingroup\string\efdlspecials}
    \iwvo{\string\isdljstrue}
    \iwvo{\string\makeatletter}
    \iwvo{\string\immediate\string\openout\string
        \js@verbatim@out=\string\js@Path\space\dljsBase.fdf}%
    \iwvo{\string\begin{jsexpverbatimwrite}}
    \iwvo{\string\firstFDFline}
    \iwvo{1 0 obj}
    \iwvo{<< /FDF << /JavaScript << /Doc 2 0 R >> >> >>}
    \iwvo{endobj}
    \iwvo{2 0 obj}
    \iwvo{[ \string\csname\string\@gobble\space\dljsBase%
        OBJ\string\endcsname]}
    \iwvo{endobj}
}
\def\fdfbeginstreamobj
{%
    \iwvo{\thedljssegs\space 0 obj}
    \iwvo{<<>>}
    \iwvo{stream}
    \ifx\insdljsloadVar\@empty\else
        \iwvo{\insdljsloadVar}
        \global\let\insdljsloadVar\@empty
    \fi
}
\def\fdfendstreamobj{%
    \iwvo{endstream}
    \iwvo{endobj}
}
    \def\fdftrailer{%
    \iwvo{trailer}
    \iwvo{<< /Root 1 0 R >>}
    \iwvo{\string\lastFDFline}
    \iwvo{*end{jsexpverbatimwrite}}
    \iwvo{\string\endgroup}
}
\newtoks\importfdftoks \importfdftoks={}
\newtoks\dljsobjtoks \dljsobjtoks={}
\def\importAnFDFTemplate{%
if(typeof \detectdljs\space == "undefined")\jsR\jsT
    ( app.viewerVersion > 8 ) ? %
        aebTrustedFunctions( this, aebImportAnFDF, %
        "\js@Path\dljsBase.fdf") : %
        this.importAnFDF("\js@Path\dljsBase.fdf");\jsR
}
\def\addImportAnFDF#1{%
    \ifx\importdljs\dl@YES
        \edef\importAnFDFtmp{\the\importfdftoks#1}%
        \global\importfdftoks=\expandafter{\importAnFDFtmp}%
    \fi
}
\def\importAnFDF{\ifx\importdljs\dl@YES\@OAction\fi}
\newenvironment{newsegment@pdfmark}[1]{%
    \addtocounter{dljssegs}{1}%
    \addtocounter{dljs@cnt}{1}%
    \Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
    \edef\@dljstmp{\the\dljsobjtoks(\dljsName)
        \thedljssegs\space 0 R\space}
    \global\dljsobjtoks=\expandafter{\@dljstmp}
    \fdfbeginstreamobj
    \js@verbatimwrite
}{%
    \fdfendstreamobj
    \endjs@verbatimwrite
}
\def\insert@DLJS@pdfmark{%
    \global\let\dljspresent\dl@YES
    \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
    \ifx\importdljs\dl@YES\ifx\dl@gopro\dl@YES
        \addImportAnFDF\importAnFDFTemplate
    \fi\fi
    \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
    \fdfheader
    \ifx\multisegments\dl@NO\expandafter
        \newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
}
\def\endinsert@DLJS@pdfmark{%
    \ifx\importdljs\dl@YES
        \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
        \fdftrailer
        \closejs@verbatim@out
        \expandafter\xdef\csname\dljsBase%
            OBJ\endcsname{\the\dljsobjtoks}%
        \edef\@dljstmp{\noexpand\AtBeginDocument{%
            \noexpand\input{\js@Path\dljsBase.djs}}}%
        \@dljstmp
        \ifx\firstdljs\dl@YES
            \AtBeginDocument{\edef\@dljstmp{\importAnFDF}%
                \@dljstmp}\global\let\firstdljs\dl@NO
        \fi
    \fi
}
\begingroup
\catcode`\@=0 @catcode`@\=12
@gdef@ccpdftex{@gdef@eqesc{\\}@gdef@eqesci{\}}
@endgroup
\def\begindljs
{%
    \iwvo{\string\begingroup\string\efdlspecials}
    \iwvo{\string\isdljstrue}
    \iwvo{\string\makeatletter}
    {\uccode`c=`\%\uppercase{%
        \iwvo{\string\obeyspaces\string\obeylines
            \string\let\string^\string^M=\string\jsR c}}}
    {\escapechar=-1 \lccode`C=`\%\lowercase{%
        \iwvo{\string\\catcode`\string\\"=12C}}}
}
\def\beginseg
{%
    {\lccode`P=`\{\lccode`C=`\%\lowercase{%
        \iwvo{\string\gdef\string\dljs\dljsBase\roman{dljssegs}PC}}}%
}
\def\endseg
{%
    {\uccode`c=`\%\uccode`p=`\}\uppercase{\iwvo{pc}}}%
}
\def\enddljs
{%
    \iwvo{\string\endgroup}%
}
\def\@roman#1{\romannumeral#1}
\def\write@objs
{%
\iwvo{\begingroup}
\iwvo{\string\catcode`\string\<=12 }
\iwvo{\string\catcode`\string\>=12 }
{\lccode`C=`\%\lowercase{\iwvo{\string\ccpdftex C}}}
{\lccode`C=`\%\lowercase{\iwvo{%
            \string\input{dljscc.def}C\the\dljsobjtoks}}}
\iwvo{\endgroup}
}
\newenvironment{newsegment@pdftex}[1]{%
    \addtocounter{dljssegs}{1}%
    \addtocounter{dljs@cnt}{1}%
    \edef\tmp{^^J\string\immediate\string\pdfobj{ << /S/JavaScript/JS%
    (\string\dljs\dljsBase\roman{dljssegs}) >> }}%
    \edef\@dljstmp{\the\dljsobjtoks\tmp}%
    \global\dljsobjtoks=\expandafter{\@dljstmp}%
    \edef\tmp{^^J\string\xdef\string\obj\dljsBase\roman{dljssegs}%
        {\string\the\string\pdflastobj\string\space 0 R}}%
    \edef\@dljstmp{\the\dljsobjtoks\tmp}%
    \global\dljsobjtoks=\expandafter{\@dljstmp}%
    \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
    \Hy@unicodefalse\pdfstringdef{\dljsName}{#1}%
    \edef\dljspdftextmp
    {\the\importfdftoks (\curr@Cnt\space\dljsName)
        \noexpand\csname obj\dljsBase\roman{dljssegs}%
            \noexpand\endcsname\space}%
    \global\importfdftoks=\expandafter{\dljspdftextmp}%
    \beginseg
    \js@verbatimwrite
}{%
    \endjs@verbatimwrite
    \endseg
}
\newenvironment{insert@DLJS@pdftex}{%
    \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
    \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
    \begindljs
    \ifx\multisegments\dl@NO\expandafter
        \newsegment\expandafter{\expandafter\dljsName\expandafter}\fi
}{%
    \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
    \enddljs
    \write@objs
    \endjs@verbatimwrite
    \closejs@verbatim@out
    \edef\@dljstmp{\noexpand\AtBeginDocument{%
        \noexpand\input{\js@Path\dljsBase.djs}}}%
    \@dljstmp
    \ifx\importdljs\dl@YES
        \ifx\firstdljs\dl@YES
            \AtEndDocument{\edef\@dljstmp{\setDLJSRef@pdftex}\@dljstmp}
            \global\let\firstdljs\dl@NO
        \fi
    \fi
}
\def\setDLJSRef@pdftex
{%
  \noexpand\immediate\noexpand\pdfobj {%
    << /Names [\the\importfdftoks] >> }%
  \edef\noexpand\objNames{\noexpand\the\noexpand\pdflastobj\space 0 R}%
  \pdfnames {/JavaScript \noexpand\objNames}%
}
\newenvironment{newsegment@dvipdfm}[1]
{%
    \addtocounter{dljssegs}{1}%
    \addtocounter{dljs@cnt}{1}%
    \edef\tmp{^^J\string\immediate\string
        \csname\space @pdfm@mark\string\endcsname
        {obj @obj\dljsBase\roman{dljssegs}\space << /S/JavaScript%
        /JS(\string\dljs\dljsBase\roman{dljssegs}) >> }}%
    \edef\@dljstmp{\the\dljsobjtoks\space\tmp}%
    \global\dljsobjtoks=\expandafter{\@dljstmp}%
    \edef\curr@Cnt{\ifnum\arabic{dljs@cnt}<10 0\fi\arabic{dljs@cnt}}%
    {\def\1{\string\1}\def\2{\string2}%
    \def\3{\string\3}\xdef\dljsName{#1}}%
    \edef\dljspdftextmp
    {\the\importfdftoks (\curr@Cnt\space \dljsName) %
        @obj\dljsBase\roman{dljssegs}\space}%
    \global\importfdftoks=\expandafter{\dljspdftextmp}%
    \beginseg
    \js@verbatimwrite
}{%
    \endjs@verbatimwrite
    \endseg
}
\def\setDLJSRef@dvipdfm
{%
  \immediate\@pdfm@mark{obj @objnames %
    << /Names [\the\importfdftoks] >> }%
  \@pdfm@mark{put @names %
    << /JavaScript @objnames >> }%
}
\newenvironment{insert@DLJS@dvipdfm}
{%
    \expandafter\gdef\csname dljs\dljsBase\endcsname{}%
    \immediate\openout \js@verbatim@out \js@Path\dljsBase.djs
    \begindljs
    \ifx\multisegments\dl@NO\expandafter\newsegment\expandafter{%
        \expandafter\dljsName\expandafter}\fi
}{%
    \ifx\multisegments\dl@NO\expandafter\endnewsegment\fi
    \enddljs
    \write@objs
    \endjs@verbatimwrite
    \closejs@verbatim@out
    \edef\@dljstmp{\noexpand\AtBeginDocument{%
        \noexpand\input{\js@Path\dljsBase.djs}}}%
    \@dljstmp
    \ifx\importdljs\dl@YES
        \ifx\firstdljs\dl@YES
            \AtBeginDocument{\setDLJSRef@dvipdfm}%
            \global\let\firstdljs\dl@NO
        \fi
    \fi
}
\catcode`\"=\dl@dquoteCat
\inputAltAdbFncs
\endinput
%%
%% End of file `insdljs.sty'.
